问题
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