Skip to content

Commit

Permalink
accounts: password forgotten emails
Browse files Browse the repository at this point in the history
* Updates password forgotten emails.
* Closes #343.

Co-Authored-by: Sébastien Délèze <sebastien.deleze@rero.ch>
  • Loading branch information
Sébastien Délèze committed Aug 17, 2021
1 parent e095fe1 commit 9b8338b
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 14 deletions.
2 changes: 2 additions & 0 deletions sonar/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ def _(x):
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'
SECURITY_EMAIL_SUBJECT_PASSWORD_RESET = _('SONAR password reset')
SECURITY_EMAIL_SUBJECT_PASSWORD_NOTICE = _('Your SONAR password has been reset')

RECORDS_UI_ENDPOINTS = {
'doc': {
Expand Down
37 changes: 25 additions & 12 deletions sonar/templates/security/email/reset_instructions.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
{# -*- coding: utf-8 -*-
Swiss Open Access Repository
Copyright (C) 2021 RERO
Swiss Open Access Repository
Copyright (C) 2021 RERO

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, version 3 of the License.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, version 3 of the License.

This program 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. See the
GNU Affero General Public License for more details.
This program 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. See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see
<http: //www.gnu.org/licenses />.
#}

<p><a href="{{ reset_link.replace('/api', '') }}">{{ _('Click here to reset your password') }}</a></p>
{%- if user.profile.first_name and user.profile.last_name %}
<p>{{ _('Dear') }} {{ user.profile.first_name }} {{ user.profile.last_name }},</p>
{%- else %}
<p>{{ _('Dear user') }},</p>
{%- endif %}
<p>{{ _('Someone requested that the password for your SONAR account be reset.') }}</p>
<p>
<a href="{{ reset_link.replace('/api', '') }}">{{ _('Reset my password') }}</a>
</p>
<p>{{ _('If you didn\'t request this, you can ignore this e-mail. Your password won\'t change until you create a new
password.') }}</p>
<p>{{ _('Best regards') }}</p>
<p>{{ _('Your institution') }}</p>
17 changes: 15 additions & 2 deletions sonar/templates/security/email/reset_instructions.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
{{ _('Click the link below to reset your password:') }}
{%- if user.profile.first_name and user.profile.last_name -%}
{{ _('Dear') }} {{ user.profile.first_name }} {{ user.profile.last_name }},
{%- else %}
{{ _('Dear user') }},
{%- endif %}

{{ reset_link.replace('/api', '') }}
{{ _('Someone requested that the password for your SONAR account be reset.') }}

{{ _('Reset my password') }}: {{ reset_link.replace('/api', '') }}

{{ _('If you didn\'t request this, you can ignore this e-mail. Your password won\'t change until you create a new
password.') }}

{{ _('Best regards') }}

{{ _('Your institution') }}
26 changes: 26 additions & 0 deletions sonar/templates/security/email/reset_notice.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{# -*- coding: utf-8 -*-
Swiss Open Access Repository
Copyright (C) 2021 RERO

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, version 3 of the License.

This program 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. See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program. If not, see
<http: //www.gnu.org/licenses />.
#}

{%- if user.profile.first_name and user.profile.last_name %}
<p>{{ _('Dear') }} {{ user.profile.first_name }} {{ user.profile.last_name }},</p>
{%- else %}
<p>{{ _('Dear user') }},</p>
{%- endif %}
<p>{{ _('Your password has been successfully reset.') }}</p>
<p>{{ _('Best regards') }}</p>
<p>{{ _('Your institution') }}</p>
11 changes: 11 additions & 0 deletions sonar/templates/security/email/reset_notice.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{%- if user.profile.first_name and user.profile.last_name %}
{{ _('Dear') }} {{ user.profile.first_name }} {{ user.profile.last_name }},
{%- else %}
{{ _('Dear user') }},
{%- endif %}

{{ _('Your password has been successfully reset.') }}

{{ _('Best regards') }}

{{ _('Your institution') }}

0 comments on commit 9b8338b

Please sign in to comment.