summaryrefslogtreecommitdiffstats
path: root/model/user.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2016-03-30 14:33:32 -0400
committerChristopher Speller <crspeller@gmail.com>2016-03-30 14:33:32 -0400
commit74d2c5b6ceb507e11032c79252f1778e7512d612 (patch)
treee2addd98f0a14cdf54fce337bfc9d732de6f0f04 /model/user.go
parent6cad40ecf41740ae57a14df12dc363adafb49d18 (diff)
parentf9a3a4b3949dddecae413b97904c895b2cd887bf (diff)
downloadchat-74d2c5b6ceb507e11032c79252f1778e7512d612.tar.gz
chat-74d2c5b6ceb507e11032c79252f1778e7512d612.tar.bz2
chat-74d2c5b6ceb507e11032c79252f1778e7512d612.zip
Merge pull request #2518 from mattermost/plt-2187
PLT-2187 Add MFA functionality
Diffstat (limited to 'model/user.go')
-rw-r--r--model/user.go28
1 files changed, 17 insertions, 11 deletions
diff --git a/model/user.go b/model/user.go
index 675a1ded6..f8f2fdb70 100644
--- a/model/user.go
+++ b/model/user.go
@@ -15,17 +15,19 @@ import (
)
const (
- ROLE_TEAM_ADMIN = "admin"
- ROLE_SYSTEM_ADMIN = "system_admin"
- USER_AWAY_TIMEOUT = 5 * 60 * 1000 // 5 minutes
- USER_OFFLINE_TIMEOUT = 1 * 60 * 1000 // 1 minute
- USER_OFFLINE = "offline"
- USER_AWAY = "away"
- USER_ONLINE = "online"
- USER_NOTIFY_ALL = "all"
- USER_NOTIFY_MENTION = "mention"
- USER_NOTIFY_NONE = "none"
- DEFAULT_LOCALE = "en"
+ ROLE_TEAM_ADMIN = "admin"
+ ROLE_SYSTEM_ADMIN = "system_admin"
+ USER_AWAY_TIMEOUT = 5 * 60 * 1000 // 5 minutes
+ USER_OFFLINE_TIMEOUT = 1 * 60 * 1000 // 1 minute
+ USER_OFFLINE = "offline"
+ USER_AWAY = "away"
+ USER_ONLINE = "online"
+ USER_NOTIFY_ALL = "all"
+ USER_NOTIFY_MENTION = "mention"
+ USER_NOTIFY_NONE = "none"
+ DEFAULT_LOCALE = "en"
+ USER_AUTH_SERVICE_EMAIL = "email"
+ USER_AUTH_SERVICE_USERNAME = "username"
)
type User struct {
@@ -54,6 +56,8 @@ type User struct {
LastPictureUpdate int64 `json:"last_picture_update,omitempty"`
FailedAttempts int `json:"failed_attempts,omitempty"`
Locale string `json:"locale"`
+ MfaActive bool `json:"mfa_active,omitempty"`
+ MfaSecret string `json:"mfa_secret,omitempty"`
}
// IsValid validates the user and returns an error if it isn't configured
@@ -140,6 +144,8 @@ func (u *User) PreSave() {
u.LastPasswordUpdate = u.CreateAt
+ u.MfaActive = false
+
if u.Locale == "" {
u.Locale = DEFAULT_LOCALE
}