[gnome-initial-setup/shell/4765: 237/362] Shorten proposed usernames
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup/shell/4765: 237/362] Shorten proposed usernames
- Date: Thu, 19 Mar 2015 01:41:00 +0000 (UTC)
commit 5d0be00020655c2f791c7bbd72fc5036d74bb6d3
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date: Mon Sep 22 11:01:03 2014 +0000
Shorten proposed usernames
Respect the allowed maximum size for proposed usernames.
[endlessm/eos-shell#3756]
gnome-initial-setup/pages/account/um-utils.c | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/gnome-initial-setup/pages/account/um-utils.c b/gnome-initial-setup/pages/account/um-utils.c
index c1b7ae2..947cd80 100644
--- a/gnome-initial-setup/pages/account/um-utils.c
+++ b/gnome-initial-setup/pages/account/um-utils.c
@@ -315,6 +315,30 @@ generate_username_choices (const gchar *name,
items = g_hash_table_new (g_str_hash, g_str_equal);
+ /* shorten names */
+ if (strlen (first_word->str) > MAXNAMELEN) {
+ first_word->str[MAXNAMELEN] = '\0';
+ }
+ if (strlen (last_word->str) > MAXNAMELEN) {
+ last_word->str[MAXNAMELEN] = '\0';
+ }
+
+ if (strlen (item0->str) > MAXNAMELEN) {
+ item0->str[MAXNAMELEN] = '\0';
+ }
+ if (strlen (item1->str) > MAXNAMELEN) {
+ item1->str[MAXNAMELEN] = '\0';
+ }
+ if (strlen (item2->str) > MAXNAMELEN) {
+ item2->str[MAXNAMELEN] = '\0';
+ }
+ if (strlen (item3->str) > MAXNAMELEN) {
+ item3->str[MAXNAMELEN] = '\0';
+ }
+ if (strlen (item4->str) > MAXNAMELEN) {
+ item4->str[MAXNAMELEN] = '\0';
+ }
+
/* add the first one */
in_use = is_username_used (first_word->str);
if (*first_word->str && !in_use && !g_ascii_isdigit (first_word->str[0]) &&
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]