Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for custom user model, and especially USERNAME_FIELD #39

Closed
ghedsouza opened this issue Apr 8, 2014 · 2 comments
Closed

Support for custom user model, and especially USERNAME_FIELD #39

ghedsouza opened this issue Apr 8, 2014 · 2 comments
Milestone

Comments

@ghedsouza
Copy link

How feasible would it be to support a custom user model? At least one thing that would have to be updated is that all references to user.username, for example:

https://github.com/Bouke/django-two-factor-auth/blob/d113b80c220bcf62b25d252d5980f02420c8c270/two_factor/views/core.py#L444

would have to be updated to use the USERNAME_FIELD (https://docs.djangoproject.com/en/dev/topics/auth/customizing/#django.contrib.auth.models.CustomUser.USERNAME_FIELD) setting on the user model (for cases where, for example, USERNAME_FIELD=email and there is no "username" attribute).

@Bouke Bouke added the question label Apr 8, 2014
@Bouke
Copy link
Collaborator

Bouke commented Apr 8, 2014

Hi @ghedsouza, thanks for your question. I don't think it should be very hard to support custom user models. I think that django-otp (dependency) also supports custom user models, looking at the code. I think it would be a nice feature to add. Would you care to contribute this feature to this package?

@Bouke Bouke added enhancement and removed question labels Apr 8, 2014
@ghedsouza
Copy link
Author

@Bouke Sounds good. I'll attempt a fix.

@Bouke Bouke closed this as completed in a6eefed May 1, 2014
@Bouke Bouke added this to the 1.0.0 milestone May 22, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants