Esempio n. 1
0
 /**
  * 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());
     }
 }
Esempio n. 2
0
 /**
  * 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']);
     }
 }
Esempio n. 3
0
 /**
  * Check if password reminders are enabled.
  *
  * @return boolean
  */
 private function remindersEnabled()
 {
     return $this->users->remindersEnabled();
 }
Esempio n. 4
0
 protected function canSwitchUser()
 {
     return $this->users->getCurrentUser()->hasAccess('superadmin');
 }