diff --git a/apps/jumpserver/settings.py b/apps/jumpserver/settings.py index 963fd60a7..f1d1f8e8f 100644 --- a/apps/jumpserver/settings.py +++ b/apps/jumpserver/settings.py @@ -354,6 +354,9 @@ AUTH_USER_MODEL = 'users.User' FILE_UPLOAD_PERMISSIONS = 0o644 FILE_UPLOAD_DIRECTORY_PERMISSIONS = 0o755 +# OTP settings +OTP_ISSUER_NAME = CONFIG.OTP_ISSUER_NAME + # Auth LDAP settings AUTH_LDAP = False AUTH_LDAP_SERVER_URI = 'ldap://localhost:389' diff --git a/apps/users/utils.py b/apps/users/utils.py index 39ef7c34f..eac1c6f99 100644 --- a/apps/users/utils.py +++ b/apps/users/utils.py @@ -284,7 +284,8 @@ 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), otp_secret_key + otp_issuer_name = settings.OTP_ISSUER_NAME or issuer + return totp.provisioning_uri(name=user.username, issuer_name=otp_issuer_name), otp_secret_key def check_otp_code(otp_secret_key, otp_code):