Skip to content
Snippets Groups Projects
Commit 8220de6e authored by Dan Braghis's avatar Dan Braghis
Browse files

Do not allow disconnect for users without passwords

parent 761bf801
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
{% block content %} {% block content %}
<h2>Welcome {{ user }}</h2> <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> <a href="{% url 'users:password_change' %}">{% trans "Change password" %}</a>
{% endif %} {% endif %}
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<ul> <ul>
{% for association in backends.associated %} {% for association in backends.associated %}
<li> <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" %}" <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"> method="post">
<input type="hidden" name="csrfmiddlewaretoken" value="{{ csrf_token }}"> <input type="hidden" name="csrfmiddlewaretoken" value="{{ csrf_token }}">
...@@ -26,12 +26,12 @@ ...@@ -26,12 +26,12 @@
</ul> </ul>
{% endif %} {% endif %}
{% if backends.not_associated %} {% if backends.not_associated %}
<h3>Available OAuth providers</h3> <h3>Available providers</h3>
<ul> <ul>
{% for backend in backends.not_associated %} {% for backend in backends.not_associated %}
<li> <li>
<a id="{{ name }}-button" class="col-md-2 btn btn-default" name="{{ backend }}" href="{% url 'social:begin' backend=backend %}"> <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> </a>
</li> </li>
{% endfor %} {% endfor %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment