mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Don't force a password change for the admin user when creating an account via cli (#5391)
* don't force a password change for the admin user * don't totally dicard -must-change-password flag if creating the first (admin) user via the cli. Use flag if present but make sure to default to not forcing a password update
This commit is contained in:
		@@ -322,6 +322,12 @@ func runCreateUser(c *cli.Context) error {
 | 
				
			|||||||
	// always default to true
 | 
						// always default to true
 | 
				
			||||||
	var changePassword = true
 | 
						var changePassword = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// If this is the first user being created.
 | 
				
			||||||
 | 
						// Take it as the admin and don't force a password update.
 | 
				
			||||||
 | 
						if n := models.CountUsers(); n == 0 {
 | 
				
			||||||
 | 
							changePassword = false
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if c.IsSet("must-change-password") {
 | 
						if c.IsSet("must-change-password") {
 | 
				
			||||||
		changePassword = c.Bool("must-change-password")
 | 
							changePassword = c.Bool("must-change-password")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user