Skip to content

Commit

Permalink
Improve feedback for the password page
Browse files Browse the repository at this point in the history
If you have no password set, the password page will tell you as much
(instead of saying that it doesn't match).
  • Loading branch information
kensanata committed Apr 24, 2015
1 parent 64aa833 commit e85f3e0
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions wiki.pl
Expand Up @@ -3093,27 +3093,31 @@ sub DoPassword {
my $id = shift; my $id = shift;
print GetHeader('', T('Password')), $q->start_div({-class=>'content password'}); print GetHeader('', T('Password')), $q->start_div({-class=>'content password'});
print $q->p(T('Your password is saved in a cookie, if you have cookies enabled. Cookies may get lost if you connect from another machine, from another account, or using another software.')); print $q->p(T('Your password is saved in a cookie, if you have cookies enabled. Cookies may get lost if you connect from another machine, from another account, or using another software.'));
if (UserIsAdmin()) { if (not $AdminPass and not $EditPass) {
print $q->p(T('You are currently an administrator on this site.')); print $q->p(T('This site does not use admin or editor passwords.'));
} elsif (UserIsEditor()) {
print $q->p(T('You are currently an editor on this site.'));
} else { } else {
print $q->p(T('You are a normal user on this site.')); if (UserIsAdmin()) {
if ($AdminPass or $EditPass) { print $q->p(T('You are currently an administrator on this site.'));
print $q->p(T('Your password does not match any of the administrator or editor passwords.')); } elsif (UserIsEditor()) {
print $q->p(T('You are currently an editor on this site.'));
} else {
print $q->p(T('You are a normal user on this site.'));
if (not GetParam('pwd')) {
print $q->p(T('You do not have a password set.'));
} else {
print $q->p(T('Your password does not match any of the administrator or editor passwords.'));
}
} }
}
if ($AdminPass or $EditPass) {
print GetFormStart(undef, undef, 'password'), print GetFormStart(undef, undef, 'password'),
$q->p(GetHiddenValue('action', 'password'), T('Password:'), ' ', $q->p(GetHiddenValue('action', 'password'), T('Password:'), ' ',
$q->password_field(-name=>'pwd', -size=>20, -maxlength=>50), $q->password_field(-name=>'pwd', -size=>20, -maxlength=>50),
$q->hidden(-name=>'id', -value=>$id), $q->hidden(-name=>'id', -value=>$id),
$q->submit(-name=>'Save', -accesskey=>T('s'), -value=>T('Save'))), $q->end_form; $q->submit(-name=>'Save', -accesskey=>T('s'), -value=>T('Save'))),
} else { $q->end_form;
print $q->p(T('This site does not use admin or editor passwords.'));
} }
if ($id) { if ($id) {
print $q->p(ScriptLink('action=browse;id=' . UrlEncode($id) . '&time=' . time, T('Return to ' . NormalToFree($id)))); print $q->p(ScriptLink('action=browse;id=' . UrlEncode($id) . ';time=' . time,
T('Return to ' . NormalToFree($id))));
} }
print $q->end_div(); print $q->end_div();
PrintFooter(); PrintFooter();
Expand Down

0 comments on commit e85f3e0

Please sign in to comment.