Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

341
Vistas
Laravel 5.4 - Disable auto login after registration

I need to disable auto login after register an user in laravel 5.4 application. There are enough sources [example] for 5.2 and 5.3 version but it is hard find out a solution for 5.4 version.

In Laravel 5.4 there is no AuthController as it divided to LoginController and RegisterController. Guide me to disable auto login in laravel 5.4.

about 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

Since your RegisterController uses RegistersUsers trait, all of the trait's methods are available to RegisterController. The method you need to override, in order to prevent users to be logged in after they successfully registered is register(). Here's the initial body of the method:

public function register(Request $request)
{
    $this->validator($request->all())->validate();

    event(new Registered($user = $this->create($request->all())));

    $this->guard()->login($user);

    return $this->registered($request, $user)
                    ?: redirect($this->redirectPath());
}

The line: $this->guard()->login($user); is where the user gets logged in. You can either remove it or modify it to suit your needs.

about 4 years ago · Santiago Trujillo Denunciar

0

If you use default register route you can do it like this...

in RegistersUsers.php file

comment this line in register function

$this->guard()->login($user);

I hope this helps you!!

about 4 years ago · Santiago Trujillo Denunciar

0

how it goes about Laravel 6? I try to do the same thing. However, I don't think, rewritting in /vendor/... folder is good practise. I tried to overwrite function "registered", but when I define a protected function registered(...) {...} in my App/http/Controller/Auth/RegisterController.php I receive an error

Argument 1 passed to App\Http\Controllers\Auth\RegisterController::registered() must be an instance of App\Http\Controllers\Auth\Request, instance of Illuminate\Http\Request given, called in C:\wamp\www\presbyteria\vendor\laravel\framework\src\Illuminate\Foundation\Auth\RegistersUsers.php on line 35
about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda