From 13a08f499432365eb42a277ee6c304037e00cb78 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 23 May 2011 09:19:19 -0400 Subject: [PATCH] Users: strip out periods when generating proposals Some systems seem to disallow them in usernames, but more importantly, the proposals look just wrong for abbreviated middle initials with a period. https://bugzilla.gnome.org/show_bug.cgi?id=650777 --- panels/user-accounts/um-utils.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/panels/user-accounts/um-utils.c b/panels/user-accounts/um-utils.c index b874ff40d..f579cb70f 100644 --- a/panels/user-accounts/um-utils.c +++ b/panels/user-accounts/um-utils.c @@ -557,14 +557,18 @@ generate_username_choices (const gchar *name, lc_name = g_ascii_strdown (ascii_name, -1); - /* remove all non ASCII alphanumeric chars from the name, - * apart from the few allowed symbols + /* Remove all non ASCII alphanumeric chars from the name, + * apart from the few allowed symbols. + * + * We do remove '.', even though it is usually allowed, + * since it often comes in via an abbreviated middle name, + * and the dot looks just wrong in the proposals then. */ stripped_name = g_strnfill (strlen (lc_name) + 1, '\0'); i = 0; for (c = lc_name; *c; c++) { if (!(g_ascii_isdigit (*c) || g_ascii_islower (*c) || - *c == ' ' || *c == '-' || *c == '.' || *c == '_' || + *c == ' ' || *c == '-' || *c == '_' || /* used to track invalid words, removed below */ *c == '?') ) continue;