本文整理汇总了PHP中Model_User::authenticate方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_User::authenticate方法的具体用法?PHP Model_User::authenticate怎么用?PHP Model_User::authenticate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model_User
的用法示例。
在下文中一共展示了Model_User::authenticate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: authenticate
public function authenticate()
{
try {
$this->user = Model_User::authenticate($this->username, $this->password);
} catch (Exception $e) {
if ($e->getMessage() == Model_User::WRONG_PW) {
return $this->result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, self::BAD_PW_MSG);
}
if ($e->getMessage() == Model_User::NOT_FOUND) {
return $this->result(Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND, self::NOT_FOUND_MSG);
}
}
return $this->result(Zend_Auth_Result::SUCCESS);
}
示例2: _login
protected function _login($user, $password, $remember)
{
if (!is_object($user)) {
$username = $user;
$user = Model_User::authenticate($username, $password);
if ($user) {
return $this->complete_login($user);
}
return FALSE;
}
if ($user) {
return TRUE;
}
return FALSE;
}
示例3: force_login
/**
* Forces a user to be logged in, without specifying a password.
*
* @param mixed $username_or_email_or_id
*
* @return bool
*/
public function force_login($username_or_email_or_id)
{
$user = \Model_User::authenticate($username_or_email_or_id, true);
return $user && $this->complete_login($user);
}
示例4: action_login
/**
Handles the login action - initializes the session verifying the credentials
*/
public function action_login()
{
$error = null;
if (isset($_POST['submit'])) {
if (Model_User::authenticate($_POST, $this)) {
$this->request->redirect(SIGNED_IN_HOME);
} else {
$error = "Oops! Email and Password do not match.";
}
}
$this->add_to_header(new View("user/login", array('error_message' => $error)));
$this->_view = new View("pages/home");
$this->_enable_sidebar = false;
}
示例5: force_login
/**
* Forces a user to be logged in, without specifying a password.
*
* @param mixed $username_or_email_or_id
*
* @return bool
*/
public function force_login($username_or_email_or_id, $check_confirmation = false)
{
$user = \Model_User::authenticate($username_or_email_or_id, !$check_confirmation);
return $user && $this->complete_login($user);
}