commit 76391c92a1509a1588e3c811dca2dbf203d2e7a7
parent c6979fa85c445ab75395fd98f61217f5083d98cc
Author: Sebastian <sebasjm@gmail.com>
Date: Thu, 20 Mar 2025 12:23:32 -0300
fix #9493
Diffstat:
5 files changed, 39 insertions(+), 6 deletions(-)
diff --git a/packages/bank-ui/src/pages/RegistrationPage.tsx b/packages/bank-ui/src/pages/RegistrationPage.tsx
@@ -155,9 +155,9 @@ function RegistrationForm({
case TalerErrorCode.BANK_NON_ADMIN_SET_TAN_CHANNEL:
return i18n.str`Only admin can create accounts with second factor authentication.`;
case TalerErrorCode.BANK_PASSWORD_TOO_SHORT:
- return i18n.str`The password is too short.`;
+ return i18n.str`The password is too short. Can't have less than 8 characters.`;
case TalerErrorCode.BANK_PASSWORD_TOO_LONG:
- return i18n.str`The password is too long.`;
+ return i18n.str`The password is too long. Can't have more than 64 characters.`;
}
});
}
diff --git a/packages/bank-ui/src/pages/account/ShowAccountDetails.tsx b/packages/bank-ui/src/pages/account/ShowAccountDetails.tsx
@@ -206,7 +206,7 @@ export function ShowAccountDetails({
case TalerErrorCode.BANK_PASSWORD_TOO_SHORT: {
return notify({
type: "error",
- title: i18n.str`The password is too short.`,
+ title: i18n.str`The password is too short. Can't have less than 8 characters.`,
description: resp.detail?.hint as TranslatedString,
debug: resp.detail,
when: AbsoluteTime.now(),
@@ -215,7 +215,7 @@ export function ShowAccountDetails({
case TalerErrorCode.BANK_PASSWORD_TOO_LONG: {
return notify({
type: "error",
- title: i18n.str`The password is too long.`,
+ title: i18n.str`The password is too long. Can't have more than 64 characters.`,
description: resp.detail?.hint as TranslatedString,
debug: resp.detail,
when: AbsoluteTime.now(),
diff --git a/packages/bank-ui/src/pages/account/UpdateAccountPassword.tsx b/packages/bank-ui/src/pages/account/UpdateAccountPassword.tsx
@@ -155,6 +155,33 @@ export function UpdateAccountPassword({
});
return onAuthorizationRequired();
}
+ case HttpStatusCode.Forbidden: {
+ return notify({
+ type: "error",
+ title: i18n.str`You don't have the rights to change the password.`,
+ description: resp.detail?.hint as TranslatedString,
+ debug: resp.detail,
+ when: AbsoluteTime.now(),
+ });
+ }
+ case TalerErrorCode.BANK_PASSWORD_TOO_SHORT: {
+ return notify({
+ type: "error",
+ title: i18n.str`The password is too short. Can't have less than 8 characters.`,
+ description: resp.detail?.hint as TranslatedString,
+ debug: resp.detail,
+ when: AbsoluteTime.now(),
+ });
+ }
+ case TalerErrorCode.BANK_PASSWORD_TOO_LONG: {
+ return notify({
+ type: "error",
+ title: i18n.str`The password is too long. Can't have more than 64 characters.`,
+ description: resp.detail?.hint as TranslatedString,
+ debug: resp.detail,
+ when: AbsoluteTime.now(),
+ });
+ }
default:
assertUnreachable(resp);
}
diff --git a/packages/bank-ui/src/pages/admin/CreateNewAccount.tsx b/packages/bank-ui/src/pages/admin/CreateNewAccount.tsx
@@ -160,7 +160,7 @@ export function CreateNewAccount({
case TalerErrorCode.BANK_PASSWORD_TOO_SHORT: {
return notify({
type: "error",
- title: i18n.str`The password is too short.`,
+ title: i18n.str`The password is too short. Can't have less than 8 characters.`,
description: resp.detail?.hint as TranslatedString,
debug: resp.detail,
when: AbsoluteTime.now(),
@@ -169,7 +169,7 @@ export function CreateNewAccount({
case TalerErrorCode.BANK_PASSWORD_TOO_LONG: {
return notify({
type: "error",
- title: i18n.str`The password is too long.`,
+ title: i18n.str`The password is too long. Can't have more than 64 characters.`,
description: resp.detail?.hint as TranslatedString,
debug: resp.detail,
when: AbsoluteTime.now(),
diff --git a/packages/taler-util/src/http-client/bank-core.ts b/packages/taler-util/src/http-client/bank-core.ts
@@ -446,6 +446,8 @@ export class TalerCoreBankHttpClient {
return opKnownHttpFailure(resp.status, resp);
case HttpStatusCode.Unauthorized:
return opKnownHttpFailure(resp.status, resp);
+ case HttpStatusCode.Forbidden:
+ return opKnownHttpFailure(resp.status, resp);
case HttpStatusCode.Conflict: {
const details = await readTalerErrorResponse(resp);
switch (details.code) {
@@ -453,6 +455,10 @@ export class TalerCoreBankHttpClient {
return opKnownTalerFailure(details.code, details);
case TalerErrorCode.BANK_PATCH_BAD_OLD_PASSWORD:
return opKnownTalerFailure(details.code, details);
+ case TalerErrorCode.BANK_PASSWORD_TOO_SHORT:
+ return opKnownTalerFailure(details.code, details);
+ case TalerErrorCode.BANK_PASSWORD_TOO_LONG:
+ return opKnownTalerFailure(details.code, details);
default:
return opUnknownFailure(resp, details);
}