mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2025-04-04 00:17:06 +00:00
Rename a function
This commit is contained in:
parent
18d9cd99ea
commit
75fb6d2a5d
@ -30,11 +30,12 @@ def strip_order_prefix(rec, attributes):
|
||||
newvals = []
|
||||
for val in rec[attr]:
|
||||
i = val.find('}')
|
||||
if i>=0: newvals.append(val[i+1:])
|
||||
newvals.append(val[i+1:])
|
||||
rec[attr] = newvals
|
||||
|
||||
def get_mfa_user(email, env, conn=None):
|
||||
'''get the ldap record for the user
|
||||
'''get the ldap record for the user along with all MFA-related
|
||||
attributes
|
||||
|
||||
'''
|
||||
user = find_mail_user(env, email, ['objectClass','totpSecret','totpMruToken','totpLabel'], conn)
|
||||
@ -103,7 +104,7 @@ def validate_auth_mfa(email, request, env):
|
||||
for mfa_mode in mfa_state:
|
||||
if mfa_mode["type"] == "totp":
|
||||
user = get_mfa_user(email, env)
|
||||
result, hint = mfa_totp.validate(user, mfa_mode, request, True, env)
|
||||
result, hint = mfa_totp.validate_auth(user, mfa_mode, request, True, env)
|
||||
if not result:
|
||||
hints.add(hint)
|
||||
else:
|
||||
|
@ -74,7 +74,7 @@ def set_mru_token(user, id, token, env):
|
||||
|
||||
# store the token
|
||||
mods = { "totpMruToken": user['totpMruToken'].copy() }
|
||||
mods['totpMruToken'][idx] = token
|
||||
mods['totpMruToken'][idx] = token
|
||||
conn = open_database(env)
|
||||
conn.modify_record(user, mods)
|
||||
|
||||
@ -93,7 +93,7 @@ def disable(user, id, env):
|
||||
open_database(env).modify_record(user, mods)
|
||||
|
||||
else:
|
||||
# Disable totp at index specified
|
||||
# Disable totp at the index specified
|
||||
idx = totp_index_from_id(user, id)
|
||||
if idx<0 or idx>=len(user['totpSecret']):
|
||||
raise ValueError('MFA/totp mru index is out of range')
|
||||
@ -141,7 +141,7 @@ def provision(email, env):
|
||||
}
|
||||
|
||||
|
||||
def validate(user, state, request, save_mru, env):
|
||||
def validate_auth(user, state, request, save_mru, env):
|
||||
# Check that a token is present in the X-Auth-Token header.
|
||||
# If not, give a hint that one can be supplied.
|
||||
token = request.headers.get('x-auth-token')
|
||||
|
Loading…
Reference in New Issue
Block a user