mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-26 12:27:06 +00:00 
			
		
		
		
	Merge pull request #1211 from mephux/hotfix/type-fix-ValidatePassword
Hotfix/type fix validate password
This commit is contained in:
		| @@ -169,7 +169,7 @@ func UserSignIn(uname, passwd string) (*User, error) { | ||||
| 	// For plain login, user must exist to reach this line. | ||||
| 	// Now verify password. | ||||
| 	if u.LoginType == PLAIN { | ||||
| 		if !u.ValidtePassword(passwd) { | ||||
| 		if !u.ValidatePassword(passwd) { | ||||
| 			return nil, ErrUserNotExist | ||||
| 		} | ||||
| 		return u, nil | ||||
|   | ||||
| @@ -143,8 +143,8 @@ func (u *User) EncodePasswd() { | ||||
| 	u.Passwd = fmt.Sprintf("%x", newPasswd) | ||||
| } | ||||
|  | ||||
| // ValidtePassword checks if given password matches the one belongs to the user. | ||||
| func (u *User) ValidtePassword(passwd string) bool { | ||||
| // ValidatePassword checks if given password matches the one belongs to the user. | ||||
| func (u *User) ValidatePassword(passwd string) bool { | ||||
| 	newUser := &User{Passwd: passwd, Salt: u.Salt} | ||||
| 	newUser.EncodePasswd() | ||||
| 	return u.Passwd == newUser.Passwd | ||||
|   | ||||
| @@ -164,7 +164,7 @@ func MigrateRepo(ctx *middleware.Context, form auth.MigrateRepoForm) { | ||||
| 		} | ||||
| 		return | ||||
| 	} | ||||
| 	if !u.ValidtePassword(ctx.Query("password")) { | ||||
| 	if !u.ValidatePassword(ctx.Query("password")) { | ||||
| 		ctx.HandleAPI(422, "Username or password is not correct.") | ||||
| 		return | ||||
| 	} | ||||
|   | ||||
| @@ -33,7 +33,7 @@ LOGFILE=${GOGS_HOME}/log/gogs.log | ||||
| RETVAL=0 | ||||
|  | ||||
| # Read configuration from /etc/sysconfig/gogs to override defaults | ||||
| [ -r /etc/sysconfig/$NAME ] && ./etc/sysconfig/$NAME | ||||
| [ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME | ||||
|  | ||||
| # Don't do anything if nothing is installed | ||||
| [ -x ${GOGS_PATH} ] || exit 0 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Lunny Xiao
					Lunny Xiao