User authentication with mobile number and OTP in Django 1.7

走远了吗. 提交于 2019-12-13 00:42:07

问题


I have two types of users. - Customer. - Vendor. For Customers, I've already created custom user class where login happens through email and password. But, Vendors do not have email id and password. All vendor accounts are manually created by the django admin. Vendor class looks like this.

class Vendor():
    phone = models.CharField(max_length=12, unique=True, required=True)
    name = models.CharField()
    .
    . 

What's the best way to implement OTP login for Vendors? Vendors usually login through an android/iOS app which communicates with the server using REST apis. Currently, I've created one more model to store 6 digit OTP password. Vendor enters his mobile no, he gets the OTP through SMS. Once he enters it I'm matching it with stored OTP key from the OTP table and sending success status. But ideally, I've to create an user session and send it along with success status. Is there any plugin in Django to do this?

来源:https://stackoverflow.com/questions/29407609/user-authentication-with-mobile-number-and-otp-in-django-1-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!