Permalink
Browse files

Improve feedback for the password page

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 e85f3e054bdaa4703baed58a7765e7454abc28e5
Showing with 19 additions and 15 deletions.
  1. +19 −15 wiki.pl
View
34 wiki.pl
@@ -3093,27 +3093,31 @@ sub DoPassword {
my $id = shift;
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.'));
if (UserIsAdmin()) {
print $q->p(T('You are currently an administrator on this site.'));
} elsif (UserIsEditor()) {
print $q->p(T('You are currently an editor on this site.'));
if (not $AdminPass and not $EditPass) {
print $q->p(T('This site does not use admin or editor passwords.'));
} else {
print $q->p(T('You are a normal user on this site.'));
if ($AdminPass or $EditPass) {
print $q->p(T('Your password does not match any of the administrator or editor passwords.'));
if (UserIsAdmin()) {
print $q->p(T('You are currently an administrator on this site.'));
} 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'),
$q->p(GetHiddenValue('action', 'password'), T('Password:'), ' ',
$q->password_field(-name=>'pwd', -size=>20, -maxlength=>50),
$q->hidden(-name=>'id', -value=>$id),
$q->submit(-name=>'Save', -accesskey=>T('s'), -value=>T('Save'))), $q->end_form;
} else {
print $q->p(T('This site does not use admin or editor passwords.'));
$q->password_field(-name=>'pwd', -size=>20, -maxlength=>50),
$q->hidden(-name=>'id', -value=>$id),
$q->submit(-name=>'Save', -accesskey=>T('s'), -value=>T('Save'))),
$q->end_form;
}
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();
PrintFooter();

0 comments on commit e85f3e0

Please sign in to comment.