manual cherry-pick: [MM-67202] Validate auth method in account switch (#34981) (#35143)

* fix account authorization type switch

* improve test clarity

* refactor tests for clarity
Этот коммит содержится в:
Christopher Poile
2026-01-30 09:36:57 -05:00
коммит произвёл GitHub
родитель 66fdb3f453
Коммит 452bad21e9
3 изменённых файлов: 292 добавлений и 181 удалений

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

@@ -1018,6 +1018,10 @@ func (a *App) SwitchOAuthToEmail(c request.CTX, email, password, requesterId str
return "", model.NewAppError("SwitchOAuthToEmail", "api.user.oauth_to_email.context.app_error", nil, "", http.StatusForbidden)
}
if !user.IsOAuthUser() && !user.IsSAMLUser() {
return "", model.NewAppError("SwitchOAuthToEmail", "api.user.oauth_to_email.not_oauth_user.app_error", nil, "", http.StatusBadRequest)
}
if err := a.UpdatePassword(c, user, password); err != nil {
return "", err
}