Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add links to create or recreate password (#1713) #1718

Merged
merged 2 commits into from
Aug 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 50 additions & 51 deletions default/web_tt2/renewpasswd.tt2
Original file line number Diff line number Diff line change
@@ -1,71 +1,70 @@
<!-- renewpasswd.tt2 -->

[% SET SAFE_TO_REVEAL_EMAIL = 1 %]
[% IF account_creation %]
<p>[%|loc%]You requested an account creation on this list server.[%END%]</p>
[% ELSIF login_error == 'wrong_password' %]
[%# Perhaps currently not used. ~%]
<h2>
<i class="fa fa-user"></i>
[%|loc%]Login[%END%]
</h2>
<p>
[%|loc%]Unable to continue: The username / password combination provided was incorrect.[%END%]
</p>
[% SET SAFE_TO_REVEAL_EMAIL = 0 %]
[% ELSIF login_error == 'password_reset' %]
[% ELSIF reason == 'resetpasswd' %]
<h2>
<i class="fa fa-user"></i>
[%|loc%]Login[%END%]
</h2>
<p>
[%|loc%]Too many wrong passwords were submitted for this account. Your account has been blocked in order to protect you against attacks. You must renew your password in order to login.[%END%]
</p>
[% ELSIF login_error == 'missing_password' %]
[%# Perhaps currently not used. ~%]
[% ELSIF reason == 'firstpasswd' %]
<p>
[%|loc%]The password was incorrect. Please try again. Perhaps you have forgotten it?[%END%]
[%|loc%]Please enter your email address to begin the registration process.[%END%]
</p>
[% ELSIF login_error == 'ticket_sent' %]
[% ELSE %]
<p>
[%|loc%]You will receive an email that will allow you to choose your password.[%END%]
[%|loc%]You have forgotten your password. You must renew it.[%END%]
</p>
[% ELSE %]
[% IF reason == 'firstpasswd' %]
<p>
[%|loc%]Please enter your email address to begin the registration process.[%END%]
</p>
[% ELSE %]
<p>
[%|loc%]You have forgotten your password. You must renew it.[%END%]
</p>
[% END %]
[% END %]
[% IF SAFE_TO_REVEAL_EMAIL %]
<form class="bold_label" action="[% path_cgi %]" method="post" autocomplete="on">
<fieldset>
<input type="hidden" name="previous_action" value="[% previous_action %]" />
<input type="hidden" name="previous_list" value="[% previous_list %]" />
<input type="hidden" name="action" value="requestpasswd" />
<input type="hidden" name="reason" value="[% reason %]" />

<div class="row">
<div class="columns">
<label for="email">[%|loc%]Your e-mail address:[%END%] </label>
<input id="email" type="text" name="email" size="20" value="[% email %]" />
</div>
<form class="bold_label" action="[% path_cgi %]" method="post"
autocomplete="on">
<fieldset>
<input type="hidden" name="previous_action"
value="[% previous_action %]" />
<input type="hidden" name="previous_list"
value="[% previous_list %]" />
<input type="hidden" name="action" value="requestpasswd" />
<input type="hidden" name="reason" value="[% reason %]" />

<div class="row">
<div class="columns">
<label for="email">[%|loc%]Your e-mail address:[%END%] </label>
<input id="email" type="text" name="email" size="20"
value="[% email %]" />
</div>
<div class="row">
<div class="columns">
<input class="MainMenuLinks" type="submit" name="action_requestpasswd"
[% IF reason == 'firstpasswd' %]
value="[%|loc%]Request first password[%END%]" />
[% ELSE %]
value="[%|loc%]Request new password[%END%]" />
[% END %]
</div>
</div>
<div class="row">
<div class="columns">
<input class="MainMenuLinks" type="submit"
name="action_requestpasswd"
[% IF reason == 'firstpasswd' ~%]
value="[%|loc%]Request first password[%END%]"
[%~ ELSE ~%]
value="[%|loc%]Request new password[%END%]"
[%~ END %] />
</div>
</fieldset>
</form>
[% END %]
</div>
</fieldset>
</form>

[% UNLESS reason == 'resetpasswd' ~%]
<hr>
<ul>
<li>
[% UNLESS account_creation || reason == 'firstpasswd' ~%]
<a href="[% 'firstpasswd' | url_rel %]">
[%|loc%]First login?[%END%]
</a>
[%~ ELSE ~%]
<a href="[% 'renewpasswd' | url_rel %]">
[%|loc%]Lost password?[%END%]
</a>
[%~ END %]
</li>
</ul>
[%~ END %]
<!-- end renewpasswd.tt2 -->
15 changes: 7 additions & 8 deletions src/cgi/wwsympa.fcgi.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
# Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
# 2006, 2007, 2008, 2009, 2010, 2011 Comite Reseau des Universites
# Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016, 2017 GIP RENATER
# Copyright 2017, 2018, 2019, 2020, 2021, 2022 The Sympa Community. See the
# AUTHORS.md file at the top-level directory of this distribution and at
# <https://github.com/sympa-community/sympa.git>.
# Copyright 2017, 2018, 2019, 2020, 2021, 2022, 2023 The Sympa Community.
# See the AUTHORS.md file at the top-level directory of this distribution
# and at <https://github.com/sympa-community/sympa.git>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -3201,11 +3201,11 @@ sub do_login {
and $u->{'wrong_login_count'}
and $u->{'wrong_login_count'} >
Conf::get_robot_conf($robot, 'max_wrong_password')) {
$param->{'login_error'} = 'password_reset';
$param->{'reason'} = 'resetpasswd';
$param->{'login_error'} = 'password_reset'; # Compat.<=6.2.72
return _do_login_exit($failure_referer || $ldap_auth_info,
'renewpasswd');
} else {
#$param->{'login_error'} = 'wrong_password';
return _do_login_exit($failure_referer, 1);
}

Expand Down Expand Up @@ -4048,7 +4048,7 @@ sub do_requestpasswd {
arg => join(',', $email, $reason),
previous_action => (
$in{'previous_action'}
|| ($reason ? 'firstpasswd' : 'renewpasswd')
|| ($reason eq 'firstpasswd' ? 'firstpasswd' : 'renewpasswd')
)
);
return $next_action unless $next_action eq '1';
Expand Down Expand Up @@ -4104,8 +4104,7 @@ sub do_requestpasswd {
$param->{'login_error'} = 'unable_to_create_ticket';
}

return 1 unless ($param->{'previous_action'});
return $param->{'previous_action'};
return 1;
}

sub do_my {
Expand Down
Loading