From 7de7de6ad0882ef25ed9be5bbd91576cc822206f Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Mon, 31 Aug 2015 13:33:22 -0700 Subject: MM-2056 fixes problem with creating team --- api/team.go | 6 +++--- api/user.go | 2 +- api/user_test.go | 6 ------ config/config.json | 2 +- docker/0.7/config_docker.json | 2 +- docker/dev/config_docker.json | 2 +- docker/local/config_docker.json | 2 +- model/user.go | 1 - utils/config.go | 4 ++-- web/react/components/team_signup_password_page.jsx | 3 ++- 10 files changed, 12 insertions(+), 18 deletions(-) diff --git a/api/team.go b/api/team.go index e34b3a610..8cce384c3 100644 --- a/api/team.go +++ b/api/team.go @@ -36,7 +36,7 @@ func InitTeam(r *mux.Router) { } func signupTeam(c *Context, w http.ResponseWriter, r *http.Request) { - if !utils.Cfg.ServiceSettings.AllowEmailSignUp { + if utils.Cfg.ServiceSettings.DisableEmailSignUp { c.Err = model.NewAppError("signupTeam", "Team sign-up with email is disabled.", "") c.Err.StatusCode = http.StatusNotImplemented return @@ -139,7 +139,7 @@ func createTeamFromSSO(c *Context, w http.ResponseWriter, r *http.Request) { } func createTeamFromSignup(c *Context, w http.ResponseWriter, r *http.Request) { - if !utils.Cfg.ServiceSettings.AllowEmailSignUp { + if utils.Cfg.ServiceSettings.DisableEmailSignUp { c.Err = model.NewAppError("createTeamFromSignup", "Team sign-up with email is disabled.", "") c.Err.StatusCode = http.StatusNotImplemented return @@ -239,7 +239,7 @@ func createTeamFromSignup(c *Context, w http.ResponseWriter, r *http.Request) { } func createTeam(c *Context, w http.ResponseWriter, r *http.Request) { - if !utils.Cfg.ServiceSettings.AllowEmailSignUp { + if utils.Cfg.ServiceSettings.DisableEmailSignUp { c.Err = model.NewAppError("createTeam", "Team sign-up with email is disabled.", "") c.Err.StatusCode = http.StatusNotImplemented return diff --git a/api/user.go b/api/user.go index 3796dde2a..d69244fad 100644 --- a/api/user.go +++ b/api/user.go @@ -58,7 +58,7 @@ func InitUser(r *mux.Router) { } func createUser(c *Context, w http.ResponseWriter, r *http.Request) { - if !utils.Cfg.ServiceSettings.AllowEmailSignUp { + if utils.Cfg.ServiceSettings.DisableEmailSignUp { c.Err = model.NewAppError("signupTeam", "User sign-up with email is disabled.", "") c.Err.StatusCode = http.StatusNotImplemented return diff --git a/api/user_test.go b/api/user_test.go index 776b17b3c..b5435e3c0 100644 --- a/api/user_test.go +++ b/api/user_test.go @@ -68,12 +68,6 @@ func TestCreateUser(t *testing.T) { } } - user2 := model.User{TeamId: rteam.Data.(*model.Team).Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", Nickname: "Corey Hulen", Password: "hello", Username: model.BOT_USERNAME} - - if _, err := Client.CreateUser(&user2, ""); err == nil { - t.Fatal("Should have failed using reserved bot name") - } - if _, err := Client.DoPost("/users/create", "garbage"); err == nil { t.Fatal("should have been an error") } diff --git a/config/config.json b/config/config.json index e0a13a9eb..cd7e221e7 100644 --- a/config/config.json +++ b/config/config.json @@ -23,7 +23,7 @@ "UseLocalStorage": true, "StorageDirectory": "./data/", "AllowedLoginAttempts": 10, - "AllowEmailSignUp": true + "DisableEmailSignUp": false }, "SSOSettings": { "gitlab": { diff --git a/docker/0.7/config_docker.json b/docker/0.7/config_docker.json index fdcb938b9..794ac95ae 100644 --- a/docker/0.7/config_docker.json +++ b/docker/0.7/config_docker.json @@ -23,7 +23,7 @@ "UseLocalStorage": true, "StorageDirectory": "/mattermost/data/", "AllowedLoginAttempts": 10, - "AllowEmailSignUp": true + "DisableEmailSignUp": false }, "SSOSettings": { "gitlab": { diff --git a/docker/dev/config_docker.json b/docker/dev/config_docker.json index fdcb938b9..794ac95ae 100644 --- a/docker/dev/config_docker.json +++ b/docker/dev/config_docker.json @@ -23,7 +23,7 @@ "UseLocalStorage": true, "StorageDirectory": "/mattermost/data/", "AllowedLoginAttempts": 10, - "AllowEmailSignUp": true + "DisableEmailSignUp": false }, "SSOSettings": { "gitlab": { diff --git a/docker/local/config_docker.json b/docker/local/config_docker.json index fdcb938b9..794ac95ae 100644 --- a/docker/local/config_docker.json +++ b/docker/local/config_docker.json @@ -23,7 +23,7 @@ "UseLocalStorage": true, "StorageDirectory": "/mattermost/data/", "AllowedLoginAttempts": 10, - "AllowEmailSignUp": true + "DisableEmailSignUp": false }, "SSOSettings": { "gitlab": { diff --git a/model/user.go b/model/user.go index 7c53593d2..d82f96db3 100644 --- a/model/user.go +++ b/model/user.go @@ -333,7 +333,6 @@ func IsUsernameValid(username string) bool { var validUsernameChars = regexp.MustCompile(`^[a-z0-9\.\-_]+$`) var restrictedUsernames = []string{ - BOT_USERNAME, "all", "channel", } diff --git a/utils/config.go b/utils/config.go index 36193412b..f49840453 100644 --- a/utils/config.go +++ b/utils/config.go @@ -31,7 +31,7 @@ type ServiceSettings struct { UseLocalStorage bool StorageDirectory string AllowedLoginAttempts int - AllowEmailSignUp bool + DisableEmailSignUp bool } type SSOSetting struct { @@ -278,7 +278,7 @@ func GetAllowedAuthServices() []string { } } - if Cfg.ServiceSettings.AllowEmailSignUp { + if !Cfg.ServiceSettings.DisableEmailSignUp { authServices = append(authServices, "email") } diff --git a/web/react/components/team_signup_password_page.jsx b/web/react/components/team_signup_password_page.jsx index bbe82a5c2..6b21915f6 100644 --- a/web/react/components/team_signup_password_page.jsx +++ b/web/react/components/team_signup_password_page.jsx @@ -57,13 +57,14 @@ module.exports = React.createClass({ window.location.href = '/verify_email?email=' + encodeURIComponent(teamSignup.team.email) + '&teamname=' + encodeURIComponent(teamSignup.team.name); } else { this.setState({serverError: err.message}); + $('#finish-button').button('reset'); } }.bind(this) ); }.bind(this), function error(err) { this.setState({serverError: err.message}); - $('#sign-up-button').button('reset'); + $('#finish-button').button('reset'); }.bind(this) ); }, -- cgit v1.2.3-1-g7c22