From a63bbc451a937a981dc6913ab05cb0242cadc8be Mon Sep 17 00:00:00 2001 From: Ben Adida <ben@adida.net> Date: Thu, 7 Oct 2010 09:47:30 -0700 Subject: [PATCH] added check for bad username in password forgotten page (also of note, this checkin done from IHOP) --- auth/auth_systems/password.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/auth/auth_systems/password.py b/auth/auth_systems/password.py index d6b7e95..83fbfae 100644 --- a/auth/auth_systems/password.py +++ b/auth/auth_systems/password.py @@ -79,7 +79,10 @@ def password_forgotten_view(request): username = request.POST['username'] return_url = request.POST['return_url'] - user = User.get_by_type_and_id('password', username) + try: + user = User.get_by_type_and_id('password', username) + except User.DoesNotExist: + return render_template(request, 'password/forgot', {'return_url': request.GET.get('return_url', ''), 'error': 'no such username'}) body = """ -- GitLab