Skip to content

Commit cf73f43

Browse files
committed
api: Use g.gencache for storing otp secret
1 parent e81a93c commit cf73f43

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

install/setup_mcrouter.sh

+1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ if [ ! -f /etc/mcrouter/global.conf ]; then
7171
"reportsr:": "local-pool",
7272
"reportmessage:": "local-pool",
7373
"modinbox:": "local-pool",
74+
"otp:": "local-pool",
7475
},
7576
"wildcard": {
7677
"type": "PoolRoute",

r2/r2/controllers/api.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -4641,7 +4641,7 @@ def POST_generate_otp_secret(self, form, jquery):
46414641
return
46424642

46434643
secret = totp.generate_secret()
4644-
g.cache.set('otp_secret_' + c.user._id36, secret, time=300)
4644+
g.gencache.set("otp:secret_" + c.user._id36, secret, time=300)
46454645
jquery("body").make_totp_qrcode(secret)
46464646

46474647
@validatedForm(VUser(),
@@ -4656,7 +4656,7 @@ def POST_enable_otp(self, form, jquery, otp):
46564656
form.has_errors("otp", errors.OTP_ALREADY_ENABLED)
46574657
return
46584658

4659-
secret = g.cache.get("otp_secret_" + c.user._id36)
4659+
secret = g.gencache.get("otp:secret_" + c.user._id36)
46604660
if not secret:
46614661
c.errors.add(errors.EXPIRED, field="otp")
46624662
form.has_errors("otp", errors.EXPIRED)

0 commit comments

Comments
 (0)