Moving login marking to support per-method marking mechanisms.
This commit is contained in:
parent
9b0c5706ee
commit
dce7cad6b6
@ -337,11 +337,8 @@ sub post_authenticate {
|
||||
if(!$user);
|
||||
|
||||
# Touch the user's record...
|
||||
my $pokeh = $self -> {"dbh"} -> prepare("UPDATE ".$self -> {"settings"} -> {"database"} -> {"users"}."
|
||||
SET last_login = UNIX_TIMESTAMP()
|
||||
WHERE user_id = ?");
|
||||
$pokeh -> execute($user -> {"user_id"})
|
||||
or $self -> {"logger"} -> die_log($self -> {"cgi"} -> remote_host(), "FATAL: Unable to update user record: ".$self -> {"dbh"} -> errstr);
|
||||
$methodimpl -> mark_login($user -> {"userid"})
|
||||
or return $self -> self_error($methodimpl -> errstr());
|
||||
|
||||
# All done...
|
||||
return $user;
|
||||
|
@ -254,6 +254,26 @@ sub force_passchange {
|
||||
}
|
||||
|
||||
|
||||
## @method $ mark_login($userid)
|
||||
# Update a user's internal record to reflect the fact that they have successfully
|
||||
# logged in.
|
||||
#
|
||||
# @param userid The ID of the user who has successfully logged in.
|
||||
# @return true on success, undef on error.
|
||||
sub mark_login {
|
||||
my $self = shift;
|
||||
my $userid = shift;
|
||||
|
||||
my $pokeh = $self -> {"dbh"} -> prepare("UPDATE ".$self -> {"settings"} -> {"database"} -> {"users"}."
|
||||
SET last_login = UNIX_TIMESTAMP()
|
||||
WHERE user_id = ?");
|
||||
$pokeh -> execute($userid)
|
||||
or return $self -> self_error("Unable to update user record: ".$self -> {"dbh"} -> errstr);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
## @method @ mark_loginfail($userid)
|
||||
# Increment the login failure count for the specified user. The following configuration
|
||||
# parameter (which should be set for each applicable authmethod in the auth_method_params
|
||||
|
@ -338,6 +338,26 @@ sub generate_actcode {
|
||||
}
|
||||
|
||||
|
||||
## @method $ mark_login($userid)
|
||||
# Update a user's internal record to reflect the fact that they have successfully
|
||||
# logged in. This will also zero the user's login failure counter.
|
||||
#
|
||||
# @param userid The ID of the user who has successfully logged in.
|
||||
# @return true on success, undef on error.
|
||||
sub mark_login {
|
||||
my $self = shift;
|
||||
my $userid = shift;
|
||||
|
||||
my $pokeh = $self -> {"dbh"} -> prepare("UPDATE ".$self -> {"settings"} -> {"database"} -> {"users"}."
|
||||
SET last_login = UNIX_TIMESTAMP(), fail_count = 0
|
||||
WHERE user_id = ?");
|
||||
$pokeh -> execute($userid)
|
||||
or return $self -> self_error("Unable to update user record: ".$self -> {"dbh"} -> errstr);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
## @method @ mark_loginfail($userid)
|
||||
# Increment the login failure count for the specified user. The following configuration
|
||||
# parameter (which should be set for each applicable authmethod in the auth_method_params
|
||||
|
Loading…
x
Reference in New Issue
Block a user