/** * Store a new user in the database. * * @return \Illuminate\Http\JsonResponse */ public function store() { try { $user = $this->users->create($this->input()); return $this->jsonResponse(['user' => $user]); } catch (ValidationException $e) { return $this->error($e->getMessageBag()); } }
/** * Attempt to reset a user's password. * * @return \Illuminate\Http\JsonResponse */ public function attemptReset() { $credentials = $this->input(['username']); $token = $this->input('token'); $input = $this->input(['password', 'password_confirmation']); try { $this->users->resetPasswordForCredentials($credentials, $input, $token); return $this->success(['password reset, please log in']); } catch (ReminderException $e) { return $this->error(['password could not be reset']); } }
/** * Check if password reminders are enabled. * * @return boolean */ private function remindersEnabled() { return $this->users->remindersEnabled(); }
protected function canSwitchUser() { return $this->users->getCurrentUser()->hasAccess('superadmin'); }