mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-04 01:34:27 +00:00 
			
		
		
		
	Include login_name in adminCreateUser response (#20283)
`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.
This commit is contained in:
		@@ -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
 | 
						// only site admin will get these information and possibly user himself
 | 
				
			||||||
	if authed {
 | 
						if authed {
 | 
				
			||||||
		result.IsAdmin = user.IsAdmin
 | 
							result.IsAdmin = user.IsAdmin
 | 
				
			||||||
 | 
							result.LoginName = user.LoginName
 | 
				
			||||||
		result.LastLogin = user.LastLoginUnix.AsTime()
 | 
							result.LastLogin = user.LastLoginUnix.AsTime()
 | 
				
			||||||
		result.Language = user.Language
 | 
							result.Language = user.Language
 | 
				
			||||||
		result.IsActive = user.IsActive
 | 
							result.IsActive = user.IsActive
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,6 +17,9 @@ type User struct {
 | 
				
			|||||||
	ID int64 `json:"id"`
 | 
						ID int64 `json:"id"`
 | 
				
			||||||
	// the user's username
 | 
						// the user's username
 | 
				
			||||||
	UserName string `json:"login"`
 | 
						UserName string `json:"login"`
 | 
				
			||||||
 | 
						// the user's authentication sign-in name.
 | 
				
			||||||
 | 
						// default: empty
 | 
				
			||||||
 | 
						LoginName string `json:"login_name"`
 | 
				
			||||||
	// the user's full name
 | 
						// the user's full name
 | 
				
			||||||
	FullName string `json:"full_name"`
 | 
						FullName string `json:"full_name"`
 | 
				
			||||||
	// swagger:strfmt email
 | 
						// swagger:strfmt email
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18487,6 +18487,12 @@
 | 
				
			|||||||
          "type": "string",
 | 
					          "type": "string",
 | 
				
			||||||
          "x-go-name": "UserName"
 | 
					          "x-go-name": "UserName"
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
					        "login_name": {
 | 
				
			||||||
 | 
					          "description": "the user's authentication sign-in name.",
 | 
				
			||||||
 | 
					          "type": "string",
 | 
				
			||||||
 | 
					          "default": "empty",
 | 
				
			||||||
 | 
					          "x-go-name": "LoginName"
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
        "prohibit_login": {
 | 
					        "prohibit_login": {
 | 
				
			||||||
          "description": "Is user login prohibited",
 | 
					          "description": "Is user login prohibited",
 | 
				
			||||||
          "type": "boolean",
 | 
					          "type": "boolean",
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user