| Secure Login from a Non-Secure URL Without Reloading Page |
| Websites |
| Sunday, 19 September 2010 21:55 |
|
I recently needed to create a login modal that would allow a user to login without reloading the page. In addition, the login modal needed to be displayed on a non-secure page, but the form needed to be submitted over a secure connection. Here is how I accomplished it.
That's the rough idea anyway. Of course I polished the solution quite a bit, but I want to keep this example simple. The only important addition I'd like to mention is that instead of putting custom code in handleLogin, I chose to create a custom event (I used YUI 2 for this) called "login" which I fire within this function. This way you can react to this event in custom ways on each page of your site as needed. Anyone else know of a better way to handle this situation? I would love to hear your ideas. |