57 $this->sub_status = $a_sub_status;
76 return $this->storage;
88 $this->enableLogging =
false;
91 if ($this->enableLogging)
93 $GLOBALS[
'ilLog']->write(__METHOD__.
': Init callbacks');
95 $this->setLoginCallback(array($this,
'loginObserver'));
96 $this->setFailedLoginCallback(array($this,
'failedLoginObserver'));
97 $this->setCheckAuthCallback(array($this,
'checkAuthObserver'));
98 $this->setLogoutCallback(array($this,
'logoutObserver'));
100 include_once(
'Services/Authentication/classes/class.ilAuthLogObserver.php');
118 include_once
"Services/User/classes/class.ilObjUser.php";
120 if($user_id != ANONYMOUS_USER_ID)
125 include_once
"Services/User/classes/class.ilUserProfile.php";
128 $user->setProfileIncomplete(
true);
138 if(!$user->getActive())
146 if(!$user->checkTimeLimit())
150 $this->exceeded_user_name = $this->getUserName();
156 $clientip = $user->getClientIP();
157 if (trim($clientip) !=
"")
159 $clientip = preg_replace(
"/[^0-9.?*,:]+/",
"",$clientip);
160 $clientip = str_replace(
".",
"\\.",$clientip);
161 $clientip = str_replace(Array(
"?",
"*",
","), Array(
"[0-9]",
"[0-9]*",
"|"), $clientip);
162 if (!preg_match(
"/^".$clientip.
"$/", $_SERVER[
"REMOTE_ADDR"]))
171 if($ilSetting->get(
'ps_prevent_simultaneous_logins') &&
179 include_once
'Services/Tracking/classes/class.ilOnlineTracking.php';
180 ilOnlineTracking::addUser($user_id);
182 include_once
'Modules/Forum/classes/class.ilObjForum.php';
183 ilObjForum::_updateOldAccess($user_id);
185 require_once
'Services/PrivacySecurity/classes/class.ilSecuritySettings.php';
191 if($security_settings->isPasswordChangeOnFirstLoginEnabled() &&
192 $user->getLastLogin() == null
195 $user->resetLastPasswordChange();
198 $user->refreshLogin();
207 __METHOD__ .
': logged in as ' . $a_auth->getUsername() .
208 ', remote:' . $_SERVER[
'REMOTE_ADDR'] .
':' . $_SERVER[
'REMOTE_PORT'] .
209 ', server:' . $_SERVER[
'SERVER_ADDR'] .
':' . $_SERVER[
'SERVER_PORT']
214 $ilAppEventHandler->raise(
215 'Services/Authentication',
'afterLogin',
216 array(
'username' => $a_auth->getUsername())
231 $ilLog->write(__METHOD__.
': login failed for user '.$a_username.
232 ', remote:'.$_SERVER[
'REMOTE_ADDR'].
':'.$_SERVER[
'REMOTE_PORT'].
233 ', server:'.$_SERVER[
'SERVER_ADDR'].
':'.$_SERVER[
'SERVER_PORT']
239 if(!in_array($usr_id, array(ANONYMOUS_USER_ID, SYSTEM_USER_ID)))
244 require_once
'Services/PrivacySecurity/classes/class.ilSecuritySettings.php';
246 $max_attempts = $security->getLoginMaxAttempts();
248 if((
int)$max_attempts && $login_attempts >= $max_attempts)
255 return $this->
getContainer()->failedLoginObserver($a_username,$a_auth);
266 #$GLOBALS['ilLog']->write(__METHOD__.': Check auth observer called');
267 return $this->
getContainer()->checkAuthObserver($a_username,$a_auth);
278 global
$ilLog, $ilAppEventHandler;
280 $ilLog->write(__METHOD__.
': Logout observer called');
284 $ilAppEventHandler->raise(
285 'Services/Authentication',
'afterLogout',
286 array(
'username' => $a_auth->getUsername())
289 return $this->
getContainer()->logoutObserver($a_username,$a_auth);