[#1622] Allow custom error messages from pre/post auth hooks
Summary Allow custom error messages from pre/post auth hooks
Queue Horde Base
Queue Version 3.0.3
Type Enhancement
State Resolved
Priority 1. Low
Owners Horde Developers (at)
Requester eli (at) experthost (dot) com
Created 2005-03-25 (5108 days ago)
Updated 2005-05-30 (5042 days ago)
Assigned 2005-03-25 (5108 days ago)
Resolved 2005-05-30 (5042 days ago)
Patch No

2005-05-30 03:07:39 Chuck Hagenbuch Comment #5
State ⇒ Resolved
Reply to this comment
Added to HEAD, thanks.
2005-03-29 20:43:08 eli (at) experthost (dot) com Comment #4
New Attachment: nicer[1].patch Download
Reply to this comment
Whoops, slight typo in the patch - there is a call to _getAuthError 
where I forgot to call it like "_getAuthError()".

Fixed patch attached.
2005-03-29 20:39:40 eli (at) experthost (dot) com Comment #3
New Attachment: nicer.patch Download
Reply to this comment
Here's a slightly nicer version.  I added an abstraction function to 
get the current error type and return it if any (false otherwise - 
maybe NULL might be better since you return a string type rather than 
an integer type).

Word of caution - I have noticed that IE does not like more than 165 
characters in a URL when handing a Refresh: header - thus there is a 
good chance that using this patch will cause IMP to hang on 
redirect.php rather than properly display the custom error message.   
This doesn't happen in FireFox though.
2005-03-25 11:19:23 Jan Schneider State ⇒ Assigned
Assigned to Horde DevelopersHorde Developers
2005-03-25 02:33:19 eli (at) experthost (dot) com Comment #2 Reply to this comment
Forgot to mention (yet obvious from the patch) that it *only* allows 
the use of the AUTH_REASON_MESSAGE error message via 
Auth::_setAuthError().  Any other type will yeild the default message. 
  This is for a reason since it would make sense that 
AUTH_REASON_MESSAGE be allowed, yet all others not since they are more 
generic internal error messages.
2005-03-25 02:30:31 eli (at) experthost (dot) com Comment #1
Type ⇒ Enhancement
State ⇒ New
Priority ⇒ 1. Low
Summary ⇒ Allow custom error messages from pre/post auth hooks
Queue ⇒ Horde Base
New Attachment: custom_errors.patch Download
Reply to this comment
In the pre & post auth hooks (_horde_hook_preauthenticate, 
_horde_hook_postauthenticate), it is impossible to specify a custom 
error message to be displayed to the user for login failures.  This is 
because the true/false return of the hook is used to simply generate 
the generic login failure error message.

It would be nice to be able to specify a custom error message for all 
hooks, and the attached patch allows for such a feature in at least 
the pre/post auth hooks.

However, I would highly recommend the patch be used simply as an idea 
- it generates low level warning messages sometimes when the 
$GLOBALS['__autherror'] array does not exist (querying a non-existant 
key name), and also hard codes the $GLOBALS['__autherror'] array in a 
place where an abstraction function to access such info should really 
be used.


Saved Queries