mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-22 17:56:30 -05:00
auth: hash auth token
Since the auth token will be stored in hashed form in the db, we need to hash each provided auth token in order to search in the db for them. Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
parent
667cf7e915
commit
e5545043be
1 changed files with 2 additions and 1 deletions
|
@ -78,8 +78,9 @@ export class UsersService {
|
|||
}
|
||||
|
||||
async getUserByAuthToken(token: string): Promise<User> {
|
||||
const hash = this.hashPassword(token);
|
||||
const accessToken = await this.authTokenRepository.findOne({
|
||||
where: { accessToken: token },
|
||||
where: { accessToken: hash },
|
||||
});
|
||||
if (accessToken === undefined) {
|
||||
throw new NotInDBError(`AuthToken '${token}' not found`);
|
||||
|
|
Loading…
Reference in a new issue