74 $pam = new \ElggPAM(
'user');
76 $result = $pam->authenticate($credentials);
78 return $pam->getFailureMessage();
97 if (!isset($credentials[
'username']) || !isset($credentials[
'password'])) {
109 $hash =
$user->password_hash;
114 if (!$password_svc->verify(
$password, $hash)) {
119 if ($password_svc->needsRehash($hash)) {
140 $fails = (int)
$user->getPrivateSetting(
"login_failures");
143 $user->setPrivateSetting(
"login_failures", $fails);
144 $user->setPrivateSetting(
"login_failure_$fails", time());
167 $fails = (int)
$user->getPrivateSetting(
"login_failures");
170 for ($n = 1; $n <= $fails; $n++) {
171 $user->removePrivateSetting(
"login_failure_$n");
174 $user->removePrivateSetting(
"login_failures");
202 $fails = (int)
$user->getPrivateSetting(
"login_failures");
206 for ($n = $fails; $n > 0; $n--) {
207 $f =
$user->getPrivateSetting(
"login_failure_$n");
208 if ($f >
$time - (60 * 5)) {
280 $first_login = empty($user->last_login);
289 $user->first_login = time();
314 $old_msg =
$session->get(SystemMessagesService::SESSION_KEY, []);
316 $session->set(SystemMessagesService::SESSION_KEY, $old_msg);
335 if (
$session->has(
'last_forward_from')) {
337 $session->remove(
'last_forward_from');
338 $forward_source =
'last_forward_from';
339 }
elseif ($request->getParam(
'returntoreferer')) {
341 $forward_source =
'return_to_referer';
345 $forward_source = null;
351 'source' => $forward_source,
elgg_call(int $flags, Closure $closure)
Calls a callable autowiring the arguments using public DI services and applying logic based on flags...
elgg_is_logged_in()
Returns whether or not the user is currently logged in.
if(!$entity->delete()) $forward_url
_elgg_get_login_forward_url(\Elgg\Request $request,\ElggUser $user)
Determine which URL the user should be forwarded to upon successful login.
$params
Saves global plugin settings.
elgg_is_admin_logged_in()
Returns whether or not the viewer is currently logged in and an admin user.
Generic parent class for login exceptions.
pam_auth_userpass(array $credentials=[])
Hook into the PAM system which accepts a username and password and attempts to authenticate it agains...
elgg_get_session()
Gets Elgg's session object.
if(!$annotation instanceof ElggAnnotation) $time
setLastLogin()
Sets the last logon time of the user to right now.
reset_login_failure_count($user_guid)
Resets the fail login count for $user_guid.
elgg_echo($message_key, array $args=[], $language="")
Elgg language module Functions to manage language and translations.
elgg_trigger_before_event($event, $object_type, $object=null)
Trigger a "Before event" indicating a process is about to begin.
check_rate_limit_exceeded($user_guid)
Checks if the rate limit of failed logins has been exceeded for $user_guid.
get_user_by_username($username)
Get user by username.
const ELGG_IGNORE_ACCESS
elgg_call() flags
if(!$user||!$user->canEdit()) $password
const ELGG_SHOW_DISABLED_ENTITIES
elgg_trigger_plugin_hook($hook, $type, $params=null, $returnvalue=null)
isEnabled()
Is this entity enabled?
elgg_set_cookie(\ElggCookie $cookie)
Set a cookie, but allow plugins to customize it first.
logout()
Log the current user out.
if(isset($_COOKIE['elggperm'])) $session
elgg_authenticate($username, $password)
Perform user authentication with a given username and password.
if($item instanceof\ElggEntity) elseif($item instanceof\ElggRiverItem) elseif($item instanceof ElggRelationship) elseif(is_callable([$item, 'getType']))
login(\ElggUser $user, $persistent=false)
Logs in a specified .
_elgg_services()
Get the global service provider.
elgg_trigger_after_event($event, $object_type, $object=null)
Trigger an "After event" indicating a process has finished.
elgg_get_logged_in_user_entity()
Return the current logged in user, or null if no user is logged in.
isBanned()
Is this user banned or not?
elgg_trigger_event($event, $object_type, $object=null)
Login as the specified user.
log_login_failure($user_guid)
Log a failed login for $user_guid.
elgg_get_logged_in_user_guid()
Return the current logged in user by guid.
get_entity($guid)
Loads and returns an entity object from a guid.