Skip to content

Commit

Permalink
fix registration
Browse files Browse the repository at this point in the history
  • Loading branch information
BenediktMKuehne committed Oct 25, 2024
1 parent a0b2dd5 commit e36386e
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions embark/users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,11 @@ def register(request):
signup_form = SignUpForm(data=request.POST)
if signup_form.is_valid():
username = signup_form.cleaned_data.get('username')
password = signup_form.cleaned_data.get('password')
password = signup_form.cleaned_data.get('password2')
email = signup_form.cleaned_data.get('email')
logger.debug('Passwords match. Creating user')
user = User.objects.create(username=username, email=email)
user.set_password(password)
user.is_active = False
# user.is_active = True
user.save()
logger.debug('User created')
token = default_token_generator.make_token(user)
Expand Down Expand Up @@ -87,7 +85,7 @@ def register(request):
def embark_login(request):
if request.method == "POST":
try:
login_form = LoginForm(request, request.POST)
login_form = LoginForm(request=request, data=request.POST)
logger.debug(login_form)
if login_form.is_valid():
logger.debug('form valid')
Expand All @@ -107,8 +105,7 @@ def embark_login(request):
except builtins.Exception as error:
logger.exception('Wide exception in Signup: %s', error)
messages.error(request, 'Something went wrong when logging in the user.')
else:
login_form = LoginForm()
login_form = LoginForm()
return render(request, 'user/login.html', {'form': login_form})


Expand Down

0 comments on commit e36386e

Please sign in to comment.