[Update] 增加手动结束非正常关闭的连接

This commit is contained in:
ibuler
2018-09-07 12:40:26 +08:00
parent 9ffae722f3
commit 88a29c0a93
17 changed files with 169 additions and 48 deletions

View File

@@ -263,7 +263,7 @@ def generate_otp_uri(request, issuer="Jumpserver"):
otp_secret_key = base64.b32encode(os.urandom(10)).decode('utf-8')
cache.set(request.session.session_key+'otp_key', otp_secret_key, 600)
totp = pyotp.TOTP(otp_secret_key)
return totp.provisioning_uri(name=user.username, issuer_name=issuer)
return totp.provisioning_uri(name=user.username, issuer_name=issuer), otp_secret_key
def check_otp_code(otp_secret_key, otp_code):