diff options
author | skyblue <ssx205@gmail.com> | 2014-03-23 22:40:35 +0800 |
---|---|---|
committer | skyblue <ssx205@gmail.com> | 2014-03-23 22:40:35 +0800 |
commit | 4bac3616055110da6f060e98174bc2381ef91286 (patch) | |
tree | 6fc09df1b6bef1a73fac40771702ae5f4f71f1d4 /models/user.go | |
parent | b9302749ddc0e0a10911a83bf80e165b792c8c1e (diff) | |
parent | f7f175a0793a53f3c50d20d89e324a610f94c442 (diff) | |
download | gitea-4bac3616055110da6f060e98174bc2381ef91286.tar.gz gitea-4bac3616055110da6f060e98174bc2381ef91286.zip |
merge with branch master
Diffstat (limited to 'models/user.go')
-rw-r--r-- | models/user.go | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/models/user.go b/models/user.go index cedf342496..88bbabe6d5 100644 --- a/models/user.go +++ b/models/user.go @@ -201,7 +201,14 @@ func VerifyUserActiveCode(code string) (user *User) { // UpdateUser updates user's information. func UpdateUser(user *User) (err error) { - _, err = orm.Id(user.Id).UseBool().Update(user) + if len(user.Location) > 255 { + user.Location = user.Location[:255] + } + if len(user.Website) > 255 { + user.Website = user.Website[:255] + } + + _, err = orm.Id(user.Id).UseBool().Cols("website", "location", "is_active", "is_admin").Update(user) return err } @@ -279,9 +286,7 @@ func GetUserByName(name string) (*User, error) { if len(name) == 0 { return nil, ErrUserNotExist } - user := &User{ - LowerName: strings.ToLower(name), - } + user := &User{LowerName: strings.ToLower(name)} has, err := orm.Get(user) if err != nil { return nil, err |