request.session[SESSION_KEY] = user._meta.pk.value_to_string(user) request.session[HASH_SESSION_KEY] = session_auth_hash if hasattr(user, 'backend'): request.session[BACKEND_SESSION_KEY] = user.backend
django.contrib.auth.get_user
If the backend is not set iterate over all the backends in `settings.AUTHENTICATION_BACKENDS` and return the first found.
I can think in two drawbacks of this implementation but as far as my knowledge goes neither of them is a big deal.
- Performance, in the worst case we are trying all the backends this can take some time depending on the backend provider.
- Two backends can share the same user identifier and thus we will be using the first declared in the settings.
What do you guys think?
Thanks,Paulo Poiati.class RegistrationView(CreateView): ... def form_valid(self, form): user = form.save() login(self.request, user) # redirect
I don't have the user password because it's an one way hash and thus I can't call `authenticate`. The only solution I can think is hacking the auth system (setting the backend manually in the user model).--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/fbbd5579-a5e9-4370-8943-75204f334016%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CABqSV%3D%2B5Vr%2B-JC2_yXdzwUpj9Y%2B1XwNOKf3_Fhc5h%3Dw4kuK%2BpQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAFryp_hqF4i0rmTs0Ow5DK3tKRCb%3DAU8-HV_Qa2fBtXLZDTpWw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CABqSV%3D%2B%2BJOQCUT_3YUNXVu6PgQDY-PgTks_zKsKavJKg_KjKUw%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/555F63F8.3070007%40oddbird.net.
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/555F8C7A.4010507%40oddbird.net.
If the backend is inferred by a single value in the settings and not stored alongside the user ID, what would happen to existing users who are already logged in when a second backend is added to the settings and deployed? Django would no longer know which backend to use to fetch the authenticated user?
Cheers.Tai.
On Saturday, May 23, 2015 at 6:58:35 AM UTC+10, Unai Zalakain wrote:Hi Paulo!
>If the application has only one backend we always infer it in the login
>function. If it isn't, the client needs to provide one explicitly.
Why not pass the single auth backend into the login function? It makes
the design and the documentation much simpler.
--
unai
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/0319a35d-b870-4edd-8805-a2707a8b0f58%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/5560C91C.3080007%40oddbird.net.