本文整理汇总了PHP中Confide::userByResetPasswordToken方法的典型用法代码示例。如果您正苦于以下问题:PHP Confide::userByResetPasswordToken方法的具体用法?PHP Confide::userByResetPasswordToken怎么用?PHP Confide::userByResetPasswordToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Confide
的用法示例。
在下文中一共展示了Confide::userByResetPasswordToken方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: resetPassword
/**
* Resets a password of a user. The $input['token'] will tell which user.
*
* @param array $input Array containing 'token', 'password' and 'password_confirmation' keys.
*
* @return boolean Success
*/
public function resetPassword($input)
{
$result = false;
$user = Confide::userByResetPasswordToken($input['token']);
if ($user) {
$user->password = $input['password'];
$user->password_confirmation = $input['password_confirmation'];
$result = $this->save($user);
}
// If result is positive, destroy token
if ($result) {
Confide::destroyForgotPasswordToken($input['token']);
}
return $result;
}
示例2: resetPassword
/**
* Resets a password of a user. The $input['token'] will tell which user.
*
* @param array $input Array containing 'token', 'password' and 'password_confirmation' keys.
*
* @return boolean Success
*/
public function resetPassword($input)
{
$result = false;
$user = Confide::userByResetPasswordToken($input['token']);
if ($user) {
$user->password = $input['password'];
$user->password_confirmation = $input['password_confirmation'];
$result = $this->save($user);
}
// If result is positive, destroy token
if ($result) {
Confide::destroyForgotPasswordToken($input['token']);
}
Activity::log(['contentId' => 0, 'contentType' => 'User', 'action' => 'resetPassword', 'description' => 'User reset password', 'details' => 'Username: ' . $input['username'], 'updated' => false]);
return $result;
}