Skip to content

Commit

Permalink
add validity check if user changes name in User Settings>Personal moi…
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerHaase committed Jul 7, 2024
1 parent e0cf95a commit 7af9860
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
11 changes: 9 additions & 2 deletions docs/user/accounts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ by clicking the account creation button, and you will be presented with an accou
The fields of this form are as follows:

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

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

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

Display-Name
The display name can be used to override your username, so you will still log in using your username
Expand Down
8 changes: 8 additions & 0 deletions src/moin/apps/frontend/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2447,6 +2447,14 @@ class UserSettingsUIForm(Form):
(_("The username '{name}' is already in use.").format(name=name), "error")
)
success = False
if not user.normalizeName(name) == name:
response["flash"].append(
(
_("The username '{name}' contains invalid characters").format(name=name),
"error",
)
)
success = False
if part == "notification":
if (
form["email"].value != flaskg.user.email
Expand Down

0 comments on commit 7af9860

Please sign in to comment.