Django Rest框架发送电子邮件验证

时间:2018-07-25 17:27:00

标签: python django django-rest-framework

我正在使用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

我想先发送电子邮件验证,然后再生成令牌..最简单的方法是什么?

0 个答案:

没有答案