summaryrefslogtreecommitdiffstats
path: root/models/user.go
diff options
context:
space:
mode:
authorUnknwon <joe2010xtmf@163.com>2014-08-02 13:47:33 -0400
committerUnknwon <joe2010xtmf@163.com>2014-08-02 13:47:33 -0400
commit755eec745fa324fdd13078f0147638f8731652ba (patch)
tree3c04a98d64e128d2ce8887cc20ed361f04010052 /models/user.go
parent669552e255fb98021b779918394c65792fe6f1d2 (diff)
downloadgitea-755eec745fa324fdd13078f0147638f8731652ba.tar.gz
gitea-755eec745fa324fdd13078f0147638f8731652ba.zip
Finish new repo settings page
Diffstat (limited to 'models/user.go')
-rw-r--r--models/user.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/models/user.go b/models/user.go
index ca772556b7..f4526b51d1 100644
--- a/models/user.go
+++ b/models/user.go
@@ -116,6 +116,13 @@ 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 {
+ newUser := &User{Passwd: passwd, Salt: u.Salt}
+ newUser.EncodePasswd()
+ return u.Passwd == newUser.Passwd
+}
+
// IsOrganization returns true if user is actually a organization.
func (u *User) IsOrganization() bool {
return u.Type == ORGANIZATION