diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2015-04-24 15:03:21 +0800 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2015-04-24 15:03:21 +0800 |
commit | 673a76d638139ad3d5df1ba4314edfb1df2afc5c (patch) | |
tree | 3677ac48d117e59fa4be4db5cef6dc69c1fcf053 | |
parent | 2c4fb6e6469f756dfaeb276302bac87e4dac3e1e (diff) | |
parent | 5a4f314cf7465425bb2802bf9d2995c258af6697 (diff) | |
download | gitea-673a76d638139ad3d5df1ba4314edfb1df2afc5c.tar.gz gitea-673a76d638139ad3d5df1ba4314edfb1df2afc5c.zip |
Merge pull request #1211 from mephux/hotfix/type-fix-ValidatePassword
Hotfix/type fix validate password
-rw-r--r-- | models/login.go | 2 | ||||
-rw-r--r-- | models/user.go | 4 | ||||
-rw-r--r-- | routers/api/v1/repo.go | 2 | ||||
-rw-r--r-- | scripts/init/centos/gogs | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/models/login.go b/models/login.go index 916e27310c..73d112568b 100644 --- a/models/login.go +++ b/models/login.go @@ -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 diff --git a/models/user.go b/models/user.go index bf69f97a1b..e239ea174d 100644 --- a/models/user.go +++ b/models/user.go @@ -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 diff --git a/routers/api/v1/repo.go b/routers/api/v1/repo.go index 170c2e90ba..7da5f81731 100644 --- a/routers/api/v1/repo.go +++ b/routers/api/v1/repo.go @@ -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 } diff --git a/scripts/init/centos/gogs b/scripts/init/centos/gogs index 1a92ff2070..5ff6de537f 100644 --- a/scripts/init/centos/gogs +++ b/scripts/init/centos/gogs @@ -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 |