aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/redis.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/server/lib/redis.ts b/server/lib/redis.ts
index 5313c4685..a075eee2d 100644
--- a/server/lib/redis.ts
+++ b/server/lib/redis.ts
@@ -84,6 +84,10 @@ class Redis {
84 return generatedString 84 return generatedString
85 } 85 }
86 86
87 async removePasswordVerificationString (userId: number) {
88 return this.removeValue(this.generateResetPasswordKey(userId))
89 }
90
87 async getResetPasswordLink (userId: number) { 91 async getResetPasswordLink (userId: number) {
88 return this.getValue(this.generateResetPasswordKey(userId)) 92 return this.getValue(this.generateResetPasswordKey(userId))
89 } 93 }
@@ -290,6 +294,16 @@ class Redis {
290 }) 294 })
291 } 295 }
292 296
297 private removeValue (key: string) {
298 return new Promise<void>((res, rej) => {
299 this.client.del(this.prefix + key, err => {
300 if (err) return rej(err)
301
302 return res()
303 })
304 })
305 }
306
293 private setObject (key: string, obj: { [id: string]: string }, expirationMilliseconds: number) { 307 private setObject (key: string, obj: { [id: string]: string }, expirationMilliseconds: number) {
294 return new Promise<void>((res, rej) => { 308 return new Promise<void>((res, rej) => {
295 this.client.hmset(this.prefix + key, obj, (err, ok) => { 309 this.client.hmset(this.prefix + key, obj, (err, ok) => {