From 327b672f24d826dbc47fff3a71fd50e40cdaf812 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Casaj=C3=BAs?= Date: Thu, 1 Dec 2022 13:07:36 +0100 Subject: [PATCH] Set the user name on creation to the original email (#1462) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Adrià Casajús --- app/api/views/auth.py | 5 +++-- app/auth/views/register.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/api/views/auth.py b/app/api/views/auth.py index 61d27365..e8fb3616 100644 --- a/app/api/views/auth.py +++ b/app/api/views/auth.py @@ -91,7 +91,8 @@ def auth_register(): if not data: return jsonify(error="request body cannot be empty"), 400 - email = canonicalize_email(data.get("email")) + dirty_email = data.get("email") + email = canonicalize_email(dirty_email) password = data.get("password") if DISABLE_REGISTRATION: @@ -112,7 +113,7 @@ def auth_register(): return jsonify(error="password too long"), 400 LOG.d("create user %s", email) - user = User.create(email=email, name="", password=password) + user = User.create(email=email, name=dirty_email, password=password) Session.flush() # create activation code diff --git a/app/auth/views/register.py b/app/auth/views/register.py index a5c3c966..138a9719 100644 --- a/app/auth/views/register.py +++ b/app/auth/views/register.py @@ -85,7 +85,7 @@ def register(): LOG.d("create user %s", email) user = User.create( email=email, - name="", + name=form.email.data, password=form.password.data, referral=get_referral(), )