After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 778555 - don't modify pre-filled username when typing Full Name
don't modify pre-filled username when typing Full Name
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: User Accounts
git master
Other Linux
: Normal normal
: ---
Assigned To: Control-Center Maintainers
Control-Center Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-02-13 13:33 UTC by Mohammed Sadiq
Modified: 2017-02-14 17:46 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
user-accounts: Don't modify pre-filled username (2.39 KB, patch)
2017-02-14 08:18 UTC, Ondrej Holy
none Details | Review
user-accounts: Don't modify pre-filled username (1.96 KB, patch)
2017-02-14 08:57 UTC, Ondrej Holy
none Details | Review
user-accounts: Don't modify pre-filled username (3.16 KB, patch)
2017-02-14 17:19 UTC, Ondrej Holy
committed Details | Review

Description Mohammed Sadiq 2017-02-13 13:33:09 UTC
When the user has first typed Username, don't modify it automatically when the User later types Full Name, unless the username is unavailable.
Comment 1 Ondrej Holy 2017-02-14 08:18:44 UTC
Created attachment 345704 [details] [review]
user-accounts: Don't modify pre-filled username

If user type custom username, don't modify it automatically when
changing fullname.
Comment 2 Ondrej Holy 2017-02-14 08:57:05 UTC
Created attachment 345705 [details] [review]
user-accounts: Don't modify pre-filled username

If user type custom username, don't modify it automatically when
changing fullname.
Comment 3 Ondrej Holy 2017-02-14 09:17:36 UTC
Review of attachment 345704 [details] [review]:

::: panels/user-accounts/um-account-dialog.c
@@ +429,3 @@
+                        gtk_entry_set_text (GTK_ENTRY (entry), "");
+                } else {
+                        generate_username_choices (name, GTK_LIST_STORE (model));

generate_username_choices has to be called in all cases
Comment 4 Mohammed Sadiq 2017-02-14 09:23:53 UTC
On certain conditions, I have issues with the above patch.

Eg: I have already a username 'test' on my system. Create a new user, let the username be empty (so that the username will be updated with Full Name given). Give the Full Name as "Testing". The username gets stuck at 'tes'. And when I do delete the Full Name (using backspace key), the username is no longer modified, which should be, in this case.

Thanks
Comment 5 Ondrej Holy 2017-02-14 12:02:26 UTC
Hmm, thanks for testing. It is not that easy as I though initially... the problem is that generate_username_choices doesn't generate any passwords in that case and the logic fails...
Comment 6 Mohammed Sadiq 2017-02-14 16:52:11 UTC
(In reply to Ondrej Holy from comment #5)
> Hmm, thanks for testing. It is not that easy as I though initially... the
> problem is that generate_username_choices doesn't generate any passwords in
> that case and the logic fails...

The following may be an easy fix that can be committed immediately: Don't modify current username if the resulting username would be an empty string (ie, ""). This can happen very often if the user enters his/her name in a language other than English.

Thanks
Comment 7 Ondrej Holy 2017-02-14 17:19:59 UTC
Created attachment 345743 [details] [review]
user-accounts: Don't modify pre-filled username

Can you please test this one?
Comment 8 Mohammed Sadiq 2017-02-14 17:31:09 UTC
(In reply to Ondrej Holy from comment #7)
> Created attachment 345743 [details] [review] [review]
> user-accounts: Don't modify pre-filled username
> 
> Can you please test this one?

Sure. 

Seems to work fine. I didn't find any issues for any of my test cases.

Shall file report if I find any, later.

Thanks
Comment 9 Bastien Nocera 2017-02-14 17:46:24 UTC
Pushed with minimal changes (NULL checks before strlen() and use *foo rather than foo[0])

Attachment 345743 [details] pushed as 9440035 - user-accounts: Don't modify pre-filled username