55 return $this->storage;
68 $this->enableLogging =
false;
70 if ($this->enableLogging)
72 $GLOBALS[
'ilLog']->write(__METHOD__.
': Init callbacks');
74 $this->setLoginCallback(array($this,
'loginObserver'));
75 $this->setFailedLoginCallback(array($this,
'failedLoginObserver'));
76 $this->setCheckAuthCallback(array($this,
'checkAuthObserver'));
77 $this->setLogoutCallback(array($this,
'logoutObserver'));
79 include_once(
'Services/Authentication/classes/class.ilAuthLogObserver.php');
97 include_once
"Services/User/classes/class.ilObjUser.php";
99 if($user_id != ANONYMOUS_USER_ID)
104 include_once
"Services/User/classes/class.ilUserProfile.php";
107 $user->setProfileIncomplete(
true);
118 if(!$user->getActive())
126 if(!$user->checkTimeLimit())
134 $clientip = $user->getClientIP();
135 if (trim($clientip) !=
"")
137 $clientip = preg_replace(
"/[^0-9.?*,:]+/",
"",$clientip);
138 $clientip = str_replace(
".",
"\\.",$clientip);
139 $clientip = str_replace(Array(
"?",
"*",
","), Array(
"[0-9]",
"[0-9]*",
"|"), $clientip);
140 if (!preg_match(
"/^".$clientip.
"$/", $_SERVER[
"REMOTE_ADDR"]))
149 if($ilSetting->get(
'ps_prevent_simultaneous_logins') &&
157 include_once
'Services/Tracking/classes/class.ilOnlineTracking.php';
158 ilOnlineTracking::addUser($user_id);
160 include_once
'Modules/Forum/classes/class.ilObjForum.php';
161 ilObjForum::_updateOldAccess($user_id);
163 require_once
'Services/PrivacySecurity/classes/class.ilSecuritySettings.php';
169 if($security_settings->isPasswordChangeOnFirstLoginEnabled() &&
170 $user->getLastLogin() == null
173 $user->resetLastPasswordChange();
176 $user->refreshLogin();
179 if($security_settings->getAccountSecurityMode() ==
191 __METHOD__ .
': logged in as ' . $a_auth->getUsername() .
192 ', remote:' . $_SERVER[
'REMOTE_ADDR'] .
':' . $_SERVER[
'REMOTE_PORT'] .
193 ', server:' . $_SERVER[
'SERVER_ADDR'] .
':' . $_SERVER[
'SERVER_PORT']
198 $ilAppEventHandler->raise(
199 'Services/Authentication',
'afterLogin',
200 array(
'username' => $a_auth->getUsername())
215 $ilLog->write(__METHOD__.
': login failed for user '.$a_username.
216 ', remote:'.$_SERVER[
'REMOTE_ADDR'].
':'.$_SERVER[
'REMOTE_PORT'].
217 ', server:'.$_SERVER[
'SERVER_ADDR'].
':'.$_SERVER[
'SERVER_PORT']
220 require_once
'Services/PrivacySecurity/classes/class.ilSecuritySettings.php';
227 if(!in_array(
$usr_id, array(ANONYMOUS_USER_ID, SYSTEM_USER_ID)))
232 $max_attempts = $security->getLoginMaxAttempts();
233 if((
int)$max_attempts && $login_attempts >= $max_attempts)
240 return $this->
getContainer()->failedLoginObserver($a_username,$a_auth);
251 #$GLOBALS['ilLog']->write(__METHOD__.': Check auth observer called');
252 return $this->
getContainer()->checkAuthObserver($a_username,$a_auth);
265 $ilLog->write(__METHOD__.
': Logout observer called');
269 return $this->
getContainer()->logoutObserver($a_username,$a_auth);