Laravel remember that I always find myself

I am using Laravel 4.2 and I want users to decide if they want their login to be remembered on their PC or not. So my login form looks like this:

enter image description here

When you check the box, the message fields will have 'remember_me' => 'on'

. The form submits a named route sessions.store

, which is processed as follows:

public function store()
{
    // Capture input data
    $input = Input::only('email', 'password');

    // Validate input
    $this->loginForm->validate($input);

    // Login user
    if (Auth::attempt($input, (Input::get('remember_me') == 'on')))
        return Redirect::intended('/');

    // Login error
    return Redirect::back()->withInput()->withFlashError('Invalid portal account credentials provided');
}

      

For some reason laravel forces the user to log in (i.e. you close the browser completely and reopen it and you don't need to log in, you are already logged in) even if they haven't checked that box.

Any idea why this might be?


Update

This is my session /create.blade.php : http://pastebin.com/raw.php?i=MbrLgg6Y

This is my javascript checkbox helper : http://pastebin.com/raw.php?i=R8mNrj3s

+3


source to share


2 answers


Try changing expire_on_close

to true

v config/session.php

. Laravel should clear the session when the browser is closed.



+2


source


Do you remember me, is this a flag? It looks like part of the submit button in the screenshot, so you can fire it independently.



The easiest way to say is to put dd(Input::get('remember_me'))

in your controller and see if you have everything 'on' when you have not checked the checkbox.

0


source







All Articles