[MM-36444] Manage config deprecations for 6.0 (#18035)
* removing deprecated stuff * removing deprecations and marking others for deprecations * removing some of the configs * partially remove ExperimentalChannelOrganization * fixing merge issues * moving default permissions to defaultroles function * removing experimentaltownsquare * removing old tests and remove legacysidebar config * fixing test * removing log * removing unused variables * MM-36444: Fix for renamed functions. * MM-36444: go mod tidy and go mod vendor. * MM-36444: Vendored go modules. * MM-36444: Removes UseExperimentalGossip config field from model. * Fix vendors * fixing test Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MacBook-Pro.local> Co-authored-by: Mattermod <mattermod@users.noreply.github.com> Co-authored-by: Martin Kraft <martin@upspin.org> Co-authored-by: Claudio Costa <cstcld91@gmail.com>
Этот коммит содержится в:
35
api4/user.go
35
api4/user.go
@@ -57,7 +57,6 @@ func (api *API) InitUser() {
|
||||
|
||||
api.BaseRoutes.User.Handle("/auth", api.APISessionRequiredTrustRequester(updateUserAuth)).Methods("PUT")
|
||||
|
||||
api.BaseRoutes.Users.Handle("/mfa", api.APIHandler(checkUserMfa)).Methods("POST")
|
||||
api.BaseRoutes.User.Handle("/mfa", api.APISessionRequiredMfa(updateUserMfa)).Methods("PUT")
|
||||
api.BaseRoutes.User.Handle("/mfa/generate", api.APISessionRequiredMfa(generateMfaSecret)).Methods("POST")
|
||||
|
||||
@@ -1510,40 +1509,6 @@ func updateUserAuth(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
// Deprecated: checkUserMfa is deprecated and should not be used anymore, starting with version 6.0 it will be disabled.
|
||||
// Clients should attempt a login without MFA and will receive a MFA error when it's required.
|
||||
func checkUserMfa(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
if *c.App.Config().ServiceSettings.DisableLegacyMFA {
|
||||
http.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
|
||||
props := model.MapFromJSON(r.Body)
|
||||
|
||||
loginId := props["login_id"]
|
||||
if loginId == "" {
|
||||
c.SetInvalidParam("login_id")
|
||||
return
|
||||
}
|
||||
|
||||
resp := map[string]interface{}{}
|
||||
resp["mfa_required"] = false
|
||||
|
||||
if !*c.App.Config().ServiceSettings.EnableMultifactorAuthentication {
|
||||
w.Write([]byte(model.StringInterfaceToJSON(resp)))
|
||||
return
|
||||
}
|
||||
|
||||
if *c.App.Config().ServiceSettings.ExperimentalEnableHardenedMode {
|
||||
resp["mfa_required"] = true
|
||||
} else if user, err := c.App.GetUserForLogin("", loginId); err == nil {
|
||||
resp["mfa_required"] = user.MfaActive
|
||||
}
|
||||
|
||||
w.Write([]byte(model.StringInterfaceToJSON(resp)))
|
||||
}
|
||||
|
||||
func updateUserMfa(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
c.RequireUserId()
|
||||
if c.Err != nil {
|
||||
|
||||
Ссылка в новой задаче
Block a user