aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2015-04-24 15:03:21 +0800
committerLunny Xiao <xiaolunwen@gmail.com>2015-04-24 15:03:21 +0800
commit673a76d638139ad3d5df1ba4314edfb1df2afc5c (patch)
tree3677ac48d117e59fa4be4db5cef6dc69c1fcf053 /models
parent2c4fb6e6469f756dfaeb276302bac87e4dac3e1e (diff)
parent5a4f314cf7465425bb2802bf9d2995c258af6697 (diff)
downloadgitea-673a76d638139ad3d5df1ba4314edfb1df2afc5c.tar.gz
gitea-673a76d638139ad3d5df1ba4314edfb1df2afc5c.zip
Merge pull request #1211 from mephux/hotfix/type-fix-ValidatePassword
Hotfix/type fix validate password
Diffstat (limited to 'models')
-rw-r--r--models/login.go2
-rw-r--r--models/user.go4
2 files changed, 3 insertions, 3 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