Skip to content

Commit

Permalink
Fix accounts_home and login to display no-password correctly.
Browse files Browse the repository at this point in the history
This fixes the /register/ (accounts_home) and /login/ pages to not
display the login form if login isn’t allowed at the organization level.
  • Loading branch information
Brock Whittaker authored and timabbott committed May 15, 2017
1 parent c7f710b commit 07ecf97
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 38 deletions.
76 changes: 39 additions & 37 deletions templates/zerver/accounts_home.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,49 +44,51 @@ <h1 class="get-started">{{ _("Sign up for Zulip") }}</h1>
configure authentication backends.</p>
</div>
{% else %}
<form class="form-inline" id="send_confirm" name="email_form"
action="{{ current_url() }}" method="post">
{{ csrf_input }}
{% if password_auth_enabled %}
<form class="form-inline" id="send_confirm" name="email_form"
action="{{ current_url() }}" method="post">
{{ csrf_input }}

<div class="input-box no-validate">
<input type="email" id="email" class="email" name="email" value="" required />
<label>Email</label>
<div class="required"></div>
<img class="valid" src="/static/images/checkbox-valid.svg" />
</div>
<div class="input-box no-validate">
<input type="email" id="email" class="email" name="email" value="" required />
<label>Email</label>
<div class="required"></div>
<img class="valid" src="/static/images/checkbox-valid.svg" />
</div>

<button class="full-width" type="submit" name="">{{ _('Sign up') }}</button>
</form>
<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 %}
<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 %}
{% 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>
{% 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 %}
{% 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 %}
</div>
</div>
Expand Down
3 changes: 2 additions & 1 deletion templates/zerver/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,13 @@ <h1 class="get-started">{{ _("Sign in to Zulip") }}</h1>

<button type="submit" name="button" class="full-width">{{ _("Sign in") }}</button>
</form>
{% endif %}

{% if any_oauth_backend_enabled %}
<div class="or">or</div>
{% endif %}

{% endif %} <!-- if password_auth_enabled -->

{% if google_auth_enabled %}
<div class="login-google">
<a href="{{ url('zerver.views.auth.start_google_oauth2') }}">
Expand Down

0 comments on commit 07ecf97

Please sign in to comment.