Adding additional check that verification key exists, and updating indentation
This commit is contained in:
parent
2c9e8184a4
commit
73fffbb8b0
@ -242,8 +242,10 @@ def verify_forgot_password(request):
|
|||||||
return render_404(request)
|
return render_404(request)
|
||||||
|
|
||||||
# check if we have a real user and correct token
|
# check if we have a real user and correct token
|
||||||
if (user and user['fp_verification_key'] == unicode(session_token) and
|
if ((user and user['fp_verification_key'] and
|
||||||
datetime.datetime.now() < user['fp_token_expire']):
|
user['fp_verification_key'] == unicode(session_token) and
|
||||||
|
datetime.datetime.now() < user['fp_token_expire'])):
|
||||||
|
|
||||||
cp_form = auth_forms.ChangePassForm(session_vars)
|
cp_form = auth_forms.ChangePassForm(session_vars)
|
||||||
|
|
||||||
if request.method == 'POST' and cp_form.validate():
|
if request.method == 'POST' and cp_form.validate():
|
||||||
@ -255,9 +257,11 @@ def verify_forgot_password(request):
|
|||||||
|
|
||||||
return redirect(request, 'mediagoblin.auth.fp_changed_success')
|
return redirect(request, 'mediagoblin.auth.fp_changed_success')
|
||||||
else:
|
else:
|
||||||
return render_to_response(request,
|
return render_to_response(
|
||||||
'mediagoblin/auth/change_fp.html',
|
request,
|
||||||
{'cp_form': cp_form})
|
'mediagoblin/auth/change_fp.html',
|
||||||
|
{'cp_form': cp_form})
|
||||||
|
|
||||||
# in case there is a valid id but no user whit that id in the db
|
# in case there is a valid id but no user whit that id in the db
|
||||||
# or the token expired
|
# or the token expired
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user