-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Add option to change username to the admin panel #2129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UserName can be allowed to change only for internal users
@lafriks added |
Integration test would be nice for this |
8636454
to
42357e4
Compare
@lafriks I've added some tests |
This one is ready for review |
@@ -205,6 +205,14 @@ func EditUserPost(ctx *context.Context, form auth.AdminEditUserForm) { | |||
u.EncodePasswd() | |||
} | |||
|
|||
if u.IsLocal() && len(form.UserName) > 0 && u.Name != form.UserName { | |||
if err := models.ChangeUserName(u, form.UserName); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think models.ChangeUserName
and models.UpdateUser
should be with a transaction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Bwko any update for this?
@Bwko what's the state? |
state of this pr? |
followup: #14229 |
Adds #1818