Merge pull request #528 from mattermost/MM-2056
HOTFIX MM-2056 fixes problem with creating team
Этот коммит содержится в:
@@ -36,7 +36,7 @@ func InitTeam(r *mux.Router) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func signupTeam(c *Context, w http.ResponseWriter, r *http.Request) {
|
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 = model.NewAppError("signupTeam", "Team sign-up with email is disabled.", "")
|
||||||
c.Err.StatusCode = http.StatusNotImplemented
|
c.Err.StatusCode = http.StatusNotImplemented
|
||||||
return
|
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) {
|
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 = model.NewAppError("createTeamFromSignup", "Team sign-up with email is disabled.", "")
|
||||||
c.Err.StatusCode = http.StatusNotImplemented
|
c.Err.StatusCode = http.StatusNotImplemented
|
||||||
return
|
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) {
|
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 = model.NewAppError("createTeam", "Team sign-up with email is disabled.", "")
|
||||||
c.Err.StatusCode = http.StatusNotImplemented
|
c.Err.StatusCode = http.StatusNotImplemented
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ func InitUser(r *mux.Router) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createUser(c *Context, w http.ResponseWriter, r *http.Request) {
|
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 = model.NewAppError("signupTeam", "User sign-up with email is disabled.", "")
|
||||||
c.Err.StatusCode = http.StatusNotImplemented
|
c.Err.StatusCode = http.StatusNotImplemented
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -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 {
|
if _, err := Client.DoPost("/users/create", "garbage"); err == nil {
|
||||||
t.Fatal("should have been an error")
|
t.Fatal("should have been an error")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
"UseLocalStorage": true,
|
"UseLocalStorage": true,
|
||||||
"StorageDirectory": "./data/",
|
"StorageDirectory": "./data/",
|
||||||
"AllowedLoginAttempts": 10,
|
"AllowedLoginAttempts": 10,
|
||||||
"AllowEmailSignUp": true
|
"DisableEmailSignUp": false
|
||||||
},
|
},
|
||||||
"SSOSettings": {
|
"SSOSettings": {
|
||||||
"gitlab": {
|
"gitlab": {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
"UseLocalStorage": true,
|
"UseLocalStorage": true,
|
||||||
"StorageDirectory": "/mattermost/data/",
|
"StorageDirectory": "/mattermost/data/",
|
||||||
"AllowedLoginAttempts": 10,
|
"AllowedLoginAttempts": 10,
|
||||||
"AllowEmailSignUp": true
|
"DisableEmailSignUp": false
|
||||||
},
|
},
|
||||||
"SSOSettings": {
|
"SSOSettings": {
|
||||||
"gitlab": {
|
"gitlab": {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
"UseLocalStorage": true,
|
"UseLocalStorage": true,
|
||||||
"StorageDirectory": "/mattermost/data/",
|
"StorageDirectory": "/mattermost/data/",
|
||||||
"AllowedLoginAttempts": 10,
|
"AllowedLoginAttempts": 10,
|
||||||
"AllowEmailSignUp": true
|
"DisableEmailSignUp": false
|
||||||
},
|
},
|
||||||
"SSOSettings": {
|
"SSOSettings": {
|
||||||
"gitlab": {
|
"gitlab": {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
"UseLocalStorage": true,
|
"UseLocalStorage": true,
|
||||||
"StorageDirectory": "/mattermost/data/",
|
"StorageDirectory": "/mattermost/data/",
|
||||||
"AllowedLoginAttempts": 10,
|
"AllowedLoginAttempts": 10,
|
||||||
"AllowEmailSignUp": true
|
"DisableEmailSignUp": false
|
||||||
},
|
},
|
||||||
"SSOSettings": {
|
"SSOSettings": {
|
||||||
"gitlab": {
|
"gitlab": {
|
||||||
|
|||||||
@@ -333,7 +333,6 @@ func IsUsernameValid(username string) bool {
|
|||||||
var validUsernameChars = regexp.MustCompile(`^[a-z0-9\.\-_]+$`)
|
var validUsernameChars = regexp.MustCompile(`^[a-z0-9\.\-_]+$`)
|
||||||
|
|
||||||
var restrictedUsernames = []string{
|
var restrictedUsernames = []string{
|
||||||
BOT_USERNAME,
|
|
||||||
"all",
|
"all",
|
||||||
"channel",
|
"channel",
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ type ServiceSettings struct {
|
|||||||
UseLocalStorage bool
|
UseLocalStorage bool
|
||||||
StorageDirectory string
|
StorageDirectory string
|
||||||
AllowedLoginAttempts int
|
AllowedLoginAttempts int
|
||||||
AllowEmailSignUp bool
|
DisableEmailSignUp bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type SSOSetting struct {
|
type SSOSetting struct {
|
||||||
@@ -278,7 +278,7 @@ func GetAllowedAuthServices() []string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if Cfg.ServiceSettings.AllowEmailSignUp {
|
if !Cfg.ServiceSettings.DisableEmailSignUp {
|
||||||
authServices = append(authServices, "email")
|
authServices = append(authServices, "email")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,13 +57,14 @@ module.exports = React.createClass({
|
|||||||
window.location.href = '/verify_email?email=' + encodeURIComponent(teamSignup.team.email) + '&teamname=' + encodeURIComponent(teamSignup.team.name);
|
window.location.href = '/verify_email?email=' + encodeURIComponent(teamSignup.team.email) + '&teamname=' + encodeURIComponent(teamSignup.team.name);
|
||||||
} else {
|
} else {
|
||||||
this.setState({serverError: err.message});
|
this.setState({serverError: err.message});
|
||||||
|
$('#finish-button').button('reset');
|
||||||
}
|
}
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
);
|
);
|
||||||
}.bind(this),
|
}.bind(this),
|
||||||
function error(err) {
|
function error(err) {
|
||||||
this.setState({serverError: err.message});
|
this.setState({serverError: err.message});
|
||||||
$('#sign-up-button').button('reset');
|
$('#finish-button').button('reset');
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user