diff --git a/frontends/etiquette_flask/backend/endpoints/user_endpoints.py b/frontends/etiquette_flask/backend/endpoints/user_endpoints.py index d7e3925..4d1e530 100644 --- a/frontends/etiquette_flask/backend/endpoints/user_endpoints.py +++ b/frontends/etiquette_flask/backend/endpoints/user_endpoints.py @@ -106,6 +106,7 @@ def post_register(): return jsonify.make_json_response(response, status=403) username = request.form['username'] + display_name = request.form.get('display_name', None) password_1 = request.form['password_1'] password_2 = request.form['password_2'] @@ -116,7 +117,7 @@ def post_register(): } return jsonify.make_json_response(response, status=422) - user = common.P.register_user(username, password_1) + user = common.P.register_user(username, password_1, display_name=display_name) session = sessions.Session(request, user) session_manager.add(session) diff --git a/frontends/etiquette_flask/static/js/api.js b/frontends/etiquette_flask/static/js/api.js index 50bfdd7..a97ca85 100644 --- a/frontends/etiquette_flask/static/js/api.js +++ b/frontends/etiquette_flask/static/js/api.js @@ -269,11 +269,12 @@ function logout(callback) } api.users.register = -function register(username, password_1, password_2, callback) +function register(username, display_name, password_1, password_2, callback) { var url = "/register"; data = new FormData(); data.append("username", username); + data.append("display_name", display_name); data.append("password_1", password_1); data.append("password_2", password_2); common.post(url, data, callback); diff --git a/frontends/etiquette_flask/templates/login.html b/frontends/etiquette_flask/templates/login.html index 502db08..82766e5 100644 --- a/frontends/etiquette_flask/templates/login.html +++ b/frontends/etiquette_flask/templates/login.html @@ -77,6 +77,7 @@ button

Register

+ @@ -120,6 +121,7 @@ function login_form() function register_form() { var username = document.getElementById("register_input_username").value; + var display_name = document.getElementById("register_input_display_name").value; var password_1 = document.getElementById("register_input_password_1").value; var password_2 = document.getElementById("register_input_password_2").value; if (username == "" || password_1 == "" || password_2 == "") @@ -127,7 +129,7 @@ function register_form() common.create_message_bubble(message_area, "message_negative", "Fill out the form, yo."); return; } - api.users.register(username, password_1, password_2, receive_callback); + api.users.register(username, display_name, password_1, password_2, receive_callback); } function receive_callback(response)