/** * 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; }
/** * 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: '******'username'], 'updated' => false]); return $result; }