Don't show the LDAP authentication method in the login page if this feature isn't enabled

This commit is contained in:
Khanh Ngo 2016-04-13 11:33:07 +07:00
parent 53b4fe2f8b
commit 8f8b26266b
2 changed files with 4 additions and 1 deletions

View File

@ -75,7 +75,9 @@
<div class="form-group"> <div class="form-group">
<select class="form-control" name="auth_method"> <select class="form-control" name="auth_method">
<option value="LOCAL">Default Authentication</option> <option value="LOCAL">Default Authentication</option>
{% if ldap_enabled %}
<option value="LDAP">LDAP Authentication</option> <option value="LDAP">LDAP Authentication</option>
{% endif %}
</select> </select>
</div> </div>
<div class="form-actions"> <div class="form-actions">

View File

@ -65,7 +65,8 @@ def login():
return redirect(url_for('dashboard')) return redirect(url_for('dashboard'))
if request.method == 'GET': if request.method == 'GET':
return render_template('login.html') LDAP_ENABLED = True if 'LDAP_TYPE' in app.config.keys() else False
return render_template('login.html', ldap_enabled=LDAP_ENABLED)
# process login # process login
username = request.form['username'] username = request.form['username']