Skip to content

Commit

Permalink
Include login_name in adminCreateUser response (go-gitea#20283)
Browse files Browse the repository at this point in the history
`login_name` (Authentication Sign-in Name) is not included in the response of `adminUserCreate` API. 
This PR is to return user-specified `login_name` if there is one.
  • Loading branch information
kimbj95 authored and dineshsalunke committed Jul 15, 2022
1 parent ed8543a commit 649042f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/convert/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ func toUser(user *user_model.User, signed, authed bool) *api.User {
// only site admin will get these information and possibly user himself
if authed {
result.IsAdmin = user.IsAdmin
result.LoginName = user.LoginName
result.LastLogin = user.LastLoginUnix.AsTime()
result.Language = user.Language
result.IsActive = user.IsActive
Expand Down
3 changes: 3 additions & 0 deletions modules/structs/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ type User struct {
ID int64 `json:"id"`
// the user's username
UserName string `json:"login"`
// the user's authentication sign-in name.
// default: empty
LoginName string `json:"login_name"`
// the user's full name
FullName string `json:"full_name"`
// swagger:strfmt email
Expand Down
6 changes: 6 additions & 0 deletions templates/swagger/v1_json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -18963,6 +18963,12 @@
"type": "string",
"x-go-name": "UserName"
},
"login_name": {
"description": "the user's authentication sign-in name.",
"type": "string",
"default": "empty",
"x-go-name": "LoginName"
},
"prohibit_login": {
"description": "Is user login prohibited",
"type": "boolean",
Expand Down

0 comments on commit 649042f

Please sign in to comment.