Commit 8375f81b authored by André Anjos's avatar André Anjos 💬

Merge branch '508_password_reset' into 'master'

Implement password reset

Closes #508

See merge request !281
parents ee45f7d3 58f13628
Pipeline #28269 passed with stages
in 16 minutes and 46 seconds
...@@ -2,21 +2,21 @@ ...@@ -2,21 +2,21 @@
{% comment %} {% comment %}
* Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/ * Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/
* Contact: beat.support@idiap.ch * Contact: beat.support@idiap.ch
* *
* This file is part of the beat.web module of the BEAT platform. * This file is part of the beat.web module of the BEAT platform.
* *
* Commercial License Usage * Commercial License Usage
* Licensees holding valid commercial BEAT licenses may use this file in * Licensees holding valid commercial BEAT licenses may use this file in
* accordance with the terms contained in a written agreement between you * accordance with the terms contained in a written agreement between you
* and Idiap. For further information contact tto@idiap.ch * and Idiap. For further information contact tto@idiap.ch
* *
* Alternatively, this file may be used under the terms of the GNU Affero * Alternatively, this file may be used under the terms of the GNU Affero
* Public License version 3 as published by the Free Software and appearing * Public License version 3 as published by the Free Software and appearing
* in the file LICENSE.AGPL included in the packaging of this file. * in the file LICENSE.AGPL included in the packaging of this file.
* The BEAT platform is distributed in the hope that it will be useful, but * The BEAT platform is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. * or FITNESS FOR A PARTICULAR PURPOSE.
* *
* You should have received a copy of the GNU Affero Public License along * You should have received a copy of the GNU Affero Public License along
* with the BEAT platform. If not, see http://www.gnu.org/licenses/. * with the BEAT platform. If not, see http://www.gnu.org/licenses/.
{% endcomment %} {% endcomment %}
...@@ -65,6 +65,8 @@ ...@@ -65,6 +65,8 @@
<p class="comment">In order to sign in, you must be <a href="{% url 'registration' %}">registered</a></p> <p class="comment">In order to sign in, you must be <a href="{% url 'registration' %}">registered</a></p>
<p class="comment">Inactive/Blocked user need to get their account reactivated <a href="{% url 'blocked_user_reactivation' %}">reactivation</a></p> <p class="comment">Inactive/Blocked user need to get their account reactivated <a href="{% url 'blocked_user_reactivation' %}">reactivation</a></p>
<p class="comment">Forgot your password ? <a href="{% url 'password_reset' %}">Reset password</a></p>
</div> </div>
</div> </div>
......
{% extends "base.html" %}
{% comment %}
* Copyright (c) 2019 Idiap Research Institute, http://www.idiap.ch/
* Contact: beat.support@idiap.ch
*
* This file is part of the beat.web module of the BEAT platform.
*
* Commercial License Usage
* Licensees holding valid commercial BEAT licenses may use this file in
* accordance with the terms contained in a written agreement between you
* and Idiap. For further information contact tto@idiap.ch
*
* Alternatively, this file may be used under the terms of the GNU Affero
* Public License version 3 as published by the Free Software and appearing
* in the file LICENSE.AGPL included in the packaging of this file.
* The BEAT platform is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero Public License along
* with the BEAT platform. If not, see http://www.gnu.org/licenses/.
{% endcomment %}
{% load i18n static %}
{% load registration_tags %}
{% block content %}
<div class="row">
<div class="col-sm-4 col-sm-offset-4">
<div class="panel panel-default login-panel">
<div class="panel-heading">Password reset</div>
<div class="panel-body">
<p>{% trans "Your password has been set. You may go ahead and log in now." %}</p>
<p><a href="{{ login_url }}">{% trans 'Log in' %}</a></p>
</div>
</div>
</div>
</div>
{% endblock content %}
{% extends "base.html" %}
{% comment %}
* Copyright (c) 2019 Idiap Research Institute, http://www.idiap.ch/
* Contact: beat.support@idiap.ch
*
* This file is part of the beat.web module of the BEAT platform.
*
* Commercial License Usage
* Licensees holding valid commercial BEAT licenses may use this file in
* accordance with the terms contained in a written agreement between you
* and Idiap. For further information contact tto@idiap.ch
*
* Alternatively, this file may be used under the terms of the GNU Affero
* Public License version 3 as published by the Free Software and appearing
* in the file LICENSE.AGPL included in the packaging of this file.
* The BEAT platform is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero Public License along
* with the BEAT platform. If not, see http://www.gnu.org/licenses/.
{% endcomment %}
{% load i18n static %}
{% load registration_tags %}
{% block content %}
<div class="row">
<div class="col-sm-4 col-sm-offset-4">
<div class="panel panel-default login-panel">
<div class="panel-heading">Password reset</div>
<div class="panel-body">
{% if validlink %}
<p>{% trans "Please enter your new password twice so we can verify you typed it in correctly." %}</p>
<form method="post" class="form">
{% csrf_token %}
<div class="form-group field-password1">
<label for="id_new_password1">{% trans 'New password:' %}</label>
{{ form.new_password1|tabindex:1|addclass:"form-control" }}
{{ form.new_password1.errors }}
</div>
<div class="form-group field-password2">
<label for="id_new_password2">{% trans 'Confirm password:' %}</label>
{{ form.new_password2|tabindex:1|addclass:"form-control" }}
{{ form.new_password2.errors }}
</div>
<div class="form-group">
<button type="submit" class="btn btn-success" tabindex="3"><i class="fa fa-sign-in fa-fw fa-lg"></i> {% trans 'Change my password' %}</button>
</div>
</form>
{% else %}
<p>{% trans "The password reset link was invalid, possibly because it has already been used. Please request a new password reset." %}</p>
{% endif %}
</div>
</div>
</div>
</div>
{% endblock content %}
{% extends "base.html" %}
{% comment %}
* Copyright (c) 2019 Idiap Research Institute, http://www.idiap.ch/
* Contact: beat.support@idiap.ch
*
* This file is part of the beat.web module of the BEAT platform.
*
* Commercial License Usage
* Licensees holding valid commercial BEAT licenses may use this file in
* accordance with the terms contained in a written agreement between you
* and Idiap. For further information contact tto@idiap.ch
*
* Alternatively, this file may be used under the terms of the GNU Affero
* Public License version 3 as published by the Free Software and appearing
* in the file LICENSE.AGPL included in the packaging of this file.
* The BEAT platform is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero Public License along
* with the BEAT platform. If not, see http://www.gnu.org/licenses/.
{% endcomment %}
{% load i18n static %}
{% load registration_tags %}
{% block content %}
<div class="row">
<div class="col-sm-4 col-sm-offset-4">
<div class="panel panel-default login-panel">
<div class="panel-heading">Password reset</div>
<div class="panel-body">
<p>{% trans "We've emailed you instructions for setting your password, if an account exists with the email you entered. You should receive them shortly." %}</p>
<p>{% trans "If you don't receive an email, please make sure you've entered the address you registered with, and check your spam folder." %}</p>
</div>
</div>
</div>
</div>
{% endblock content %}
{% extends "base.html" %}
{% comment %}
* Copyright (c) 2019 Idiap Research Institute, http://www.idiap.ch/
* Contact: beat.support@idiap.ch
*
* This file is part of the beat.web module of the BEAT platform.
*
* Commercial License Usage
* Licensees holding valid commercial BEAT licenses may use this file in
* accordance with the terms contained in a written agreement between you
* and Idiap. For further information contact tto@idiap.ch
*
* Alternatively, this file may be used under the terms of the GNU Affero
* Public License version 3 as published by the Free Software and appearing
* in the file LICENSE.AGPL included in the packaging of this file.
* The BEAT platform is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero Public License along
* with the BEAT platform. If not, see http://www.gnu.org/licenses/.
{% endcomment %}
{% load i18n static %}
{% load registration_tags %}
{% block content %}
<div class="row">
<div class="col-sm-4 col-sm-offset-4">
<div class="panel panel-default login-panel">
<div class="panel-heading">Password reset</div>
<div class="panel-body">
<form method="post" action="" class="form">
{% csrf_token %}
{% csrf_token %}
{{ form.as_p }}
<button type="submit" class="btn btn-success" tabindex="3"><i class="fa fa-sign-in fa-fw fa-lg"></i> Send me instructions !</button>
</form>
</div>
</div>
</div>
</div>
{% endblock content %}
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
from django.conf.urls import url from django.conf.urls import url
from django.conf import settings from django.conf import settings
from django.views.generic.base import TemplateView from django.views.generic.base import TemplateView
from django.contrib.auth.views import logout from django.contrib.auth import views as auth_views
from . import views from . import views
...@@ -37,76 +37,87 @@ from .registration.views import register ...@@ -37,76 +37,87 @@ from .registration.views import register
from .registration.forms import PreregistrationForm from .registration.forms import PreregistrationForm
urlpatterns = [ urlpatterns = [
url(r"^$", views.index, name="index"),
url(r'^$', url(r"^login/$", views.login, name="login"),
views.index, url(
name='index', r"^blocked_user_reactivation/$",
),
url(r'^login/$',
views.login,
name='login',
),
url(r'^blocked_user_reactivation/$',
views.blocked_user_reactivation, views.blocked_user_reactivation,
name='blocked_user_reactivation', name="blocked_user_reactivation",
),
url(r'^events/(?P<author_name>\w+)/$',
views.activity_stream,
name='activity-stream',
), ),
url(
url(r'^logout/$', r"^events/(?P<author_name>\w+)/$", views.activity_stream, name="activity-stream"
logout, ),
{'next_page': 'index'}, url(r"^logout/$", auth_views.logout, {"next_page": "index"}, name="logout"),
name='logout', url(r"^docreq/(?P<author_name>\w+)/$", views.docreq, name="docreq"),
),
url(r'^docreq/(?P<author_name>\w+)/$',
views.docreq,
name='docreq',
),
# Activation keys get matched by \w+ instead of the more specific # Activation keys get matched by \w+ instead of the more specific
# [a-fA-F0-9]{40} because a bad activation key should still get to the # [a-fA-F0-9]{40} because a bad activation key should still get to the
# view; that way it can return a sensible "invalid key" message instead # view; that way it can return a sensible "invalid key" message instead
# of a confusing 404. # of a confusing 404.
url(r'^signup/$', register, url(
dict(success_url='registration-complete'), r"^signup/$",
name='registration', register,
), dict(success_url="registration-complete"),
name="registration",
url(r'^signup/complete/$', ),
url(
r"^signup/complete/$",
TemplateView.as_view( TemplateView.as_view(
template_name=('registration/registration_pending.html' if \ template_name=(
settings.PREREGISTRATION_ONLY else \ "registration/registration_pending.html"
'registration/registration_complete.html') if settings.PREREGISTRATION_ONLY
), else "registration/registration_complete.html"
name='registration-complete', )
), ),
name="registration-complete",
url(r'^signup/activate/(?P<activation_key>\w+)/$', ),
url(
r"^signup/activate/(?P<activation_key>\w+)/$",
activate, activate,
name='registration-activation', name="registration-activation",
), ),
url(
url(r'^preregister/$', r"^preregister/$",
register, register,
dict( dict(
success_url='pre-registration-complete', success_url="pre-registration-complete",
form_class= PreregistrationForm, form_class=PreregistrationForm,
template_name='registration/preregistration_form.html', template_name="registration/preregistration_form.html",
), ),
name='pre-registration' name="pre-registration",
), ),
url(
url(r'^preregistration/complete/$', r"^preregistration/complete/$",
TemplateView.as_view( TemplateView.as_view(
template_name='registration/preregistration_complete.html', template_name="registration/preregistration_complete.html"
), ),
name='pre-registration-complete', name="pre-registration-complete",
),
url(
r"^password_reset/$",
auth_views.PasswordResetView.as_view(
template_name="registration/password-reset-form.html"
), ),
name="password_reset",
),
url(
r"^password_reset/done/$",
auth_views.PasswordResetDoneView.as_view(
template_name="registration/password-reset-done.html"
),
name="password_reset_done",
),
url(
r"^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$",
auth_views.PasswordResetConfirmView.as_view(
template_name="registration/password-reset-confirm.html"
),
name="password_reset_confirm",
),
url(
r"^reset/done/$",
auth_views.PasswordResetCompleteView.as_view(
template_name="registration/password-reset-complete.html"
),
name="password_reset_complete",
),
] ]
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment