Devise\Users\Sessions\SessionsRepository::recoverPassword PHP Метод

recoverPassword() публичный Метод

Handle a POST request to recover password
public recoverPassword ( array $input ) : Response
$input array
Результат Response
    public function recoverPassword($input)
    {
        $input = array_except($input, '_token');
        $response = $this->Framework->Password->sendResetLink($input);
        switch ($response) {
            case \Password::INVALID_USER:
                $this->message = 'There were validation errors.';
                $this->errors = $this->Lang->get($response);
                return false;
            case \Password::RESET_LINK_SENT:
                $this->message = 'Recovery email has been sent.';
                break;
        }
    }

Usage Example

Пример #1
0
 /**
  * Executes recoverPassword method in SessionsRepository
  *
  * @param  array  $input
  * @return Response
  */
 public function requestRecoverPassword($input)
 {
     if ($this->SessionsRepository->recoverPassword($input)) {
         return $this->Redirect->route('dvs-user-recover-password')->with('message-success', $this->SessionsRepository->message);
     }
     return $this->Redirect->route('dvs-user-recover-password')->withInput()->withErrors($this->SessionsRepository->errors)->with('message-errors', $this->SessionsRepository->message);
 }