1
votes

I got anoying bug in my laravel 5.0 application. I hardcoded pop-up into my view file and it appears only if session is set. For example:

@if (Session::has('global'))

    POP-UP

@endif

Session with name error is set on post method, like this:

if (Auth::attempt(['email' => $email, 'password' => $password ], $remember))
                    return redirect('/user/user-status');
else 
                    return redirect()->back()->with('global', 'Invalid email or password');

Example:

If i type in wrong password pop-up appears with message invalid username or password. If I type right password appilaction log's me in. The problem is that if I click back ,in my browser, after loging in application will return me to log in page with same pop up. As I understand session does not reset, that's why pop-up appears. Could you suggest me any solution to avoid it? Thanks!

Example 2:

I write a blog post, after successfully creating new blog post pop-up appears YOUR BLOG POST HAS BEEN SUCCESSFULLY CREATED. If i click for exapme Home and after I click back button in my browser same pop-up appears again (becouse last session is still set) YOUR BLOG POST HAS BEEN SUCCESSFULLY CREATED.

1

1 Answers

1
votes

Try this You have to flush session key on successfull login or redirection like this:

Session::forget('global');

For more information click here(same problem with browser backbutton)