/** * Reset a given user password * * @author ZZK * @link http://verecom.com * * @param $code * @param $password * * @throws UserNotFoundException * @return \Cartalyst\Sentry\Users\UserInterface */ public function resetPassword($code, $password) { try { $user = $this->sentry->findUserByResetPasswordCode($code); $user->password = $password; $user->save(); $this->event->fire('users.password.reset', array($user)); return $user; } catch (SentryUserNotFoundException $e) { throw new UserNotFoundException($e->getMessage()); } }
/** * Finds a user by the given reset password code. * * @param string $code * @return \Cartalyst\Sentry\Users\UserInterface * @throws \RuntimeException * @throws \Cartalyst\Sentry\Users\UserNotFoundException * @static */ public static function findUserByResetPasswordCode($code) { return \Cartalyst\Sentry\Sentry::findUserByResetPasswordCode($code); }