Skip to content
Snippets Groups Projects
Commit 703e48cb authored by salazard's avatar salazard
Browse files

fix email verification

parent 11afdd6e
Branches
No related tags found
1 merge request!61Verification mail
...@@ -254,6 +254,7 @@ EMAIL_HOST_USER = 'apikey' ...@@ -254,6 +254,7 @@ EMAIL_HOST_USER = 'apikey'
EMAIL_HOST_PASSWORD = SENDGRID_API_KEY EMAIL_HOST_PASSWORD = SENDGRID_API_KEY
EMAIL_PORT = 587 EMAIL_PORT = 587
EMAIL_USE_TLS = True EMAIL_USE_TLS = True
LOGIN_URL = os.getenv('LOGIN_URL')
# Toggle sandbox mode (when running in DEBUG mode) # Toggle sandbox mode (when running in DEBUG mode)
SENDGRID_SANDBOX_MODE_IN_DEBUG = False SENDGRID_SANDBOX_MODE_IN_DEBUG = False
...@@ -298,3 +299,5 @@ TELEGRAM = { ...@@ -298,3 +299,5 @@ TELEGRAM = {
'channel_name': 'oserSECGEN', 'channel_name': 'oserSECGEN',
'production': False, 'production': False,
} }
VERIFICATION_SUCCESS_TEMPLATE = None
...@@ -19,15 +19,10 @@ registration_created = Signal( ...@@ -19,15 +19,10 @@ registration_created = Signal(
def create_user_and_student(sender, instance: Registration, request, validated_data, def create_user_and_student(sender, instance: Registration, request, validated_data,
password: str, **kwargs): password: str, **kwargs):
"""Create a user and student after on a registration_created signal.""" """Create a user and student after on a registration_created signal."""
# user = User.objects.create_user(
# email=instance.email, validated_data['password1'] = password
# password=password, validated_data['password2'] = password
# first_name=instance.first_name,
# last_name=instance.last_name,
# phone_number=instance.phone_number,
# is_active=False,
# )
validated_data['password'] = password
form = UserForm(validated_data) form = UserForm(validated_data)
if form.is_valid(): if form.is_valid():
user = send_verification_email( user = send_verification_email(
......
from django.forms import ModelForm, TextInput, EmailInput from django.forms import ModelForm, TextInput, EmailInput
from .models import User from .models import User
from users.models import User from django.contrib.auth.forms import UserCreationForm
class UserForm(ModelForm): class UserForm(UserCreationForm):
class Meta: class Meta(UserCreationForm.Meta):
model = User model = User
fields = ["email", "password", "first_name", fields = ["email", "first_name",
"last_name", "phone_number"] "last_name", "phone_number"]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment