Log the user in

@param Login $request

@return mixed
325880
public function handleLogin(Login $request)
    {
        // Set the auth data
        $userData = [
            'username' => $request->get('username'),
            'password' => $request->get('password'),
        ];

        // Log in successful
        if (auth()->attempt($userData, $request->get('remember', false))) {
            event(new UserLoggedIn(auth()->user()));

            return redirect()
                ->intended(route('home'))
                ->with('message', 'You have been logged in.');
        }

        // Login failed
        return redirect(route('auth.login'))
            ->with('errors', ['Your username or password was incorrect.']);
    }
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')]);
        }

    }
866865
public function getUser(Request $request)
    {
        if (!empty($this->_config['header'])) {
            $token = $request->header($this->_config['header']);
            if ($token) {
                return $this->_findUser($token);
            }
        }
        if (!empty($this->_config['parameter']) &&
            !empty($request->query[$this->_config['parameter']])
        ) {
            $token = $request->query[$this->_config['parameter']];
            return $this->_findUser($token);
        }
        return false;
    }
846650
protected function _cookieLogin(Request $request)
    {
        $controller = $this->_registry->getController();
        if (empty($controller->Cookie)) {
            $controller->loadComponent('Cookie');
        }

        $cookie = $controller->Cookie->read('User.Cookie');
        if ($cookie) {
            $cookie = json_decode($cookie, true);
            if (isset($cookie['user']) &&
                isset($cookie['hash']) &&
                $cookie['hash'] == Security::hash($cookie['user'], 'sha1', true)
            ) {
                $cookie['user'] = json_decode($cookie['user'], true);
                $user = $this->_findUser($cookie['user']['username']);
                if (!empty($user) && is_array($user)) {
                    if (isset($user['password'])) {
                        unset($user['password']);
                    }
                    $controller->Auth->setUser($user);

                    return true;
                }
            }
        }

        $cacheKey = 'permissions_anonymous';
        $permissions = Cache::read($cacheKey, 'permissions');
        $action = $this->action($request);

        if ($permissions === false) {
            $permissions = $this->_rolePermissions(ROLE_ID_ANONYMOUS);
            Cache::write($cacheKey, $permissions, 'permissions');
        }

        if (isset($permissions[$action])) {
            return true;
        }

        return false;
    }
1134308
protected function _buildLoginUrlErrorResult($request)
    {
        $errors = [
            sprintf(
                'Login URL `%s` did not match `%s`.',
                (string)$request->getUri(),
                implode('` or `', (array)$this->getConfig('loginUrl'))
            )
        ];

        return new Result(null, Result::FAILURE_OTHER, $errors);
    }
989008
public function postLogin(Request $request)
    {
        $this->validate($request, [
            'user'      => 'required',
            'password'  => 'required',
        ]);

        $credentials = $request->only('user', 'password');

        if(auth()->guard('pulsar')->attempt($credentials, $request->has('remember')))
        {
            // check if user has access
            if(!auth()->guard('pulsar')->user()->access_010)
            {
                auth()->guard('pulsar')->logout();
                return redirect($this->loginPath)
                    ->withInput($request->only('user', 'remember'))
                    ->withErrors([
                        'loginErrors' => 3
                    ]);
            }

            // set user access control list
            session(['userAcl' => AclLibrary::getProfileAcl(auth()->guard('pulsar')->user()->profile_id_010)]);

            // check if user has permission to access
            if (!is_allowed('pulsar', 'access'))
            {
                auth()->guard('pulsar')->logout();
                return redirect($this->loginPath)
                    ->withInput($request->only('user', 'remember'))
                    ->withErrors([
                        'loginErrors' => 2
                    ]);
            }

            session(['packages' => Package::getRecords(['active_012' => true, 'orderBy' => ['column' => 'sorting_012', 'order' => 'desc']])]);
            session(['baseLang' => Lang::getBaseLang()]);

            return redirect()->intended($this->redirectTo);
        }

        return redirect($this->loginPath)
            ->withInput($request->only('user', 'remember'))
            ->withErrors([
                'loginErrors' => 1
            ]);
    }
203369
public function getAuthenticatedUser(Request $request)
    {
        foreach ($this->authentications as $authentication) {
            if (null !== $user = $authentication->getAuthenticatedUser($request)) {
                return $user;
            }
        }

        return null;
    }
