Attempts to login the user.

@param Request $request
@return RedirectResponse
324973
public function store(Request $request)
    {
        try {
            $this->dispatch(new AttemptUserLogin($request->get('email'), $request->get('password'), $request->get('remember')));
            return redirect()->intended($this->config->get('authentication.login.redirectUri'));
        } catch (LoginFailed $e) {
            return redirect()->back()->withInput()->withErrors([
                'authentication::login_error' => $e->getMessage()
            ]);
        } catch (UserIsBanned $e) {
            return redirect()->back()->withInput()->withErrors([
                'authentication::login_error' => $e->getMessage()
            ]);
        }
    }
494993
public function loginAction(Request $request)
    {
        if ($this->getUser() instanceof UserInterface) {
            $this->addFlash('sonata_user_error', 'sonata_user_already_authenticated');
            $url = $this->generateUrl('sonata_admin_dashboard');

            return $this->redirect($url);
        }

        $session = $request->getSession();

        $authErrorKey = Security::AUTHENTICATION_ERROR;

        // get the error if any (works with forward and redirect -- see below)
        if ($request->attributes->has($authErrorKey)) {
            $error = $request->attributes->get($authErrorKey);
        } elseif (null !== $session && $session->has($authErrorKey)) {
            $error = $session->get($authErrorKey);
            $session->remove($authErrorKey);
        } else {
            $error = null;
        }

        if (!$error instanceof AuthenticationException) {
            $error = null; // The value does not come from the security component.
        }

        if ($this->isGranted('ROLE_ADMIN')) {
            $refererUri = $request->server->get('HTTP_REFERER');

            return $this->redirect($refererUri && $refererUri != $request->getUri() ? $refererUri : $this->generateUrl('sonata_admin_dashboard'));
        }

        $csrfToken = $this->has('security.csrf.token_manager')
            ? $this->get('security.csrf.token_manager')->getToken('authenticate')->getValue()
            : null;

        return $this->render('NetworkingInitCmsBundle:Admin:Security/login.html.twig', [
            'admin_pool' => $this->get('sonata.admin.pool'),
            'base_template' => $this->get('sonata.admin.pool')->getTemplate('layout'),
            'csrf_token' => $csrfToken,
            'error' => $error,
            'last_username' => (null === $session) ? '' : $session->get(Security::LAST_USERNAME),
            'reset_route' => $this->generateUrl('networking_init_cms_admin_resetting_request'),
        ]);
    }
663505
public function postRegister(Request $request)
	{
		$validator = $this->registrar->validator($request->all());

		if ($validator->fails())
		{
			$this->throwValidationException(
				$request, $validator
			);
		}

		$this->auth->login($this->registrar->create($request->all()));

		return redirect($this->redirectPath());
	}
1175086
public function postLogin(Request $request)
    {
        // Validate the Form Data
        $result = $this->validate($request, [
            'email' => 'required',
            'password' => 'required'
        ]);

        // Assemble Login Credentials
        $credentials = [
            'email' => trim($request->get('email')),
            'password' => $request->get('password'),
        ];
        $remember = (bool)$request->get('remember', false);

        // Attempt the Login
        $result = $this->authManager->authenticate($credentials, $remember);

        // Return the appropriate response
        $path = session()->pull('url.intended', route('dashboard'));
        return $result->dispatch($path);
    }
1156183
protected function sendFailedLoginResponse(Request $request)
    {
        return redirect()->back()
            ->withInput($request->only($this->username(), 'remember'))
            ->withErrors([
                $this->username() => Lang::get('auth.failed'),
            ]);
    }
966427
public function postIndex(Request $request)
    {

        $form = FormBuilder::create('Distilleries\Expendable\Http\Forms\Login\SignIn');

        if ($form->hasError())
        {
            return $form->validateAndRedirectBack();
        }

        $credential     = $request->only('email', 'password');
        $userCredential = app('Distilleries\Expendable\Contracts\LockableContract')->where('email', $credential['email'])->get()->last();

        if (UserUtils::securityCheckLockEnabled() && !empty($userCredential) && $userCredential->isLocked())
        {
            return redirect()->back()->with(Message::WARNING, [trans('expendable::login.locked')]);
        }

        if ($this->auth->attempt($credential, config('expendable.remember_me')))
        {
            $user = $this->auth->user();
            new UserEvent(UserEvent::LOGIN_EVENT, $user);

            $menu = config('expendable.menu');


            if (method_exists($user, 'getFirstRedirect'))
            {
                return redirect()->to($this->auth->user()->getFirstRedirect($menu['left']));
            }

            return redirect()->to('/');

        } else
        {

            if (UserUtils::securityCheckLockEnabled())
            {
                new UserEvent(UserEvent::SECURITY_EVENT, $credential['email']);
            }


            return redirect()->back()->with(Message::WARNING, [trans('expendable::login.credential')]);
        }

    }
335648
public function postLogin(Request $request)
    {
        $this->loginValidator($request->all())->validate();

        $credentials = $request->only([$this->username(), 'password']);
        $remember = $request->get('remember', false);

        if ($this->guard()->attempt($credentials, $remember)) {
            return $this->sendLoginResponse($request);
        }

        return back()->withInput()->withErrors([
            $this->username() => $this->getFailedLoginMessage(),
        ]);
    }
1043785
protected function sendFailedLoginResponse( Request $request )
	{
		return Redirect::back()->withInput( $request->only( $this->loginUsername(), 'remember' ) )->withErrors( [
				$this->loginUsername() => $this->getFailedLoginMessage(),
			] );
	}
1171862
public function login(Request $request)
    {
        $this->validateLogin($request);

        // If the class is using the ThrottlesLogins trait, we can automatically throttle
        // the login attempts for this application. We'll key this by the username and
        // the IP address of the client making these requests into this application.
        if ($this->hasTooManyLoginAttempts($request)) {
            $this->fireLockoutEvent($request);

            return $this->sendLockoutResponse($request);
        }

        if ($this->attemptLogin($request)) {
            return $this->sendLoginResponse($request);
        }

        // If the login attempt was unsuccessful we will increment the number of attempts
        // to login and redirect the user back to the login form. Of course, when this
        // user surpasses their maximum number of attempts they will get locked out.
        $this->incrementLoginAttempts($request);

        return $this->sendFailedLoginResponse($request);
    }
1142185
protected function sendLoginResponse(Request $request)
    {
        $request->session()->regenerate();

        $this->clearLoginAttempts($request);

        return $this->authenticated($request, $this->guard()->user())
                ?: redirect()->intended($this->redirectPath());
    }
1148175
public function authenticate(Request $request)
    {
        return $request->get('username') === $this->username
            && password_verify($request->get('password'), $this->password);
    }
991924
public function login(Request $request)
    {
        $this->validateLogin($request);

        // If the class is using the ThrottlesLogins trait, we can automatically throttle
        // the login attempts for this application. We'll key this by the username and
        // the IP address of the client making these requests into this application.
        if ($lockedOut = $this->hasTooManyLoginAttempts($request)) {
            $this->fireLockoutEvent($request);

            return $this->sendLockoutResponse($request);
        }

        $credentials = $this->credentials($request);

        if ($this->guard()->attempt($credentials, $request->has('remember'))) {
            return $this->sendLoginResponse($request);
        }

        // If the login attempt was unsuccessful we will increment the number of attempts
        // to login and redirect the user back to the login form. Of course, when this
        // user surpasses their maximum number of attempts they will get locked out.
        if (! $lockedOut) {
            $this->incrementLoginAttempts($request);
        }

        return $this->sendFailedLoginResponse($request);
    }
1138168
public function login(AuthenticationRequest $request)
    {
        // Prepare variables
        $loginField = get_login_field($request->input($this->username()));
        $credentials = [
            'is_active' => true,
            $loginField => $request->input('loginfield'),
            'password' => $request->input('password'),
        ];

        // If the class is using the ThrottlesLogins trait, we can automatically throttle
        // the login attempts for this application. We'll key this by the username and
        // the IP address of the client making these requests into this application.
        if ($this->hasTooManyLoginAttempts($request)) {
            $this->fireLockoutEvent($request);

            return $this->sendLockoutResponse($request);
        }

        if (auth()->guard($this->getGuard())->attempt($credentials, $request->filled('remember'))) {
            return $this->sendLoginResponse($request);
        }

        // If the login attempt was unsuccessful we will increment the number of attempts
        // to login and redirect the user back to the login form. Of course, when this
        // user surpasses their maximum number of attempts they will get locked out.
        $this->incrementLoginAttempts($request);

        return $this->sendFailedLoginResponse($request);
    }
1017653
public function start(Request $request, AuthenticationException $authException = null)
    {
        return new RedirectResponse($this->createLoginPath($request));
    }
118315
public function requestAction(Request $request)
    {
        $form = $this
            ->createForm(new UserForgotPassType())
            ->handleRequest($request)
        ;

        $obj = $form->getData();

        $user = $this->getDoctrine()->getRepository('FOMUserBundle:User')->findOneByUsername($obj['search']);
        if ($user === null) {
            $user = $this->getDoctrine()->getRepository('FOMUserBundle:User')->findOneByEmail($obj['search']);
        }

        if (!$user) {
            $form->addError(new FormError($this->get("templating")->render(
                'FOMUserBundle:Password:request-error-nosuchuser.html.twig',
                array("search" => $obj))));
            return array('form' => $form->createView());
        } elseif ($user->getRegistrationToken()) {
            $form->addError(new FormError($this->get("templating")->render(
                'FOMUserBundle:Password:request-error-userinactive.html.twig', array("user" => $user))));
            return array(
                'user' => $user,
                'form' => $form->createView());
        }

        $this->setResetToken($user);

        return $this->redirect($this->generateUrl('fom_user_password_send'));
    }
1028032
public function postRemind(Request $request)
    {

        $form = FormBuilder::create('Distilleries\Expendable\Http\Forms\Login\Forgotten');
        if ($form->hasError())
        {
            return $form->validateAndRedirectBack();
        }

        $this->validate($request, ['email' => 'required|email']);
        
        $response = $this->broker()->sendResetLink($request->only('email'));

        switch ($response)
        {
            case \Password::RESET_LINK_SENT:
                return redirect()->back()->with(Message::MESSAGE, [trans($response)]);
            default:
                return redirect()->back()->with(Message::WARNING, [trans($response)]);
        }

    }
85067
protected function logout(Request $request)
    {
        impersonate()->logout();

        // if redirect url in request
        if ($request->has('redirect_to')) {
            return redirect($request->get('redirect_to'));
        }

        return back();
    }