Skip to content

Commit

Permalink
fix(UX): forget password shows error on wrong email (#19235) (#19240)
Browse files Browse the repository at this point in the history
* fix: forget password shows error on wrong email

* test: expected test failure

[skip ci]

Co-authored-by: Ankush Menat <ankush@frappe.io>
(cherry picked from commit b93022a)

Co-authored-by: Yash Jane <59502942+yjane99@users.noreply.github.com>
  • Loading branch information
mergify[bot] and yjane99 committed Dec 12, 2022
1 parent d648312 commit ac1ca50
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion frappe/core/doctype/user/test_user.py
Expand Up @@ -288,7 +288,7 @@ def test_rate_limiting_for_reset_password(self):
c = FrappeClient(url)
res1 = c.session.post(url, data=data, verify=c.verify, headers=c.headers)
res2 = c.session.post(url, data=data, verify=c.verify, headers=c.headers)
self.assertEqual(res1.status_code, 400)
self.assertEqual(res1.status_code, 404)
self.assertEqual(res2.status_code, 417)

def test_user_rename(self):
Expand Down
2 changes: 1 addition & 1 deletion frappe/core/doctype/user/user.py
Expand Up @@ -891,7 +891,7 @@ def reset_password(user):
title=_("Password Email Sent"),
)
except frappe.DoesNotExistError:
frappe.local.response["http_status_code"] = 400
frappe.local.response["http_status_code"] = 404
frappe.clear_messages()
return "not found"

Expand Down
3 changes: 2 additions & 1 deletion frappe/templates/includes/login/login.js
Expand Up @@ -255,7 +255,8 @@ login.login_handlers = (function () {
}
},
401: get_error_handler('{{ _("Invalid Login. Try again.") }}'),
417: get_error_handler('{{ _("Oops! Something went wrong") }}')
417: get_error_handler('{{ _("Oops! Something went wrong") }}'),
404: get_error_handler('{{ _("User does not exist.")}}')
};

return login_handlers;
Expand Down

0 comments on commit ac1ca50

Please sign in to comment.