Skip to content

Commit d1640db

Browse files
committed
feat: enable dialog for password which is not following rule #1593
Signed-off-by: Arnab Dutta <[email protected]>
1 parent a9b05ef commit d1640db

File tree

1 file changed

+20
-5
lines changed
  • admin-ui/plugins/user-management/redux/sagas

1 file changed

+20
-5
lines changed

admin-ui/plugins/user-management/redux/sagas/UserSaga.js

+20-5
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ export function* createUserSaga({ payload }) {
4747
yield* triggerWebhook({ payload: { createdFeatureValue: data } })
4848
return data
4949
} catch (e) {
50-
yield put(updateToast(true, 'error'))
50+
const errMsg = e?.response?.body?.description || e?.response?.text
51+
yield* errorToast(errMsg)
5152
yield put(createUserResponse(null))
5253
if (isFourZeroOneError(e)) {
5354
const jwt = yield select((state) => state.authReducer.userinfo_jwt)
@@ -67,7 +68,8 @@ export function* updateUserSaga({ payload }) {
6768
yield* triggerWebhook({ payload: { createdFeatureValue: data } })
6869
return data
6970
} catch (e) {
70-
yield put(updateToast(true, 'error'))
71+
const errMsg = e?.response?.body?.description || e?.response?.text
72+
yield* errorToast(errMsg)
7173
yield put(updateUserResponse(null))
7274
if (isFourZeroOneError(e)) {
7375
const jwt = yield select((state) => state.authReducer.userinfo_jwt)
@@ -86,7 +88,8 @@ export function* changeUserPasswordSaga({ payload }) {
8688
yield put(updateToast(true, 'success'))
8789
yield put(changeUserPasswordResponse(data))
8890
} catch (e) {
89-
yield put(updateToast(true, 'error'))
91+
const errMsg = e?.response?.body?.description || e?.response?.text
92+
yield* errorToast(errMsg)
9093
yield put(changeUserPasswordResponse(null))
9194
if (isFourZeroOneError(e)) {
9295
const jwt = yield select((state) => state.authReducer.userinfo_jwt)
@@ -105,7 +108,8 @@ export function* getUsersSaga({ payload }) {
105108
yield call(postUserAction, audit)
106109
return data
107110
} catch (e) {
108-
yield put(getUserResponse(null))
111+
const errMsg = e?.response?.body?.description || e?.response?.text
112+
yield* errorToast(errMsg)
109113
if (isFourZeroOneError(e)) {
110114
const jwt = yield select((state) => state.authReducer.userinfo_jwt)
111115
yield put(getAPIAccessToken(jwt))
@@ -126,7 +130,8 @@ export function* deleteUserSaga({ payload }) {
126130
yield* triggerWebhook({ payload: { createdFeatureValue: payload } })
127131
return data
128132
} catch (e) {
129-
yield put(updateToast(true, 'error'))
133+
const errMsg = e?.response?.body?.description || e?.response?.text
134+
yield* errorToast(errMsg)
130135
yield put(deleteUserResponse(null))
131136
if (isFourZeroOneError(e)) {
132137
const jwt = yield select((state) => state.authReducer.userinfo_jwt)
@@ -136,6 +141,16 @@ export function* deleteUserSaga({ payload }) {
136141
}
137142
}
138143

144+
function* errorToast(errMsg) {
145+
yield put(
146+
updateToast(
147+
true,
148+
'error',
149+
errMsg
150+
)
151+
)
152+
}
153+
139154
export function* watchGetUsers() {
140155
yield takeEvery('user/getUsers', getUsersSaga)
141156
}

0 commit comments

Comments
 (0)