You are here: Foswiki>Tasks Web>Item12095 (02 Dec 2012, GeorgeClark)Edit Attach

Item12095: Template Login panel is not returning error messages to the user

pencil
Priority: Normal
Current State: Closed
Released In: 1.1.6
Target Release: patch
Applies To: Engine
Component: FoswikiTemplates
Branches: Release01x01 trunk
Reported By: GeorgeClark
Waiting For:
Last Change By: GeorgeClark
Template Login helpfully returns an ERROR variable that reports login issues.

If the admin forgets to set a bin/configure password, attempts to login as admin or sudo to admin will fail, but the error message telling the user to set the administration password using configure is lost.

Appears to be a template issue as the %ERROR% macro is set by login and expands if manually added to the template.

-- GeorgeClark - 26 Sep 2012

Arthur. I added %ERROR% to the template, it's ugly, but it gets expanded. So something in the hierarchy of expanding templates is dropping that variable somewhere. Actually it seems to be more than just that.

If the admin password is not set, the %ERROR% variable is returned with "To login as admin, you must set {Password} in configure"

In the login.tmpl, %ERROR% is expanded in:
%TMPL:DEF{"error"}%%MAKETEXT{"Error: [_1]" args="%ERROR%"}%%TMPL:END%

That particular template is not ever included on either the login.tmpl or login.sudo.tmpl templates. To test it, I added a simple to the template, just to see what expands, and I only get 1/2 of the error:

%ERROR% expands to "To login as admin, you must set {Password} in configure" but %TMPL:P{"error"}% expands to just the "To login as admin"

So I see it as two issues.
  • The =%ERROR% returned by login, and the "error" template definition are not included in the template
  • The TMPL:DEF for error is incorrectly specifying the argument for maketext.

-- GeorgeClark - 17 Oct 2012

ERROR already is in the login template, only it is made hidden (why? when?):
%TMPL:DEF{"errorstep"}%%IF{"defined BANNER AND $BANNER != ''" then='<div class="foswikiNotification foswikiAlert foswikiUnvisited foswikiLoginNotification">%BANNER%%IF{"defined ERROR AND $ERROR != ''" then='<!--%TMPL:P{"error"}%-->'}%</div>'}%%TMPL:END%

%TMPL:DEF{"error"}%%MAKETEXT{"Error: [_1]" args="%ERROR%"}%%TMPL:END%

Is this new ERROR a replacement?

-- ArthurClemens - 17 Oct 2012

No... I'm just trying to figure out why the old ERROR doesn't work. Not very helpful to generate error messages that we then hide.

Edit your LocalSite.cfg, remove the $Foswiki::cfg{Password} entry. Then try to use the "Internal Administrator Login" ... Where is the message saying to fix LSC?

-- GeorgeClark - 17 Oct 2012

I don't know why the error was inside a html comment. Fixed now, with extra escaping in case quotes are used in the error message.

-- ArthurClemens - 24 Oct 2012

ItemTemplate edit

Summary Template Login panel is not returning error messages to the user
ReportedBy GeorgeClark
Codebase 1.1.5, trunk
SVN Range
AppliesTo Engine
Component FoswikiTemplates
Priority Normal
CurrentState Closed
WaitingFor
Checkins distro:59fe5bcf7210 distro:49fb80ddaf23
TargetRelease patch
ReleasedIn 1.1.6
CheckinsOnBranches Release01x01 trunk
trunkCheckins distro:59fe5bcf7210
Release01x01Checkins distro:49fb80ddaf23
Topic revision: r8 - 02 Dec 2012, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy