mercredi 3 février 2016

need help AuthController laravel

function postLogin following:

public function postLogin(Request $request) {
        $this->validate($request, [
            'email' => 'required|email', 'password' => 'required',
        ]);
        $credentials = $this->getCredentials($request);       

if (Auth::attempt(['email' => $request['email'], 'password' => $request['password']])){
$permit = DB::table('users')
                ->select('permit')->where('email' ,'=', $request['email'])->first();
            $permit = $permit->permit;
            $user_id = DB::table('users')
                ->select('user_id')->where('email' ,'=', $request['email'])->first();
            $user_id = $user_id->user_id;
            Session::flush();
            Session::push('permit', $permit);
            Session::push('user_id', $user_id);
            return redirect()->intended('/home')->
                withInput()->with('message', 'Login successful');
        }


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

When password, email incorrect will be show error invalid.But when email, password correct, nothing happen.Not redirect, not show error?Something wrong stay here.If Auth::attempt has

$request->has('remember') It's will be working, so why?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire