From 9d8073328a5e971aaff6285e33e212c08b31b510 Mon Sep 17 00:00:00 2001 From: hmhealey Date: Thu, 9 Jul 2015 17:06:04 -0400 Subject: Added FirstName and LastName fields to User object and attempt to populate them from the FullName/Nickname field --- model/user.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'model') diff --git a/model/user.go b/model/user.go index 88f8f718a..7265381fd 100644 --- a/model/user.go +++ b/model/user.go @@ -38,6 +38,8 @@ type User struct { Email string `json:"email"` EmailVerified bool `json:"email_verified"` Nickname string `json:"nickname"` + FirstName string `json:"first_name"` + LastName string `json:"last_name"` Roles string `json:"roles"` LastActivityAt int64 `json:"last_activity_at"` LastPingAt int64 `json:"last_ping_at"` @@ -86,6 +88,14 @@ func (u *User) IsValid() *AppError { return NewAppError("User.IsValid", "Invalid nickname", "user_id="+u.Id) } + if len(u.FirstName) > 64 { + return NewAppError("User.IsValid", "Invalid first name", "user_id="+u.Id) + } + + if len(u.LastName) > 64 { + return NewAppError("User.IsValid", "Invalid last name", "user_id="+u.Id) + } + return nil } -- cgit v1.2.3-1-g7c22