diff --git a/zephyr/models.py b/zephyr/models.py index 3d6f9a60ee..409131438b 100644 --- a/zephyr/models.py +++ b/zephyr/models.py @@ -212,7 +212,10 @@ def compute_mit_user_fullname(email): if proc.returncode == 0: # Parse e.g. 'starnine:*:84233:101:Athena Consulting Exchange User,,,:/mit/starnine:/bin/bash' # for the 4th passwd entry field, aka the person's name. - return out.split(':')[4].split(',')[0] + hesiod_name = out.split(':')[4].split(',')[0].strip() + if hesiod_name == "": + return email + return hesiod_name elif match_user: return match_user.group(1).lower() + "@" + match_user.group(2).upper()[1:] except: diff --git a/zephyr/views.py b/zephyr/views.py index 15ad0dc52a..c9f3fb7760 100644 --- a/zephyr/views.py +++ b/zephyr/views.py @@ -85,13 +85,13 @@ def accounts_register(request): domain = email.split('@')[-1] (realm, _) = Realm.objects.get_or_create(domain=domain) + # FIXME: sanitize email addresses and fullname if mit_beta_user: user = User.objects.get(email=email) do_activate_user(user) do_change_password(user, password) do_change_full_name(user.userprofile, full_name) else: - # FIXME: sanitize email addresses user = do_create_user(email, password, realm, full_name, short_name) add_default_subs(user) @@ -855,8 +855,8 @@ def json_change_settings(request, user_profile, full_name=POST, do_change_password(user_profile.user, new_password) result = {} - if user_profile.full_name != full_name: - do_change_full_name(user_profile, full_name) + if user_profile.full_name != full_name and full_name.strip() != "": + do_change_full_name(user_profile, full_name.strip()) result['full_name'] = full_name if user_profile.enable_desktop_notifications != enable_desktop_notifications: