mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
[MM-53943] Remove deprecated UserAuth.Password field (#24213)
This commit is contained in:
parent
8372267739
commit
7ecf6c0b5c
@ -2184,7 +2184,6 @@ func TestUpdateUserAuth(t *testing.T) {
|
||||
userAuth := &model.UserAuth{}
|
||||
userAuth.AuthData = user.AuthData
|
||||
userAuth.AuthService = user.AuthService
|
||||
userAuth.Password = user.Password
|
||||
|
||||
// Regular user can not use endpoint
|
||||
_, respErr, _ := th.SystemAdminClient.UpdateUserAuth(context.Background(), user.Id, userAuth)
|
||||
@ -2192,19 +2191,16 @@ func TestUpdateUserAuth(t *testing.T) {
|
||||
|
||||
userAuth.AuthData = model.NewString("test@test.com")
|
||||
userAuth.AuthService = model.UserAuthServiceSaml
|
||||
userAuth.Password = "newpassword"
|
||||
ruser, _, err := th.SystemAdminClient.UpdateUserAuth(context.Background(), user.Id, userAuth)
|
||||
require.NoError(t, err)
|
||||
|
||||
// AuthData and AuthService are set, password is set to empty
|
||||
require.Equal(t, *userAuth.AuthData, *ruser.AuthData)
|
||||
require.Equal(t, model.UserAuthServiceSaml, ruser.AuthService)
|
||||
require.Empty(t, ruser.Password)
|
||||
|
||||
// When AuthData or AuthService are empty, password must be valid
|
||||
userAuth.AuthData = user.AuthData
|
||||
userAuth.AuthService = ""
|
||||
userAuth.Password = "1"
|
||||
_, respErr, _ = th.SystemAdminClient.UpdateUserAuth(context.Background(), user.Id, userAuth)
|
||||
require.NotNil(t, respErr)
|
||||
|
||||
@ -2218,7 +2214,6 @@ func TestUpdateUserAuth(t *testing.T) {
|
||||
|
||||
userAuth.AuthData = user.AuthData
|
||||
userAuth.AuthService = user.AuthService
|
||||
userAuth.Password = user.Password
|
||||
_, respErr, _ = th.SystemAdminClient.UpdateUserAuth(context.Background(), user.Id, userAuth)
|
||||
require.NotNil(t, respErr, "Should have errored")
|
||||
}
|
||||
|
@ -1086,7 +1086,6 @@ func (a *App) PatchUser(c request.CTX, userID string, patch *model.UserPatch, as
|
||||
}
|
||||
|
||||
func (a *App) UpdateUserAuth(userID string, userAuth *model.UserAuth) (*model.UserAuth, *model.AppError) {
|
||||
userAuth.Password = ""
|
||||
if _, err := a.Srv().Store().User().UpdateAuthData(userID, userAuth.AuthService, userAuth.AuthData, "", false); err != nil {
|
||||
var invErr *store.ErrInvalidInput
|
||||
switch {
|
||||
|
@ -183,7 +183,6 @@ func (u *UserPatch) Auditable() map[string]interface{} {
|
||||
|
||||
//msgp:ignore UserAuth
|
||||
type UserAuth struct {
|
||||
Password string `json:"password,omitempty"` // DEPRECATED: It is not used.
|
||||
AuthData *string `json:"auth_data,omitempty"`
|
||||
AuthService string `json:"auth_service,omitempty"`
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user