我正在使用Django djangorestframework-jwt
,这是我的models.py
用于创建用户
class UserManager(BaseUserManager):
def create_user(self, username, email, password=None):
if username is None:
raise TypeError('Users must have a username.')
if email is None:
raise TypeError('Users must have an email address.')
user = self.model(username=username, email=self.normalize_email(email))
user.set_password(password)
user.save()
return user
我想先发送电子邮件验证,然后再生成令牌..最简单的方法是什么?