public function postLogin()
    {
        $loginData = Binput::only(['username', 'password', 'remember_me']);

        // Login with username or email.
        $loginKey = filter_var($loginData['username'], FILTER_VALIDATE_EMAIL) ? 'email' : 'username';
        $loginData[$loginKey] = Arr::pull($loginData, 'username');

        $rememberUser = Arr::pull($loginData, 'remember_me') === '1';

        // Validate login credentials.
        if (Auth::validate($loginData)) {
            Auth::once($loginData);

            if (Auth::user()->hasTwoFactor) {
                Session::put('2fa_id', Auth::user()->id);

                return cachet_redirect('auth.two-factor');
            }

            Auth::attempt($loginData, $rememberUser);

            event(new UserLoggedInEvent(Auth::user()));

            return Redirect::intended(cachet_route('dashboard'));
        }

        return cachet_redirect('auth.login')
            ->withInput(Binput::except('password'))
            ->withError(trans('forms.login.invalid'));
    }
public function postLogin()
    {
        $loginData = Binput::only(['username', 'password', 'remember_me']);

        // Login with username or email.
        $loginKey = filter_var($loginData['username'], FILTER_VALIDATE_EMAIL) ? 'email' : 'username';
        $loginData[$loginKey] = Arr::pull($loginData, 'username');

        $rememberUser = Arr::pull($loginData, 'remember_me') === '1';

        // Validate login credentials.
        if (Auth::validate($loginData)) {
            Auth::once($loginData);

            if (Auth::user()->hasTwoFactor) {
                Session::put('2fa_id', Auth::user()->id);

                return cachet_redirect('auth.two-factor');
            }

            Auth::attempt($loginData, $rememberUser);

            event(new UserLoggedInEvent(Auth::user()));

            return Redirect::intended(cachet_route('dashboard'));
        }

        return cachet_redirect('auth.login')
            ->withInput(Binput::except('password'))
            ->withError(trans('forms.login.invalid'));
    }
public function postLogin ( ) { $ loginData = Binput :: only ( [ 'username' , 'password' , 'remember_me' ] ) ; // Login with username or email. $ loginKey = filter_var ( $ loginData [ 'username' ] , FILTER_VALIDATE_EMAIL ) ? 'email' : 'username' ; $ loginData [ $ loginKey ] = Arr :: pull ( $ loginData , 'username' ) ; $ rememberUser = Arr :: pull ( $ loginData , 'remember_me' ) === '1' ; // Validate login credentials. if ( Auth :: validate ( $ loginData ) ) { Auth :: once ( $ loginData ) ; if ( Auth :: user ( ) -> hasTwoFactor ) { Session :: put ( '2fa_id' , Auth :: user ( ) -> id ) ; return cachet_redirect ( 'auth.two-factor' ) ; } Auth :: attempt ( $ loginData , $ rememberUser ) ; event ( new UserLoggedInEvent ( Auth :: user ( ) ) ) ; return Redirect :: intended ( cachet_route ( 'dashboard' ) ) ; } return cachet_redirect ( 'auth.login' ) -> withInput ( Binput :: except ( 'password' ) ) -> withError ( trans ( 'forms.login.invalid' ) ) ; }
Logs the user in.

@return \Illuminate\Http\RedirectResponse
Logs the user in .