Implementing Ajax requests / response with django-allauth

前端 未结 1 1789
北恋
北恋 2020-12-08 23:07

I am using django-allauth for one of my project. I would like to implement login/signup process via ajax. I would like to have customized signup form. I was going through th

相关标签:
1条回答
  • 2020-12-08 23:32

    It depends a bit on what you mean by ajax. If you just want to have a popup-style login/signup box on every page, then you can simply add the form to your base template and show it dynamically using Javascript in a popup box or so. If you keep the form action url to the original allauth urls then this will already give the feel of an ajax signin. You could also tweak things by using $.ajax or $.post to post to the original allauth views.

    Something like the above is done on http://officecheese.com/ -- this is an allauth based site, though I am not affiliated with it.

    If by ajax you mean that all authentication related views should be displayed via ajax, without causing a new document reload, then I am afraid you are a little bit out of luck. This simply is problematic for scenario's where e-mail verification, or OAuth handshakes are involed, as here you are typically navigating to a new URL from your mailbox, or redirecting to Twitter and so on.

    0 讨论(0)
提交回复
热议问题