Fix MFA prompt not being shown for hardened mode (#10455)

Этот коммит содержится в:
Daniel Schalla
2019-03-15 16:09:17 +01:00
коммит произвёл GitHub
родитель 921504483b
Коммит eb49713c96

Просмотреть файл

@@ -1109,9 +1109,10 @@ func sendPasswordReset(c *Context, w http.ResponseWriter, r *http.Request) {
}
func login(c *Context, w http.ResponseWriter, r *http.Request) {
// For hardened mode, translate all login errors to generic.
// For hardened mode, translate all login errors to generic. MFA error being an exception, since it's required for
// the login flow itself.
defer func() {
if *c.App.Config().ServiceSettings.ExperimentalEnableHardenedMode && c.Err != nil {
if *c.App.Config().ServiceSettings.ExperimentalEnableHardenedMode && c.Err != nil && c.Err.Id != "mfa.validate_token.authenticate.app_error" {
c.Err = model.NewAppError("login", "api.user.login.invalid_credentials", nil, "", http.StatusUnauthorized)
}
}()