mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-06-01 23:58:58 -04:00
Split methods getAuthTokenAndValidate
and createTokenForUser
Signed-off-by: Yannick Bungers <git@innay.de>
This commit is contained in:
parent
c835339633
commit
499f632d8d
5 changed files with 102 additions and 92 deletions
|
@ -48,16 +48,16 @@ export class AuthToken {
|
|||
keyId: string,
|
||||
user: User,
|
||||
label: string,
|
||||
accessToken: string,
|
||||
tokenString: string,
|
||||
validUntil: Date,
|
||||
): Omit<AuthToken, 'id' | 'createdAt'> {
|
||||
const newToken = new AuthToken();
|
||||
newToken.keyId = keyId;
|
||||
newToken.user = Promise.resolve(user);
|
||||
newToken.label = label;
|
||||
newToken.accessTokenHash = accessToken;
|
||||
newToken.validUntil = validUntil;
|
||||
newToken.lastUsedAt = null;
|
||||
return newToken;
|
||||
const token = new AuthToken();
|
||||
token.keyId = keyId;
|
||||
token.user = Promise.resolve(user);
|
||||
token.label = label;
|
||||
token.accessTokenHash = tokenString;
|
||||
token.validUntil = validUntil;
|
||||
token.lastUsedAt = null;
|
||||
return token;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue