mardi 27 novembre 2018

Laravel 5.7 production -> Login POST error

i use in local development

-> php 7.2 -> laravel 5.7 -> Apache

and my project works successfully but in production

-> php 7.2 -> laravel 5.7 -> Nginx

in my project, login GET METHOD works, but login POST METHOD not work, when i submit page is only refreshed. other POST METHODS work. but only Login POST METHOD NOT WORK. How can i solve my problem?

my LoginController

class LoginController extends Controller
{
    use AuthenticatesUsers;

    protected $maxAttempts = 3;
    protected $decayMinutes = 10;


    protected function redirectTo()
    {
        return route('admin.dashboard');
    }


    protected function validateLogin(Request $request)
    {
        $this->validate($request, [
            $this->username() => 'required|string|exists:users,' . $this->username() . ',active,1',
            'password' => 'required|string',
        ], [
            $this->username() . '.exists' => 'wrong username or not active user.'
        ]);
    }


    public function attemptLogin(Request $request)
    {
        if (Auth::attempt(
            [
                'username' => $request->username,
                'password' => $request->password
            ]
        )) {
            // Authentication passed...
            return redirect()->intended('admin.dashboard');
        }
    }


    public function __construct()
    {
        $this->middleware('guest')->except('logout');
    }
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire