Skip to content
This repository has been archived by the owner on Jun 17, 2022. It is now read-only.

Login issue #27

Open
Mohammed2050 opened this issue Apr 2, 2016 · 0 comments
Open

Login issue #27

Mohammed2050 opened this issue Apr 2, 2016 · 0 comments

Comments

@Mohammed2050
Copy link

This make me login as gust user, Why ??
public function postLogin(Request $request)
{
$credentials = $request->only('username', 'password');
if (\Auth::userx()->attempt($credentials)) {
// Authentication passed...
return redirect()->intended($this->redirectPath());
}

    return redirect($this->loginPath())
        ->withInput($request->only('username'))
        ->withErrors([
            'username' => $this->getFailedLoginMessage(),
        ]);
}

public function handle($request, Closure $next)
{
dd($this->auth->guest()); ---> True
if ($this->auth->guest()) {
if ($request->ajax()) {
return response('Unauthorized.', 401);
} else {
return redirect()->guest('auth/login');
}
}

    return $next($request);
}

protected $routeMiddleware = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
];

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant