/** * Login the user * * @deprected * @param $name string The login name submitted by the user * @param $pwd string The password submitted by the user * @param $allowpending boolean True if pending users are allowed (for verify.php). Default is false * @return PFUser Registered user or anonymous if the authentication failed */ function login($name, $pwd, $allowpending = false) { try { $password_expiration_checker = new User_PasswordExpirationChecker(); $password_handler = PasswordHandlerFactory::getPasswordHandler(); $login_manager = new User_LoginManager(EventManager::instance(), $this, $password_expiration_checker, $password_handler); $status_manager = new User_UserStatusManager(); $user = $login_manager->authenticate($name, $pwd); if ($allowpending) { $status_manager->checkStatusOnVerifyPage($user); } else { $status_manager->checkStatus($user); } $this->openWebSession($user); $password_expiration_checker->checkPasswordLifetime($user); $password_expiration_checker->warnUserAboutPasswordExpiration($user); $this->warnUserAboutAuthenticationAttempts($user); return $this->setCurrentUser($user); } catch (User_InvalidPasswordWithUserException $exception) { $GLOBALS['Response']->addFeedback(Feedback::ERROR, $exception->getMessage()); $accessInfo = $this->getUserAccessInfo($exception->getUser()); $this->getDao()->storeLoginFailure($name, $_SERVER['REQUEST_TIME']); } catch (User_InvalidPasswordException $exception) { $GLOBALS['Response']->addFeedback(Feedback::ERROR, $exception->getMessage()); } catch (User_PasswordExpiredException $exception) { $GLOBALS['Response']->addFeedback(Feedback::ERROR, $exception->getMessage()); $GLOBALS['Response']->redirect('/account/change_pw.php?user_id=' . $exception->getUser()->getId()); } catch (User_StatusInvalidException $exception) { $GLOBALS['Response']->addFeedback(Feedback::ERROR, $exception->getMessage()); } catch (SessionNotCreatedException $exception) { $GLOBALS['Response']->addFeedback(Feedback::ERROR, $exception->getMessage()); } catch (User_LoginException $exception) { $GLOBALS['Response']->addFeedback(Feedback::ERROR, $exception->getMessage()); } return $this->setCurrentUser($this->createAnonymousUser()); }