On Oct 26, 9:00 pm, newb <[EMAIL PROTECTED]> wrote: > I have a page that users can view without being logged in. It has a > form on it with several inputs. But I want users to be logged in > before I accept & save this form information. If users aren't logged > in, I redirect to the login screen using create_login_url() but I lose > the form data they were submitting in the process. Is there a > recommended best practice to handle this?
Here is an idea: 1. Create a unique ID for your page and embed it in a form as a hidden input. 2. In your event handler for the form, persist that ID and any additional information, then redirect to the login page. You can persist to Memcache or a cookie; you don't want to persist this to the Datastore because until the user logs on this is still throw-away data. 3. Upon successful login and redirection back to your page/event handler, check if Memcache has a copy of the data keyed on the page ID, recover it, and continue processing as desired. That's one way of doing it; another one might be to use a cookie with a 24-hour (or one hour, or six, or any other sensible value) expiration. Your handlers check for this cookie before processing input and react accordingly. Of the two, I like Memcache better but either will work and give you a level of "ephimeral persistence" required for completing this action. Cheers, pr3d4t0r http://www.internet.lu http://www.teslatestament.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---
