This commit is contained in:
Martin Quarda 2024-10-17 16:07:03 +02:00
parent 4f98c97880
commit 5e6baf64c3

View File

@ -85,7 +85,7 @@ def forgotten_password(request):
user = DjangoUser.objects.get(username=request.POST['email'])
except DjangoUser.DoesNotExist:
return HttpResponse('{"reason":"Účet nenalezen!"}', status=404, content_type='application/json')
if user.profile.forgotten_password_code != request.POST['code']:
if user.profile.forgotten_password_code != request.POST['code'].strip():
return HttpResponse('{"reason":"Špatný kód!"}', status=400, content_type='application/json')
user.set_password(request.POST['password1'])
user.save()
@ -117,7 +117,7 @@ Na tento email není třeba odpovídat, protože je generován automaticky. V p
ALKÁTOR TEAM
email: info@alkator.cz
tel: + 420 728 018 088
web: https://alkator.cz""", "info@alkator.cz", [request.POST["email"]])
web: https://alkator.cz""", "info@alkator.cz", [email])
mail.send()
return HttpResponse('{"success":"Úspěšně poslán kód pro obnovení hesla uživatele '+ user.email + '", "redirect":"/#forgotten_password"}', content_type='application/json')
else: