diff --git a/alkatorapi/views.py b/alkatorapi/views.py index 50f2321..cf7c384 100644 --- a/alkatorapi/views.py +++ b/alkatorapi/views.py @@ -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: