Skip to content

Commit

Permalink
account: password forgotten template
Browse files Browse the repository at this point in the history
* Modifies the template for resetting password.
* Closes #102.

Co-Authored-by: Sébastien Délèze <sebastien.deleze@rero.ch>
  • Loading branch information
Sébastien Délèze committed Jan 28, 2020
1 parent aa90dd5 commit 89da967
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions sonar/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ def _(x):

SECURITY_LOGIN_USER_TEMPLATE = 'sonar/accounts/login.html'
SECURITY_FORGOT_PASSWORD_TEMPLATE = 'sonar/accounts/forgot_password.html'
SECURITY_RESET_PASSWORD_TEMPLATE = 'sonar/accounts/reset_password.html'
SECURITY_REGISTER_USER_TEMPLATE = 'sonar/accounts/signup.html'

RECORDS_UI_ENDPOINTS = {
Expand Down
45 changes: 45 additions & 0 deletions sonar/theme/templates/sonar/accounts/reset_password.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{# -*- coding: utf-8 -*-

This file is part of Invenio.
Copyright (C) 2015-2018 CERN.

Invenio is free software; you can redistribute it and/or modify it
under the terms of the MIT License; see LICENSE file for more details.
#}

{%- extends config.ACCOUNTS_COVER_TEMPLATE %}

{% from "invenio_accounts/_macros.html" import render_field, form_errors %}
{%- set messages = get_flashed_messages(with_categories=true) -%}

{% block panel %}
{%- with form = reset_password_form %}
<div class="col-lg-6">
<div class="card card-light text-dark">
<div class="card-body p-3 p-lg-5">
<h4 class="text-center mb-4">{{_('Reset Password')}}</h3>
{%- if messages %}
{%- for category, message in messages %}
<p>{{ message }}</p>
{%- endfor %}
{%- else %}
<form action="{{ url_for_security('reset_password', token=reset_password_token) }}" method="POST" name="reset_password_form">
{{ form.hidden_tag() }}
{{ render_field(reset_password_form.password, autofocus=True) }}
{{ render_field(reset_password_form.password_confirm) }}
<button type="submit" class="btn btn-secondary btn-lg btn-block text-light">{{_('Reset Password')}}</button>
</form>
{%- endif %}
</div>
</div>
{%- if current_user.is_anonymous %}
<div class="mt-2 text-right">
<a href="{{url_for('security.login')}}" class="text-light mr-3">{{_('Log In')}}</a>
{%- if security.registerable %}
<a href="{{url_for('security.register')}}" class="text-light">{{_('Sign Up')}}</a>
{% endif %}
</div>
{% endif %}
</div>
{%- endwith %}
{% endblock panel %}

0 comments on commit 89da967

Please sign in to comment.