Skip to content

Commit

Permalink
Merge pull request #1613 from GluuFederation/admin-ui-issue-1593
Browse files Browse the repository at this point in the history
feat: enable dialog for password which is not following rule #1593
  • Loading branch information
duttarnab authored Mar 8, 2024
2 parents dc91801 + d1640db commit d530026
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions admin-ui/plugins/user-management/redux/sagas/UserSaga.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ export function* createUserSaga({ payload }) {
yield* triggerWebhook({ payload: { createdFeatureValue: data } })
return data
} catch (e) {
yield put(updateToast(true, 'error'))
const errMsg = e?.response?.body?.description || e?.response?.text
yield* errorToast(errMsg)
yield put(createUserResponse(null))
if (isFourZeroOneError(e)) {
const jwt = yield select((state) => state.authReducer.userinfo_jwt)
Expand All @@ -67,7 +68,8 @@ export function* updateUserSaga({ payload }) {
yield* triggerWebhook({ payload: { createdFeatureValue: data } })
return data
} catch (e) {
yield put(updateToast(true, 'error'))
const errMsg = e?.response?.body?.description || e?.response?.text
yield* errorToast(errMsg)
yield put(updateUserResponse(null))
if (isFourZeroOneError(e)) {
const jwt = yield select((state) => state.authReducer.userinfo_jwt)
Expand All @@ -86,7 +88,8 @@ export function* changeUserPasswordSaga({ payload }) {
yield put(updateToast(true, 'success'))
yield put(changeUserPasswordResponse(data))
} catch (e) {
yield put(updateToast(true, 'error'))
const errMsg = e?.response?.body?.description || e?.response?.text
yield* errorToast(errMsg)
yield put(changeUserPasswordResponse(null))
if (isFourZeroOneError(e)) {
const jwt = yield select((state) => state.authReducer.userinfo_jwt)
Expand All @@ -105,7 +108,8 @@ export function* getUsersSaga({ payload }) {
yield call(postUserAction, audit)
return data
} catch (e) {
yield put(getUserResponse(null))
const errMsg = e?.response?.body?.description || e?.response?.text
yield* errorToast(errMsg)
if (isFourZeroOneError(e)) {
const jwt = yield select((state) => state.authReducer.userinfo_jwt)
yield put(getAPIAccessToken(jwt))
Expand All @@ -126,7 +130,8 @@ export function* deleteUserSaga({ payload }) {
yield* triggerWebhook({ payload: { createdFeatureValue: payload } })
return data
} catch (e) {
yield put(updateToast(true, 'error'))
const errMsg = e?.response?.body?.description || e?.response?.text
yield* errorToast(errMsg)
yield put(deleteUserResponse(null))
if (isFourZeroOneError(e)) {
const jwt = yield select((state) => state.authReducer.userinfo_jwt)
Expand All @@ -136,6 +141,16 @@ export function* deleteUserSaga({ payload }) {
}
}

function* errorToast(errMsg) {
yield put(
updateToast(
true,
'error',
errMsg
)
)
}

export function* watchGetUsers() {
yield takeEvery('user/getUsers', getUsersSaga)
}
Expand Down

0 comments on commit d530026

Please sign in to comment.