Always show login page and generate URLs with url_for.

Close #1259, #2235.
This commit is contained in:
Arik Fraimovich
2018-02-26 20:40:48 +02:00
parent 3044c77309
commit 35594ecb00
3 changed files with 3 additions and 12 deletions

View File

@@ -111,16 +111,6 @@ def login(org_slug=None):
if current_user.is_authenticated:
return redirect(next_path)
if not current_org.get_setting('auth_password_login_enabled'):
if settings.REMOTE_USER_LOGIN_ENABLED:
return redirect(url_for("remote_user_auth.login", next=next_path))
elif current_org.get_setting('auth_saml_enabled'): # settings.SAML_LOGIN_ENABLED:
return redirect(url_for("saml_auth.sp_initiated", next=next_path))
elif settings.LDAP_LOGIN_ENABLED:
return redirect(url_for("ldap_auth.login", next=next_path))
else:
return redirect(get_google_auth_url(next_path))
if request.method == 'POST':
try:
org = current_org._get_current_object()
@@ -142,6 +132,7 @@ def login(org_slug=None):
email=request.form.get('email', ''),
show_google_openid=settings.GOOGLE_OAUTH_ENABLED,
google_auth_url=google_auth_url,
show_password_login=current_org.get_setting('auth_password_login_enabled'),
show_saml_login=current_org.get_setting('auth_saml_enabled'),
show_remote_user_login=settings.REMOTE_USER_LOGIN_ENABLED,
show_ldap_login=settings.LDAP_LOGIN_ENABLED)

View File

@@ -9,7 +9,6 @@ from redash.permissions import require_admin
@routes.route(org_scoped_rule('/api/organization/status'), methods=['GET'])
@require_admin
@login_required
def organization_status(org_slug=None):
counters = {

View File

@@ -32,6 +32,7 @@
<a href="{{ url_for('ldap_auth.login', next=next) }}" class="login-button btn btn-default btn-block">LDAP/SSO Login</a>
{% endif %}
{% if show_password_login %}
{% if show_google_openid or show_saml_login or show_remote_user_login or show_ldap_login %}
<hr>
{% endif %}
@@ -49,12 +50,12 @@
<button type="submit" class="btn btn-primary btn-block m-t-25">Log In</button>
</form>
{% if not hide_forgot_password %}
<div class="m-t-25">
<a href="{{ url_for("redash.forgot_password", org_slug=org_slug) }}">I forgot my password</a>
</div>
{% endif %}
{% endif %}
</div>
</div>
{% endblock %}