tokens: Add token creation

Fix token deletion
Update plantuml docs
Add token validUntil and lastUsed fields

Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Philip Molares 2021-01-21 19:37:43 +01:00
parent fd70b2d121
commit 599fe57ec6
9 changed files with 113 additions and 35 deletions

View file

@ -7,8 +7,10 @@ export class AuthService {
constructor(private usersService: UsersService) {}
async validateToken(token: string): Promise<User> {
const user = await this.usersService.getUserByAuthToken(token);
const parts = token.split('.');
const user = await this.usersService.getUserByAuthToken(parts[0], parts[1]);
if (user) {
await this.usersService.setLastUsedToken(parts[0])
return user;
}
return null;