mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed an issue email already exists and disable the 'Locked' switch when its value is false. Fixes #7618
This commit is contained in:
parent
88a443f73d
commit
485265979e
@ -33,6 +33,7 @@ class UserManagementCollection extends BaseUISchema {
|
|||||||
role: '2',
|
role: '2',
|
||||||
newPassword: undefined,
|
newPassword: undefined,
|
||||||
confirmPassword: undefined,
|
confirmPassword: undefined,
|
||||||
|
locked: false,
|
||||||
auth_source: authConstant['INTERNAL']
|
auth_source: authConstant['INTERNAL']
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -131,7 +132,7 @@ class UserManagementCollection extends BaseUISchema {
|
|||||||
}, {
|
}, {
|
||||||
id: 'locked', label: gettext('Locked'), cell: 'switch', width: 60, disableResizing: true,
|
id: 'locked', label: gettext('Locked'), cell: 'switch', width: 60, disableResizing: true,
|
||||||
editable: (state)=> {
|
editable: (state)=> {
|
||||||
return obj.isEditable(state);
|
return state.locked;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
@ -162,8 +163,7 @@ class UserManagementCollection extends BaseUISchema {
|
|||||||
setError('email', null);
|
setError('email', null);
|
||||||
}
|
}
|
||||||
|
|
||||||
let isEmailFound = false;
|
if (obj.isNew(state) && obj.top?._sessData?.userManagement) {
|
||||||
if (obj.top?._sessData?.userManagement) {
|
|
||||||
for (let i=0; i < obj.top._sessData.userManagement.length; i++) {
|
for (let i=0; i < obj.top._sessData.userManagement.length; i++) {
|
||||||
if (obj.top._sessData.userManagement[i]?.id &&
|
if (obj.top._sessData.userManagement[i]?.id &&
|
||||||
obj.top._sessData.userManagement[i].email == state.email) {
|
obj.top._sessData.userManagement[i].email == state.email) {
|
||||||
@ -174,12 +174,6 @@ class UserManagementCollection extends BaseUISchema {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.isNew(state) && isEmailFound) {
|
|
||||||
msg = gettext('Email address \'%s\' already exists', state.email);
|
|
||||||
setError('email', msg);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (obj.isNew(state) && isEmptyString(state.newPassword)) {
|
if (obj.isNew(state) && isEmptyString(state.newPassword)) {
|
||||||
msg = gettext('Password cannot be empty for user %s', state.email);
|
msg = gettext('Password cannot be empty for user %s', state.email);
|
||||||
setError('newPassword', msg);
|
setError('newPassword', msg);
|
||||||
|
Loading…
Reference in New Issue
Block a user