Exemplo n.º 1
0
 public function fire(array $data)
 {
     $this->validator->setScenario('register')->validate($data);
     $data['password'] = $this->hasher->make($data['password']);
     $user = $this->userModel->create($data);
     event(new UserRegistered($user));
     return $user;
 }
Exemplo n.º 2
0
 public function fire(array $data)
 {
     $this->validator->setScenario('login')->validate($data);
     $user = $this->user->where('email', $data['email'])->first();
     if (!$this->hasher->check($data['password'], $user->password)) {
         throw new LoginFailedException();
     }
     return $user;
 }
Exemplo n.º 3
0
 public function fire(array $data)
 {
     $this->validator->setScenario('recoverPassword')->validate($data);
     $token = $this->tokenHelper->validate($data['token']);
     if ($token === false) {
         $this->response()->errorBadRequest(trans('messages.token_invalid'));
     }
     $user = $token->tokenable->first();
     if ($user === NULL) {
         $this->response()->errorBadRequest(trans('messages.token_invalid'));
     }
     $user->password = $this->hasher->make($data['password']);
     $user->save();
     $token->delete();
     return $user;
 }
Exemplo n.º 4
0
 public function sendRecoveryEmail(array $data)
 {
     $this->validator->setScenario('forgotPassword')->validate($data);
     $user = $this->userModel->where('email', $data['email'])->first();
     return $this->sendEmail($user);
 }