Support the ongoing development of Laravel.io →
Input Session Forms
Last updated 1 year ago.
0

I just implemented something similar in a project I am working on.

Our solution is to have a post route without an auth filter that validates the data so we can redirect back with errors (if failed) before showing the login form. If the validation is successful, we put the data from the form into a session attribute then redirect to the login form.

After the user logs in, we check for this session attribute. If it exists, we redirect them to the next stage (in our case a larger form with some info prefilled, but you could redirect to a route that handles the submission). This next stage route (with auth filter) checks for the existence of the session attribute (so an authenticated can't access the page without having filled in the previous form) then retrieves the data from the session and continues as if the first form was submitted to it.

Typed this out on my iPad so I hope it makes sense.

Last updated 1 year ago.
0

Thanks a lot, I also thought that was the only way to achieve this !

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

JonathanWi jonathanwi Joined 31 Mar 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.