/** * Confirm user with token. * * @param string $token * @return Response */ public function index($token) { $user = $this->userRepo->getByConfirmationToken($token); if (!$user) { return view('auth.confirm')->withBadToken(true); } $user->confirm(); $this->auth->login($user); return redirect('/'); }
/** * Log in the user. * * @return \Response */ public function store() { $input = Input::only('email', 'password'); $remember = Input::has('remember'); $this->logInForm->validate($input); if (!$this->auth->once($input)) { return json(['errors' => trans('errors.credentials')]); } if (!$this->auth->user()->confirmed) { return json(['errors' => trans('errors.not_confirmed')]); } $this->auth->login($this->auth->user(), $remember); return json(true); }
/** * Handle the command. * * @param $command * * @throws \Tectonic\Shift\Modules\Authentication\Exceptions\InvalidAuthenticationCredentialsException * @throws \Tectonic\Shift\Modules\Authentication\Exceptions\UserAccountAssociationException * @return \Illuminate\Auth\UserInterface|null */ public function handle($command) { // First check to see if the users credentials are valid. $userCredentialsAreValid = $this->authenticate->validate(['email' => $command->email, 'password' => $command->password]); // If user credential are invalid, throw exception. if (!$userCredentialsAreValid) { throw new InvalidAuthenticationCredentialsException(); } // Find out if user has an account id with the current account $accountUser = $this->userRepository->getByEmailAndAccount($command->email, CurrentAccount::get()); // If an account user is found, login and return user if ($accountUser) { $this->authenticate->login($accountUser, $command->remember); $user = $this->authenticate->getUser(); // Raise an event, and dispatch $this->raise(new UserHasAuthenticated($user)); $this->eventDispatcher->dispatch($this->releaseEvents()); return $user; } // Login failed, throw exception throw new UserAccountAssociationException(); }
public function handleRegister(RegistrationRequest $request, AuthManager $auth) { $user = User::create($request->all()); $auth->login($user); return redirect()->route('home')->with('message', 'Your account has been created!'); }
/** * Handle the event. * * @param UserWasCreated $event */ public function handle(UserWasCreated $event) { $this->auth->login($event->user); }
public function switchToUser($user, $remember = false) { $this->auth->login($user, $remember); }
/** * @param \FIIP\Users\User $user * @return \Response */ private function loginUser($user) { $this->auth->login($user, true); return redirect()->route('home'); }