mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	[Refactor] Passwort Hash/Set (#14282)
* move SaltGeneration into HashPasswort and rename it to what it does
* Migration: Where Password is Valid with Empty String delete it
* prohibit empty password hash
* let SetPassword("") unset pwd stuff
			
			
This commit is contained in:
		@@ -771,8 +771,10 @@ func UserSignIn(username, password string) (*User, error) {
 | 
			
		||||
 | 
			
		||||
				// Update password hash if server password hash algorithm have changed
 | 
			
		||||
				if user.PasswdHashAlgo != setting.PasswordHashAlgo {
 | 
			
		||||
					user.HashPassword(password)
 | 
			
		||||
					if err := UpdateUserCols(user, "passwd", "passwd_hash_algo"); err != nil {
 | 
			
		||||
					if err = user.SetPassword(password); err != nil {
 | 
			
		||||
						return nil, err
 | 
			
		||||
					}
 | 
			
		||||
					if err = UpdateUserCols(user, "passwd", "passwd_hash_algo", "salt"); err != nil {
 | 
			
		||||
						return nil, err
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user