Changed error and success message (#2785)
This commit is contained in:
parent
d05410d60d
commit
4eb0b90d75
2 changed files with 22 additions and 21 deletions
|
@ -118,6 +118,8 @@
|
||||||
"verifyEmailHelpText": "Require user to verify their email address after initial login or after address changes are submitted.",
|
"verifyEmailHelpText": "Require user to verify their email address after initial login or after address changes are submitted.",
|
||||||
"userInfoSettings": "User info settings",
|
"userInfoSettings": "User info settings",
|
||||||
"editUsername": "Edit username",
|
"editUsername": "Edit username",
|
||||||
|
"enableSwitchSuccess": "{{switch}} changed successfully",
|
||||||
|
"enableSwitchError": "Could not enable / disable due to {{error}}",
|
||||||
"testConnection": "Test connection",
|
"testConnection": "Test connection",
|
||||||
"testConnectionSuccess": "Success! SMTP connection successful. E-mail was sent!",
|
"testConnectionSuccess": "Success! SMTP connection successful. E-mail was sent!",
|
||||||
"testConnectionError": "Error! Failed to send email.",
|
"testConnectionError": "Error! Failed to send email.",
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {
|
import { FormGroup, PageSection, Switch } from "@patternfly/react-core";
|
||||||
AlertVariant,
|
|
||||||
FormGroup,
|
|
||||||
PageSection,
|
|
||||||
Switch,
|
|
||||||
} from "@patternfly/react-core";
|
|
||||||
import { FormAccess } from "../components/form-access/FormAccess";
|
import { FormAccess } from "../components/form-access/FormAccess";
|
||||||
import { HelpItem } from "../components/help-enabler/HelpItem";
|
import { HelpItem } from "../components/help-enabler/HelpItem";
|
||||||
import { FormPanel } from "../components/scroll-form/FormPanel";
|
import { FormPanel } from "../components/scroll-form/FormPanel";
|
||||||
|
@ -31,11 +26,7 @@ export const RealmSettingsLoginTab = ({
|
||||||
const adminClient = useAdminClient();
|
const adminClient = useAdminClient();
|
||||||
const { realm: realmName } = useRealm();
|
const { realm: realmName } = useRealm();
|
||||||
|
|
||||||
const updateSwitchValue = async (
|
const updateSwitchValue = async (name: string) => {
|
||||||
onChange: (newValue: boolean) => void,
|
|
||||||
value: boolean
|
|
||||||
) => {
|
|
||||||
onChange(value);
|
|
||||||
const switchValues = form.getValues();
|
const switchValues = form.getValues();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -45,10 +36,10 @@ export const RealmSettingsLoginTab = ({
|
||||||
},
|
},
|
||||||
switchValues
|
switchValues
|
||||||
);
|
);
|
||||||
addAlert(t("deleteClientPolicySuccess"), AlertVariant.success);
|
addAlert(t("enableSwitchSuccess", { switch: t(name) }));
|
||||||
refresh();
|
refresh();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
addError(t("deleteClientPolicyError"), error);
|
addError(t("enableSwitchError"), error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -83,7 +74,8 @@ export const RealmSettingsLoginTab = ({
|
||||||
labelOff={t("common:off")}
|
labelOff={t("common:off")}
|
||||||
isChecked={value}
|
isChecked={value}
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
updateSwitchValue(onChange, value);
|
onChange(value);
|
||||||
|
updateSwitchValue("userRegistration");
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
@ -114,7 +106,8 @@ export const RealmSettingsLoginTab = ({
|
||||||
labelOff={t("common:off")}
|
labelOff={t("common:off")}
|
||||||
isChecked={value}
|
isChecked={value}
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
updateSwitchValue(onChange, value);
|
onChange(value);
|
||||||
|
updateSwitchValue("forgotPassword");
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
@ -144,7 +137,8 @@ export const RealmSettingsLoginTab = ({
|
||||||
labelOff={t("common:off")}
|
labelOff={t("common:off")}
|
||||||
isChecked={value}
|
isChecked={value}
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
updateSwitchValue(onChange, value);
|
onChange(value);
|
||||||
|
updateSwitchValue("rememberMe");
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
@ -178,7 +172,8 @@ export const RealmSettingsLoginTab = ({
|
||||||
labelOff={t("common:off")}
|
labelOff={t("common:off")}
|
||||||
isChecked={value}
|
isChecked={value}
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
updateSwitchValue(onChange, value);
|
onChange(value);
|
||||||
|
updateSwitchValue("emailAsUsername");
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
@ -208,7 +203,8 @@ export const RealmSettingsLoginTab = ({
|
||||||
labelOff={t("common:off")}
|
labelOff={t("common:off")}
|
||||||
isChecked={value}
|
isChecked={value}
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
updateSwitchValue(onChange, value);
|
onChange(value);
|
||||||
|
updateSwitchValue("loginWithEmail");
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
@ -241,7 +237,8 @@ export const RealmSettingsLoginTab = ({
|
||||||
!form.getValues().registrationEmailAsUsername
|
!form.getValues().registrationEmailAsUsername
|
||||||
}
|
}
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
updateSwitchValue(onChange, value);
|
onChange(value);
|
||||||
|
updateSwitchValue("duplicateEmails");
|
||||||
}}
|
}}
|
||||||
isDisabled={
|
isDisabled={
|
||||||
form.getValues().loginWithEmailAllowed ||
|
form.getValues().loginWithEmailAllowed ||
|
||||||
|
@ -276,7 +273,8 @@ export const RealmSettingsLoginTab = ({
|
||||||
labelOff={t("common:off")}
|
labelOff={t("common:off")}
|
||||||
isChecked={value}
|
isChecked={value}
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
updateSwitchValue(onChange, value);
|
onChange(value);
|
||||||
|
updateSwitchValue("verifyEmail");
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
@ -313,7 +311,8 @@ export const RealmSettingsLoginTab = ({
|
||||||
labelOff={t("common:off")}
|
labelOff={t("common:off")}
|
||||||
isChecked={value}
|
isChecked={value}
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
updateSwitchValue(onChange, value);
|
onChange(value);
|
||||||
|
updateSwitchValue("userInfoSettings");
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
Loading…
Reference in a new issue