Rename internal validate_two_factor_secret => validate_two_factor_secret

This commit is contained in:
Felix Spöttel 2020-09-03 19:48:54 +02:00
parent 7c4eb0fb70
commit 08ae3d2b7f

View file

@ -564,7 +564,7 @@ def get_mfa_state(email, env):
} }
def create_totp_credential(email, secret, token, env): def create_totp_credential(email, secret, token, env):
validate_two_factor_secret(secret) validate_totp_secret(secret)
conn, c = open_database(env, with_connection=True) conn, c = open_database(env, with_connection=True)
c.execute('INSERT INTO totp_credentials (user_email, secret, mru_token) VALUES (?, ?, ?)', (email, secret, token)) c.execute('INSERT INTO totp_credentials (user_email, secret, mru_token) VALUES (?, ?, ?)', (email, secret, token))
@ -647,7 +647,7 @@ def validate_password(pw):
if len(pw) < 8: if len(pw) < 8:
raise ValueError("Passwords must be at least eight characters.") raise ValueError("Passwords must be at least eight characters.")
def validate_two_factor_secret(secret): def validate_totp_secret(secret):
if type(secret) != str or secret.strip() == "": if type(secret) != str or secret.strip() == "":
raise ValueError("No secret provided.") raise ValueError("No secret provided.")
if len(secret) != 32: if len(secret) != 32: