Skip to content

Fix/allow_registration_without_email_confirmation #103

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

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Changelog for Rest-Framework-Auth-Toolkit

## v0.11 (unreleased)


## v0.10

Expand Down
24 changes: 12 additions & 12 deletions demo/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# pip-compile requirements.in
#
certifi==2018.11.29 # via requests
certifi==2019.3.9 # via requests
chardet==3.0.4 # via requests
click==7.0 # via pip-tools
coreapi==2.3.3
Expand All @@ -13,19 +13,19 @@ dj-database-url==0.5.0
django-debug-toolbar==1.11
django-model-utils==3.1.2
django-shortuuidfield==0.1.3
django==2.1.7
djangorestframework==3.9.1
facepy==1.0.9
django==2.1.11
djangorestframework==3.9.4
facepy==1.0.10
idna==2.8 # via requests
itypes==1.1.0 # via coreapi
jinja2==2.10 # via coreschema
jinja2==2.10.1 # via coreschema
markupsafe==1.1.1 # via jinja2
pip-tools==3.4.0
psycopg2==2.7.7
pytz==2018.9 # via django
requests==2.21.0 # via coreapi
pip-tools==3.6.1
psycopg2==2.8.2
pytz==2019.1 # via django
requests==2.21.0 # via coreapi, facepy
shortuuid==0.5.0 # via django-shortuuidfield
six==1.12.0 # via django-shortuuidfield, pip-tools
sqlparse==0.2.4 # via django-debug-toolbar
six==1.12.0 # via django-shortuuidfield, facepy, pip-tools
sqlparse==0.3.0 # via django-debug-toolbar
uritemplate==3.0.0 # via coreapi
urllib3==1.24.1 # via requests
urllib3==1.24.2 # via requests
2 changes: 1 addition & 1 deletion rest_auth_toolkit/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Simple + flexible signup and login for Django APIs"""

__version__ = '0.10'
__version__ = '0.11.dev'

default_app_config = 'rest_auth_toolkit.app.RestAuthToolkitConfig'
5 changes: 4 additions & 1 deletion rest_auth_toolkit/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,15 @@ def post(self, request):
user = deserializer.save()

if self.email_confirmation_class is None:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think line 53 to 56 should go after the if get_setting('email_confirmation_send_email', True):
That way there would be no need to define the email_confirmation_class if the email_confirmation_send_email is set to False.

Other option would be to let is as is and let the programer decide how he wants to validate the emails.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the idea was that you always want a record in your DB (using your email confirmation class), but not always want to send actual email messages.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem is known #38 and has a PR #44

raise MissingSetting('email_confirmation_string')
raise MissingSetting('email_confirmation_class')

confirmation = self.email_confirmation_class.objects.create(user=user)
if get_setting('email_confirmation_send_email', True):
email_field = user.get_email_field_name()
send_email(request, user, getattr(user, email_field), confirmation)
else:
user.is_active = True
user.save()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wouldn’t be right for this class, but see the RestAuthToolkitMinimal app config class that doesn’t do user activation.


return Response(status=status.HTTP_201_CREATED)

Expand Down