1316464
public function passwordAction(Request $request)
    {
        $token = $this->get('request_stack')->getCurrentRequest()->get('token');
        if (!$token) {
            return $this->render('FOMUserBundle:Login:error-notoken.html.twig');
        }

        $user = $this->getDoctrine()->getRepository("FOMUserBundle:User")->findOneByResetToken($token);
        if (!$user) {
            $mail = $this->container->getParameter('fom_user.mail_from_address');
            return $this->render('FOMUserBundle:Login:error-notoken.html.twig', array(
                'site_email' => $mail));
        }

        $max_token_age = $this->container->getParameter("fom_user.max_reset_time");
        if (!$this->checkTimeInterval($user->getResetTime(), $max_token_age)) {
            $form = $this->createForm('form');
            return $this->render('FOMUserBundle:Login:error-tokenexpired.html.twig', array(
                'user' => $user,
                'form' => $form->createView()
            ));
        }

        $form = $this->createForm(new UserResetPassType(), $user)->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $user->setResetToken(null);

            $helper = new UserHelper($this->container);
            $helper->setPassword($user, $user->getPassword());

            $em->flush();

            return $this->redirect($this->generateUrl('fom_user_password_done'));
        }

        return array(
            'user' => $user,
            'form' => $form->createView());
    }
1069460
public function loginAction(Request $request)
    {
        if ($this->isGranted(AuthenticatedVoter::IS_AUTHENTICATED_REMEMBERED)) {
            return $this->redirectToRoute($this->getParameter('darvin_user.already_logged_in_redirect_route'));
        }

        return new Response($this->getSecurityFormRenderer()->renderLoginForm($request->isXmlHttpRequest()));
    }
992678
public function login(Request $request)
    {
        $this->validate($request, [
            $this->username() => 'required|string|email|max:240',
            'password'        => 'required|string|min:4|max:240',
        ]);

        // 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);
        }

        // make sure the account has been activated
        if (!User::where($this->username(), input($this->username()))
            ->whereNotNull('confirmed_at')
            ->first()) {
            $this->logLogin($request, 'inactive');

            return $this->sendFailedLoginResponse($request,
                'Please activate your account before trying to login.');
        }

        // try to login
        if (Auth::attempt($request->only([$this->username(), 'password']),
            input('remember', false))) {
            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);

        $this->logLogin($request, 'invalid');

        return $this->sendFailedLoginResponse($request);
    }
1254276
public function getLogout(Request $request)
    {
        // Terminate the user's current session.  Passing true as the
        // second parameter kills all of the user's active sessions.
        $result = $this->authManager->logout(null, null);

        // Return the appropriate response
        return $result->dispatch(route('dashboard'));
    }
861576
protected function logRequest(Request $request)
    {
        $this->logger->log(LogLevel::DEBUG, '> '.$request->getMethod().' '.$request->getRequestUri());
    }
219089
private function authBasic(Request $request) {
		$user = $this->findUser($request->getUser());
		if ($user !== null && $this->verifyUser($user, $request->getPassword())) {
			$session = $this->findSession($user);
			if ($session === null) {
				$session = $this->createSession($user);
			}
			$this->authenticated = true;

			return $session;
		}
		return null;
	}
1148175
public function authenticate(Request $request)
    {
        return $request->get('username') === $this->username
            && password_verify($request->get('password'), $this->password);
    }
43985
protected function redirectTo($request)
    {
        session()->put('loginRedir', $_SERVER["REQUEST_URI"]);
        session()->put('loginRedirTime', time());
        if (!$request->expectsJson()) {
            return route('login');
        }
    }
80836
public function loginAction(Request $request)
    {

        if ($this->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
            return $this->redirectToRoute('campaignchain_core_homepage');
        }

        return parent::loginAction($request);
    }
1098013
public function postLogin(Request $request)
    {

        $this->validate($request, ['username' => 'required|min:3|max:255', 'password' => 'required',]);

        $credentials = $request->only('username', 'password');
        $credentials[ 'enabled' ] = 1;

        if (Auth::attempt($credentials, $request->has('remember'))) {
            return redirect()->intended($this->getRedirectUrl());
        } else {
            return redirect(route('login'))->withInput($request->except(['password']))
                                           ->withErrors([$this->getFailedLoginMessage()]);
        }

    }