mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-02-06 23:41:51 +00:00
auth: Remove userName parameter of removeToken function
As suggested by @innaytool Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
parent
a8b46923fd
commit
14a4872f49
3 changed files with 4 additions and 6 deletions
|
@ -48,7 +48,6 @@ export class TokensController {
|
|||
@Delete('/:keyId')
|
||||
@HttpCode(204)
|
||||
async deleteToken(@Param('keyId') keyId: string) {
|
||||
// ToDo: Get real userName
|
||||
return this.authService.removeToken('hardcoded', keyId);
|
||||
return this.authService.removeToken(keyId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ describe('AuthService', () => {
|
|||
|
||||
describe('removeToken', () => {
|
||||
it('works', async () => {
|
||||
await service.removeToken(user.userName, authToken.keyId);
|
||||
await service.removeToken(authToken.keyId);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -141,10 +141,9 @@ export class AuthService {
|
|||
return user.authTokens;
|
||||
}
|
||||
|
||||
async removeToken(userName: string, keyId: string) {
|
||||
const user = await this.usersService.getUserByUsername(userName);
|
||||
async removeToken(keyId: string) {
|
||||
const token = await this.authTokenRepository.findOne({
|
||||
where: { keyId: keyId, user: user },
|
||||
where: { keyId: keyId },
|
||||
});
|
||||
await this.authTokenRepository.remove(token);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue