Support only having one auth method enabled (which isn't ldap/local)

This commit is contained in:
Marcus Knight
2020-04-16 15:46:27 +08:00
parent 452c4a02d8
commit 0e093d4eec
3 changed files with 148 additions and 84 deletions

View File

@ -321,6 +321,12 @@ def login():
'authentication_type'] = 'LDAP' if auth_method != 'LOCAL' else 'LOCAL'
remember_me = True if 'remember' in request.form else False
if auth_method == 'LOCAL' and not Setting().get('local_db_enabled'):
return render_template(
'login.html',
saml_enabled=SAML_ENABLED,
error='Local authentication is disabled')
user = User(username=username,
password=password,
plain_text_password=password)