From 8220de6ede9d4e4ccc0454005f71af42844d1fdf Mon Sep 17 00:00:00 2001 From: Dan Braghis <dan.braghis@torchbox.com> Date: Thu, 11 Jan 2018 15:44:55 +0000 Subject: [PATCH] Do not allow disconnect for users without passwords --- opentech/apply/users/templates/users/account.html | 2 +- opentech/apply/users/templates/users/oauth.html | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/opentech/apply/users/templates/users/account.html b/opentech/apply/users/templates/users/account.html index 5873285ed..38dc57c67 100644 --- a/opentech/apply/users/templates/users/account.html +++ b/opentech/apply/users/templates/users/account.html @@ -6,7 +6,7 @@ {% block content %} <h2>Welcome {{ user }}</h2> -{% if show_change_password and not backends.associated %} +{% if show_change_password and user.has_usable_password and not backends.associated %} <a href="{% url 'users:password_change' %}">{% trans "Change password" %}</a> {% endif %} diff --git a/opentech/apply/users/templates/users/oauth.html b/opentech/apply/users/templates/users/oauth.html index 312003ddd..c51d40a15 100644 --- a/opentech/apply/users/templates/users/oauth.html +++ b/opentech/apply/users/templates/users/oauth.html @@ -10,7 +10,7 @@ <ul> {% for association in backends.associated %} <li> - {% if user.password %} + {% if user.has_usable_password %} <form id="{{ association.provider|backend_name }}-disconnect" class="disconnect-form col-md-2" action="{% url 'social:disconnect_individual' backend=association.provider association_id=association.id %}?next={% url "users:account" %}" method="post"> <input type="hidden" name="csrfmiddlewaretoken" value="{{ csrf_token }}"> @@ -26,12 +26,12 @@ </ul> {% endif %} {% if backends.not_associated %} - <h3>Available OAuth providers</h3> + <h3>Available providers</h3> <ul> {% for backend in backends.not_associated %} <li> <a id="{{ name }}-button" class="col-md-2 btn btn-default" name="{{ backend }}" href="{% url 'social:begin' backend=backend %}"> - Associate with {{ backend|backend_name }} + {{ backend|backend_name }} </a> </li> {% endfor %} -- GitLab