Fix broken login form with new error responses
This commit is contained in:
parent
aa6ed364a9
commit
faf893a428
2 changed files with 9 additions and 5 deletions
|
@ -241,7 +241,11 @@ def post_register():
|
|||
password_2 = request.form['password_2']
|
||||
|
||||
if password_1 != password_2:
|
||||
return jsonify.make_json_response({'error': 'Passwords do not match'}, status=422)
|
||||
response = {
|
||||
'error_type': 'PASSWORDS_DONT_MATCH',
|
||||
'error_message': 'Passwords do not match.',
|
||||
}
|
||||
return jsonify.make_json_response(response, status=422)
|
||||
|
||||
try:
|
||||
user = P.register_user(username, password_1)
|
||||
|
|
|
@ -103,7 +103,7 @@ function submit_login()
|
|||
var password = document.getElementById("login_input_password").value;
|
||||
if (username == "" || password == "")
|
||||
{
|
||||
create_message_bubble(message_area, "message_negative", "Fill out the form yo", 8000);
|
||||
create_message_bubble(message_area, "message_negative", "Fill out the form, yo.", 8000);
|
||||
return;
|
||||
}
|
||||
var url = "/login";
|
||||
|
@ -119,7 +119,7 @@ function submit_register()
|
|||
var password_2 = document.getElementById("register_input_password_2").value;
|
||||
if (username == "" || password_1 == "" || password_2 == "")
|
||||
{
|
||||
create_message_bubble(message_area, "message_negative", "Fill out the form yo", 8000);
|
||||
create_message_bubble(message_area, "message_negative", "Fill out the form, yo.", 8000);
|
||||
return;
|
||||
}
|
||||
var url = "/register";
|
||||
|
@ -131,9 +131,9 @@ function submit_register()
|
|||
}
|
||||
function receive_callback(response)
|
||||
{
|
||||
if ("error" in response)
|
||||
if ("error_type" in response)
|
||||
{
|
||||
create_message_bubble(message_area, "message_negative", response["error"], 8000);
|
||||
create_message_bubble(message_area, "message_negative", response["error_message"], 8000);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue