Skip to content

Commit

Permalink
Merge pull request #1718 from ikedas/issue-1713 by ikedas
Browse files Browse the repository at this point in the history
Add links to create or recreate password (#1713)
  • Loading branch information
ikedas committed Aug 25, 2024
2 parents 8d7164b + c2234b9 commit 7c708e3
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 56 deletions.
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 -->
9 changes: 4 additions & 5 deletions src/cgi/wwsympa.fcgi.in
Original file line number Diff line number Diff line change
Expand Up @@ -3034,11 +3034,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 @@ -3881,7 +3881,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 @@ -3937,8 +3937,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

0 comments on commit 7c708e3

Please sign in to comment.