Saturday, January 5, 2019

Re: Login with email or phone not username

Hi,
i think you can add a if condition in your view.py , stating if the username matches to a regular expression for mobile or email.
if the regular expression matches the email you can go ahead calling the user authenticate method and pass the email. But if the regular expression matches for mobile than try to write another function to query using mobile number. You need to have a mobile number field in your model. 
I am not sure how we can query the user model with another field and password to authenticate a user. Anyways if you find something better do update us in this thread.

thanks and regards
Kaushik Kr Roy
 

On Sun, 6 Jan 2019 at 07:39, Achyut Pandey <anjan.sarathi328@gmail.com> wrote:
Boxbe This message is eligible for Automatic Cleanup! (anjan.sarathi328@gmail.com) Add cleanup rule | More info

Hello guys i want to allow user to register and login with their email or phone number instead of username . How can i do that i am extending user model with abstractuser.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/A50B7F88-AAE8-4A9C-AEF9-A27649F3D643%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


--
----------------------
Kauhsik Kr Roy

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAOAwuoJ4SLiQ9yuFvAV-U7D6X2jpr09Hc4h-pmGLOJm_f8Vw%2Bg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment