mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-21 18:55:19 -04:00
change getTokensByUsername to getTokensByUser
Signed-off-by: Yannick Bungers <git@innay.de>
This commit is contained in:
parent
141b1bf5e8
commit
aa8455a079
3 changed files with 12 additions and 14 deletions
|
@ -140,14 +140,14 @@ export class AuthService {
|
|||
return accessToken;
|
||||
}
|
||||
|
||||
async getTokensByUsername(userName: string): Promise<AuthToken[]> {
|
||||
const user = await this.usersService.getUserByUsername(userName, [
|
||||
UserRelationEnum.AUTHTOKENS,
|
||||
]);
|
||||
if (user.authTokens === undefined) {
|
||||
async getTokensByUser(user: User): Promise<AuthToken[]> {
|
||||
const tokens = await this.authTokenRepository.find({
|
||||
where: { user: user },
|
||||
});
|
||||
if (tokens === undefined) {
|
||||
return [];
|
||||
}
|
||||
return user.authTokens;
|
||||
return tokens;
|
||||
}
|
||||
|
||||
async removeToken(keyId: string): Promise<void> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue