mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 19:42:24 +02:00
Do not reuse reset password links
This commit is contained in:
parent
857961f0ee
commit
e9c5f12338
3 changed files with 19 additions and 0 deletions
|
@ -84,6 +84,10 @@ class Redis {
|
|||
return generatedString
|
||||
}
|
||||
|
||||
async removePasswordVerificationString (userId: number) {
|
||||
return this.removeValue(this.generateResetPasswordKey(userId))
|
||||
}
|
||||
|
||||
async getResetPasswordLink (userId: number) {
|
||||
return this.getValue(this.generateResetPasswordKey(userId))
|
||||
}
|
||||
|
@ -290,6 +294,16 @@ class Redis {
|
|||
})
|
||||
}
|
||||
|
||||
private removeValue (key: string) {
|
||||
return new Promise<void>((res, rej) => {
|
||||
this.client.del(this.prefix + key, err => {
|
||||
if (err) return rej(err)
|
||||
|
||||
return res()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
private setObject (key: string, obj: { [id: string]: string }, expirationMilliseconds: number) {
|
||||
return new Promise<void>((res, rej) => {
|
||||
this.client.hmset(this.prefix + key, obj, (err, ok) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue