Merge pull request #289 from the-luap/fix/password-change-regular-modal
fix: apply password change fix to regular modal + longer toast delay (#263)
This commit is contained in:
@@ -32,7 +32,7 @@ export const MandatoryPasswordChangeModal: React.FC = () => {
|
|||||||
// where the auth context checks the session before the cookie is stored.
|
// where the auth context checks the session before the cookie is stored.
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.href = '/admin/dashboard';
|
window.location.href = '/admin/dashboard';
|
||||||
}, 500);
|
}, 2000);
|
||||||
},
|
},
|
||||||
onError: (error: any) => {
|
onError: (error: any) => {
|
||||||
if (error.response?.data?.error) {
|
if (error.response?.data?.error) {
|
||||||
|
|||||||
@@ -30,14 +30,12 @@ export const PasswordChangeModal: React.FC<PasswordChangeModalProps> = ({ isOpen
|
|||||||
mutationFn: adminService.changePassword,
|
mutationFn: adminService.changePassword,
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('passwordChange.success'));
|
toast.success(t('passwordChange.success'));
|
||||||
onClose();
|
// Full page reload so the browser picks up the new JWT cookie.
|
||||||
// Reset form
|
// Same fix as MandatoryPasswordChangeModal — without this, the old
|
||||||
setFormData({
|
// token gets rejected and causes a redirect loop.
|
||||||
currentPassword: '',
|
setTimeout(() => {
|
||||||
newPassword: '',
|
window.location.href = '/admin/dashboard';
|
||||||
confirmPassword: ''
|
}, 2000);
|
||||||
});
|
|
||||||
setErrors({});
|
|
||||||
},
|
},
|
||||||
onError: (error: any) => {
|
onError: (error: any) => {
|
||||||
if (error.response?.data?.error) {
|
if (error.response?.data?.error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user