summaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
authorReed Garmsen <rgarmsen2295@gmail.com>2016-01-13 14:58:49 -0800
committerReed Garmsen <rgarmsen2295@gmail.com>2016-02-02 12:07:42 -0800
commitb013f02209c7c128a35d1c54f2d4a7d6a9701f72 (patch)
treefac16d12e465a1a3050b0023fbadb7dce33f948c /model
parent320fe1c39240644ce15fa2a436ac4a5591b95083 (diff)
downloadchat-b013f02209c7c128a35d1c54f2d4a7d6a9701f72.tar.gz
chat-b013f02209c7c128a35d1c54f2d4a7d6a9701f72.tar.bz2
chat-b013f02209c7c128a35d1c54f2d4a7d6a9701f72.zip
Added ability to sign in via username; separated email sign in and sign up config settings
Diffstat (limited to 'model')
-rw-r--r--model/client.go8
-rw-r--r--model/config.go17
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