diff options
author | Joram Wilander <jwawilander@gmail.com> | 2016-02-03 07:33:43 -0500 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2016-02-03 07:33:43 -0500 |
commit | 4a09adeb391b23c7e850fec96a2e8a731b70d755 (patch) | |
tree | ca9cc2410dc17de823d923c9e0ff74fea16d2a82 /model | |
parent | d31ae207389b7402debbcaa40bb691e86023f1ba (diff) | |
parent | b013f02209c7c128a35d1c54f2d4a7d6a9701f72 (diff) | |
download | chat-4a09adeb391b23c7e850fec96a2e8a731b70d755.tar.gz chat-4a09adeb391b23c7e850fec96a2e8a731b70d755.tar.bz2 chat-4a09adeb391b23c7e850fec96a2e8a731b70d755.zip |
Merge pull request #1991 from rgarmsen2295/plt-976
PLT-976 Adds ability to sign in with username
Diffstat (limited to 'model')
-rw-r--r-- | model/client.go | 8 | ||||
-rw-r--r-- | model/config.go | 17 |
2 files changed, 25 insertions, 0 deletions
diff --git a/model/client.go b/model/client.go index d31ac1592..3b72f65e4 100644 --- a/model/client.go +++ b/model/client.go @@ -280,6 +280,14 @@ func (c *Client) LoginByEmail(name string, email string, password string) (*Resu return c.login(m) } +func (c *Client) LoginByUsername(name string, username string, password string) (*Result, *AppError) { + m := make(map[string]string) + m["name"] = name + m["username"] = username + m["password"] = password + return c.login(m) +} + func (c *Client) LoginByEmailWithDevice(name string, email string, password string, deviceId string) (*Result, *AppError) { m := make(map[string]string) m["name"] = name diff --git a/model/config.go b/model/config.go index 5c8604ff1..a6d1c21dc 100644 --- a/model/config.go +++ b/model/config.go @@ -97,6 +97,8 @@ type FileSettings struct { type EmailSettings struct { EnableSignUpWithEmail bool + EnableSignInWithEmail *bool + EnableSignInWithUsername *bool SendEmailNotifications bool RequireEmailVerification bool FeedbackName string @@ -258,6 +260,21 @@ func (o *Config) SetDefaults() { *o.TeamSettings.EnableTeamListing = false } + if o.EmailSettings.EnableSignInWithEmail == nil { + o.EmailSettings.EnableSignInWithEmail = new(bool) + + if o.EmailSettings.EnableSignUpWithEmail == true { + *o.EmailSettings.EnableSignInWithEmail = true + } else { + *o.EmailSettings.EnableSignInWithEmail = false + } + } + + if o.EmailSettings.EnableSignInWithUsername == nil { + o.EmailSettings.EnableSignInWithUsername = new(bool) + *o.EmailSettings.EnableSignInWithUsername = false + } + if o.EmailSettings.SendPushNotifications == nil { o.EmailSettings.SendPushNotifications = new(bool) *o.EmailSettings.SendPushNotifications = false |