post_authenticate now returns the user's data on success.

This should help avoid the need for multiple calls to fetch the user
data when doing post auth that invokes the superclass post_auth.
This commit is contained in:
Chris 2012-03-19 10:25:08 +00:00
parent e968015101
commit e8475547c5
2 changed files with 6 additions and 3 deletions

View File

@ -245,7 +245,8 @@ sub set_user_authmethod {
# desirable, subclasses may wish to override this function completely.
#
# @param username The username of the user to update the user_auth field for.
# @return An empty string on success, otherwise an error message.
# @return A reference to a hash containing the user's data on success,
# otherwise an error message.
sub post_authenticate {
my $self = shift;
my $username = shift;
@ -273,7 +274,7 @@ sub post_authenticate {
or die_log($self -> {"cgi"} -> remote_host(), "FATAL: Unable to update user record: ".$self -> {"dbh"} -> errstr);
# All done...
return '';
return $user;
}

View File

@ -232,7 +232,9 @@ sub valid_user {
# invoke the app standard post-auth for the user, and return the user's
# database record.
if($valid) {
$self -> {"lasterr"} = $self -> {"app"} -> post_authenticate($username);
my $success = $self -> {"app"} -> post_authenticate($username);
$self -> {"lasterr"} = $success if(!ref($success)); # If postauth returned an error, store it.
$self -> {"app"} -> set_user_authmethod($username, $authmethod);
return $self -> {"app"} -> get_user($username);