1

I'm using Django-allauth in my project, coupled with Django-sesame from login, which sends links by emails for users to login without the password.

However, Django-sesame does not handle signups. I am trying to remove the password fields from the signup form, since passwords are not used for login. I only want users to have to input their email addresses.

Here's what I've got:

FORMS.PY    
class CustomUserCreationForm(UserCreationForm):
            class Meta(UserCreationForm.Meta):
                model = CustomUser
                fields = ('username', 'email',)

MODELS.PY
class CustomUser(AbstractUser):
    # Add additional fields here. For example, a global-friendly name field
    # name = models.CharField(blank=True, max_length=255)

    def __str__(self):
        return self.email

This code works, but I've tried everything found on the internet and I've not been able to remove the passwords fields. For what it's worth, I would be okay with putting a dummy password for every user, and hide the field, since users must log in through the token email auth.

Thank you!

Ofir Lana
  • 383
  • 5
  • 13
Mars
  • 11
  • 2

1 Answers1

0

Came here with same question. Solved it with popping (found hint in this question):

class MyCustomSignupForm(SignupForm):
    def __init__(self, *args, **kwargs):
        super(MyCustomSignupForm, self).__init__(*args, **kwargs)
        self.fields.pop('password1')
        self.fields.pop('password2')
Denis
  • 940
  • 12
  • 16