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; }
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; }
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; }
public function sendRecoveryEmail(array $data) { $this->validator->setScenario('forgotPassword')->validate($data); $user = $this->userModel->where('email', $data['email'])->first(); return $this->sendEmail($user); }