whitespaces....

This commit is contained in:
Jan Boysen 2025-11-23 18:38:58 +01:00
parent a57ffcdfd7
commit 2ad895ae1b

View File

@ -40,7 +40,7 @@ class PlayerCreateView(LoginRequiredMixin, HeadCoachCheckMixin, CreateView):
player.set_unusable_password() # Password must be set via verification
player.verification_code = uuid.uuid4()
player.save()
# Send verification email to player
send_verification_email(player, self.request, is_parent=False)
@ -70,7 +70,7 @@ class PlayerCreateView(LoginRequiredMixin, HeadCoachCheckMixin, CreateView):
elif new_email:
parent_user, created = CustomUser.objects.get_or_create(
email=new_email,
email=new_email,
defaults={'username': new_email, 'is_active': False}
)
if created:
@ -102,28 +102,28 @@ def user_search(request):
def verify_account(request, verification_code):
user = get_object_or_404(CustomUser, verification_code=verification_code, is_verified=False)
# Determine if user is a parent (has no team) or player
is_parent = user.team is None
FormClass = ParentVerificationForm if is_parent else PlayerVerificationForm
if request.method == 'POST':
form = FormClass(request.POST)
if form.is_valid():
user.set_password(form.cleaned_data['password'])
if is_parent:
user.username = form.cleaned_data['username']
user.is_active = True
user.is_verified = True
user.verification_code = None # Invalidate the code
user.save()
login(request, user) # Log the user in
messages.success(request, 'Your account has been verified! You are now logged in.')
return redirect('dashboard')
else:
form = FormClass()
return render(request, 'accounts/verify_account.html', {'form': form, 'is_parent': is_parent})
return render(request, 'accounts/verify_account.html', {'form': form, 'is_parent': is_parent})