From e85f3e054bdaa4703baed58a7765e7454abc28e5 Mon Sep 17 00:00:00 2001 From: Alex Schroeder Date: Fri, 24 Apr 2015 09:19:35 +0200 Subject: [PATCH] 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). --- wiki.pl | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/wiki.pl b/wiki.pl index 9d02d0541..3ac4a447d 100755 --- a/wiki.pl +++ b/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();