feat: delete all sessions for the user when changing password
This commit is contained in:
parent
02183fc1c3
commit
6477164493
2 changed files with 4 additions and 2 deletions
|
@ -48,7 +48,7 @@ class TipiCache {
|
|||
return client.del(key);
|
||||
}
|
||||
|
||||
public async delByValue(value: string, prefix = '') {
|
||||
public async delByValue(value: string, prefix: string) {
|
||||
const client = await this.getClient();
|
||||
const keys = await client.keys(`${prefix}*`);
|
||||
|
||||
|
|
|
@ -389,7 +389,9 @@ export class AuthServiceClass {
|
|||
}
|
||||
|
||||
const hash = await argon2.hash(newPassword);
|
||||
await this.prisma.user.update({ where: { id: user.id }, data: { password: hash, totp_enabled: false, totp_secret: null } });
|
||||
await this.prisma.user.update({ where: { id: user.id }, data: { password: hash } });
|
||||
|
||||
await TipiCache.delByValue(userId.toString(), 'auth');
|
||||
|
||||
return true;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue