Fix accounts_home and login to display no-password correctly.

This fixes the /register/ (accounts_home) and /login/ pages to not
display the login form if login isn’t allowed at the organization level.
This commit is contained in:
Brock Whittaker
2017-05-11 17:24:28 -07:00
committed by Tim Abbott
parent c7f710b8d4
commit 07ecf971c6
2 changed files with 44 additions and 41 deletions

View File

@@ -44,49 +44,51 @@ $(function () {
configure authentication backends.</p> configure authentication backends.</p>
</div> </div>
{% else %} {% else %}
<form class="form-inline" id="send_confirm" name="email_form" {% if password_auth_enabled %}
action="{{ current_url() }}" method="post"> <form class="form-inline" id="send_confirm" name="email_form"
{{ csrf_input }} action="{{ current_url() }}" method="post">
{{ csrf_input }}
<div class="input-box no-validate"> <div class="input-box no-validate">
<input type="email" id="email" class="email" name="email" value="" required /> <input type="email" id="email" class="email" name="email" value="" required />
<label>Email</label> <label>Email</label>
<div class="required"></div> <div class="required"></div>
<img class="valid" src="/static/images/checkbox-valid.svg" /> <img class="valid" src="/static/images/checkbox-valid.svg" />
</div>
<button class="full-width" type="submit" name="">{{ _('Sign up') }}</button>
</form>
<div id="errors"></div>
{% if form.email.errors %}
{% for error in form.email.errors %}
<div class="alert alert-error">{{ error }}</div>
{% endfor %}
{% endif %}
{% if any_oauth_backend_enabled %}
<div class="or">or</div>
{% endif %}
{% endif %}
{% if google_auth_enabled %}
<div class="register-google">
<a href="{{ url('zerver.views.auth.start_google_oauth2') }}">
<button class="login-google-button full-width">{{ _('Sign up with Google') }}</button>
</a>
</div> </div>
{% endif %}
<button class="full-width" type="submit" name="">{{ _('Sign up') }}</button> {% if github_auth_enabled %}
</form> <div class="login-github">
<a href="{{ url('signup-social', args=('github',)) }}"
<div id="errors"></div> class="github-wrapper">
{% if form.email.errors %} <button class="login-github-button github">
{% for error in form.email.errors %} <span>{{ _('Sign up with GitHub') }}</span>
<div class="alert alert-error">{{ error }}</div> </button>
{% endfor %} </a>
{% endif %} </div>
{% endif %}
{% if any_oauth_backend_enabled %}
<div class="or">or</div>
{% endif %}
{% if google_auth_enabled %}
<div class="register-google">
<a href="{{ url('zerver.views.auth.start_google_oauth2') }}">
<button class="login-google-button full-width">{{ _('Sign up with Google') }}</button>
</a>
</div>
{% endif %}
{% if github_auth_enabled %}
<div class="login-github">
<a href="{{ url('signup-social', args=('github',)) }}"
class="github-wrapper">
<button class="login-github-button github">
<span>{{ _('Sign up with GitHub') }}</span>
</button>
</a>
</div>
{% endif %}
{% endif %} {% endif %}
</div> </div>
</div> </div>

View File

@@ -129,12 +129,13 @@ autofocus('#id_username');
<button type="submit" name="button" class="full-width">{{ _("Sign in") }}</button> <button type="submit" name="button" class="full-width">{{ _("Sign in") }}</button>
</form> </form>
{% endif %}
{% if any_oauth_backend_enabled %} {% if any_oauth_backend_enabled %}
<div class="or">or</div> <div class="or">or</div>
{% endif %} {% endif %}
{% endif %} <!-- if password_auth_enabled -->
{% if google_auth_enabled %} {% if google_auth_enabled %}
<div class="login-google"> <div class="login-google">
<a href="{{ url('zerver.views.auth.start_google_oauth2') }}"> <a href="{{ url('zerver.views.auth.start_google_oauth2') }}">