Skip to content

Commit a77f2bf

Browse files
authored
Merge pull request #1708 from RogerHaase/1707-user-settings
add validity check if user changes name in User Settings>Personal #1707
2 parents e0cf95a + 7af9860 commit a77f2bf

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

docs/user/accounts.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ by clicking the account creation button, and you will be presented with an accou
1515
The fields of this form are as follows:
1616

1717
Name
18-
Your username on the wiki. Will appear in the history section of any wiki item which you edit. This is a required field.
18+
Your username on the wiki. Names must not contain "/", ":", or "," characters, invisible unicode
19+
characters, or leading or trailing whitespace characters. Embedded single space characters
20+
are allowed. This is a required field.
1921

2022
Password
2123
Your password for logging into your new account. Remember to pick a strong password with a mix
@@ -55,7 +57,12 @@ Personal Settings
5557
Personal settings include wiki language and locale, username and alias.
5658

5759
Name
58-
Your username, as it will appear on the wiki and in the history pages of wiki items which you edit.
60+
Your username, as it will appear on the login form, the history pages of wiki items
61+
which you edit, and in the footer of items you have edited. All of these places will be
62+
rendered as links to your home page in the `users` namespace.
63+
If desired, name may be a comma separated list of names. For example, if it is tedious
64+
to type your long full name at login, you may create a short alias name: `JohnDoe, jd`.
65+
Alias names are only useful at login.
5966

6067
Display-Name
6168
The display name can be used to override your username, so you will still log in using your username

src/moin/apps/frontend/views.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2447,6 +2447,14 @@ class UserSettingsUIForm(Form):
24472447
(_("The username '{name}' is already in use.").format(name=name), "error")
24482448
)
24492449
success = False
2450+
if not user.normalizeName(name) == name:
2451+
response["flash"].append(
2452+
(
2453+
_("The username '{name}' contains invalid characters").format(name=name),
2454+
"error",
2455+
)
2456+
)
2457+
success = False
24502458
if part == "notification":
24512459
if (
24522460
form["email"].value != flaskg.user.email

0 commit comments

Comments
 (0)