I try to keep things as simple as possible. So having said that…

why not just have them login before they fill out the form?

You could have conditionals or whatever that redirects them to the login page. When they login you then have a workflow that takes them to the previous page.

Simple and doesn’t involve a lot of complicated maneuvering.