commit 15f1e00a6d1e1202a2fb195adbe28b5b2abe9982
parent 10836e529b9d5c4ee04f8ba71862d7e471fbcff2
Author: Sebastian <sebasjm@gmail.com>
Date: Wed, 16 Apr 2025 21:17:10 -0300
fix #9349 disable input on read only
Diffstat:
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/packages/aml-backoffice-ui/src/pages/Search.tsx b/packages/aml-backoffice-ui/src/pages/Search.tsx
@@ -595,8 +595,8 @@ const walletFields: (i18n: InternationalizationAPI) => UIFormElementConfig[] = (
help: i18n.str`Wallet reserve public key`,
placeholder: i18n.str`abcdef1235`,
validator(value) {
- return value && value.length !== 32
- ? i18n.str`Should be 32 characters`
+ return value && value.length !== 52
+ ? i18n.str`Should be 52 characters`
: undefined;
},
},
diff --git a/packages/challenger-ui/src/pages/AskChallenge.tsx b/packages/challenger-ui/src/pages/AskChallenge.tsx
@@ -143,6 +143,7 @@ export function AskChallenge({
config.address_type,
config.restrictions ?? {},
lastStatus.last_address ?? {},
+ lastStatus.fix_address,
);
const form = useForm(design, lastStatus.last_address ?? {});
@@ -225,7 +226,7 @@ export function AskChallenge({
)}
</div>
- {lastStatus?.last_address && (
+ {lastStatus && lastStatus.last_address && lastStatus.auth_attempts_left > 0 && (
<Fragment>
<Attention title={i18n.str`A code has been sent to ${prevAddr}`}>
<i18n.Translate>
@@ -507,6 +508,7 @@ function getFormDesignBasedOnAddressType(
type: ChallengerApi.ChallengerTermsOfServiceResponse["address_type"],
restrictions: Record<string, ChallengerApi.Restriction | undefined>,
prevValue: Record<string, string>,
+ read_only: boolean,
): FormDesign {
function getRestriction(
serverConfig: ChallengerApi.Restriction | undefined,
@@ -551,6 +553,7 @@ function getFormDesignBasedOnAddressType(
id: TalerFormAttributes.CONTACT_EMAIL,
required: true,
label: i18n.str`Email`,
+ disabled: read_only,
validator(text) {
const restriction = getRestriction(
restrictions[TalerFormAttributes.CONTACT_EMAIL],
@@ -577,6 +580,7 @@ function getFormDesignBasedOnAddressType(
id: TalerFormAttributes.CONTACT_PHONE,
required: true,
label: i18n.str`Phone`,
+ disabled: read_only,
validator(text) {
const restriction = getRestriction(
restrictions[TalerFormAttributes.CONTACT_PHONE],
@@ -602,6 +606,7 @@ function getFormDesignBasedOnAddressType(
type: "text",
id: TalerFormAttributes.CONTACT_NAME,
required: true,
+ disabled: read_only,
label: i18n.str`Contact name`,
placeholder: i18n.str`Person full name or name of the business`,
validator(text) {
@@ -619,6 +624,7 @@ function getFormDesignBasedOnAddressType(
type: "textArea",
id: TalerFormAttributes.ADDRESS_LINES,
required: true,
+ disabled: read_only,
label: i18n.str`Address`,
placeholder: ADDRESS_EXAMPLE_INTERNATIONAL,
validator(text) {
@@ -636,6 +642,7 @@ function getFormDesignBasedOnAddressType(
id: TalerFormAttributes.ADDRESS_COUNTRY,
label: i18n.str`Country`,
type: "selectOne",
+ disabled: read_only,
choices: countryNameList(i18n),
required: true,
preferredChoiceVals: ["CH", "DE"],
@@ -660,6 +667,7 @@ function getFormDesignBasedOnAddressType(
type: "text",
id: TalerFormAttributes.CONTACT_NAME,
required: true,
+ disabled: read_only,
label: i18n.str`Contact name`,
placeholder: i18n.str`Your full name`,
validator(text) {
@@ -676,6 +684,7 @@ function getFormDesignBasedOnAddressType(
type: "textArea",
id: TalerFormAttributes.ADDRESS_LINES,
required: true,
+ disabled: read_only,
label: i18n.str`Address`,
placeholder: ADDRESS_EXAMPLE_CH,
validator(text) {