Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-1
Этот коммит содержится в:
@@ -113,7 +113,11 @@ func setupTestHelper(enterprise bool) *TestHelper {
|
||||
if testStore != nil {
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.ListenAddress = ":0" })
|
||||
}
|
||||
th.App.StartServer()
|
||||
serverErr := th.App.StartServer()
|
||||
if serverErr != nil {
|
||||
panic(serverErr)
|
||||
}
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.ListenAddress = prevListenAddress })
|
||||
Init(th.App, th.App.Srv.Router, true)
|
||||
wsapi.Init(th.App, th.App.Srv.WebSocketRouter)
|
||||
@@ -299,8 +303,7 @@ func (me *TestHelper) CreateUserWithClient(client *model.Client4) *model.User {
|
||||
}
|
||||
|
||||
utils.DisableDebugLogForTest()
|
||||
ruser, r := client.CreateUser(user)
|
||||
fmt.Println(r)
|
||||
ruser, _ := client.CreateUser(user)
|
||||
ruser.Password = "Password1"
|
||||
store.Must(me.App.Srv.Store.User().VerifyEmail(ruser.Id))
|
||||
utils.EnableDebugLogForTest()
|
||||
|
||||
@@ -112,7 +112,7 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
c.SetSiteURLHeader(app.GetProtocol(r) + "://" + r.Host)
|
||||
|
||||
w.Header().Set(model.HEADER_REQUEST_ID, c.RequestId)
|
||||
w.Header().Set(model.HEADER_VERSION_ID, fmt.Sprintf("%v.%v.%v.%v", model.CurrentVersion, model.BuildNumber, c.App.ClientConfigHash(), utils.IsLicensed()))
|
||||
w.Header().Set(model.HEADER_VERSION_ID, fmt.Sprintf("%v.%v.%v.%v", model.CurrentVersion, model.BuildNumber, c.App.ClientConfigHash(), c.App.License() != nil))
|
||||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
|
||||
@@ -249,7 +249,7 @@ func (c *Context) SessionRequired() {
|
||||
|
||||
func (c *Context) MfaRequired() {
|
||||
// Must be licensed for MFA and have it configured for enforcement
|
||||
if !utils.IsLicensed() || !*utils.License().Features.MFA || !*c.App.Config().ServiceSettings.EnableMultifactorAuthentication || !*c.App.Config().ServiceSettings.EnforceMultifactorAuthentication {
|
||||
if license := c.App.License(); license == nil || !*license.Features.MFA || !*c.App.Config().ServiceSettings.EnableMultifactorAuthentication || !*c.App.Config().ServiceSettings.EnforceMultifactorAuthentication {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -738,7 +738,7 @@ func checkUserMfa(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
resp := map[string]interface{}{}
|
||||
resp["mfa_required"] = false
|
||||
|
||||
if !utils.IsLicensed() || !*utils.License().Features.MFA || !*c.App.Config().ServiceSettings.EnableMultifactorAuthentication {
|
||||
if license := c.App.License(); license == nil || !*license.Features.MFA || !*c.App.Config().ServiceSettings.EnableMultifactorAuthentication {
|
||||
w.Write([]byte(model.StringInterfaceToJson(resp)))
|
||||
return
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user