/**
  * Handle a registration request for the application.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function register(Request $request)
 {
     $validator = $this->validator($request->all());
     if ($validator->fails()) {
         return redirect(action('Auth\\AuthController@showRegistrationForm'))->withErrors($validator)->withInput();
     }
     \Auth::guard($this->getGuard())->login($this->create($request->all()));
     return redirect($this->redirectPath());
 }
Beispiel #2
0
 /**
  * Send the response after the user was authenticated.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  bool  $throttles
  * @return \Illuminate\Http\Response
  */
 protected function handleUserWasAuthenticated(Request $request, $throttles)
 {
     if ($throttles) {
         $this->clearLoginAttempts($request);
     }
     if (method_exists($this, 'authenticated')) {
         return $this->authenticated($request, Auth::guard($this->getGuard())->user());
     }
     flash()->success('Welcome!', '');
     return redirect()->intended($this->redirectPath());
 }
Beispiel #3
0
 /**
  * Handle a registration request for the application.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function register(Request $request)
 {
     $validator = $this->validator($request->all());
     if ($validator->fails()) {
         $this->throwValidationException($request, $validator);
     }
     $this->create($request->all());
     if (!\Auth::user()) {
         \Auth::guard($this->getGuard())->login($this->create($request->all()));
         return redirect($this->redirectPath());
     } else {
         return redirect()->action('Auth\\UserController@getIndex')->with('message_type', 'success')->with('message', 'Successfully created! Edit them to add to groups!');
     }
 }
Beispiel #4
0
 /**
  * Log the user out of the application.
  *
  * @return \Illuminate\Http\Response
  */
 public function logout()
 {
     \Auth::guard($this->getGuard())->logout();
     \Session::flash('message', 'You have been logged out.');
     return redirect(property_exists($this, 'redirectAfterLogout') ? $this->redirectAfterLogout : '/');
 }
Beispiel #5
0
 /**
  * Reset the given user's password.
  *
  * @param  \Illuminate\Contracts\Auth\CanResetPassword  $user
  * @param  string  $password
  * @return void
  */
 protected function resetPassword($user, $password)
 {
     $user->password = $password;
     $user->save();
     Auth::guard($this->getGuard())->login($user);
 }