dimanche 21 octobre 2018

Laravel 5.6: Login using two passwords

I am using the laravel´s default auth. I want to the users to use two passwords. I would like to add a new password so the user has to use two .This is my login controller:

public function postLogin(LoginRequest $request) {
    $usuario=User::where("username",strtoupper($request->username))->with('rolesuser.rol')->first();

    $data["username"] = strtoupper($request->username);
    $data["password"] = $request->password;

    if ($usuario != null) {
        // dd($usuario->estatus);
        if(!$usuario->estatus){
            return redirect()->back()->withInput()->withErrors(['login' => 'Usuario Inactivo']);
        }
        if(!$usuario->rolesuser[0]->rol->estatus){
            return redirect()->back()->withInput()->withErrors(['login' => 'Perfil Inactivo']);
        }
        if (\Auth::attempt($data)) {
           ;
            return redirect('home');
        }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire