django-allauth: How to set user to active only after e-mail verification

前端 未结 3 1468
谎友^
谎友^ 2021-02-06 13:12

I\'m using django-allauth primarily as a way to create user accounts for the admin backend. What I would like to have happen is:

1) When a user goes through the sign up

3条回答
  •  野的像风
    2021-02-06 14:06

    I know this is an old post but I came across this thread in my own searches. In reply to your email_confirmed problem, use email=kwargs['email_address'].email in your EmailAddress instance call.

    @receiver(email_confirmed)
    def email_confirmed_(request, *args, **kwargs):
        user = request.user
        new_email_address = EmailAddress.objects.get(
            email=kwargs['email_address'].email)
        user = User.objects.get(
            email=new_email_address.user)
        user.is_active = True
        user.save()
    

提交回复
热议问题