aboutsummaryrefslogtreecommitdiff
path: root/packages/demobank-ui/src/pages/RegistrationPage.tsx
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-11-22 13:33:44 -0300
committerSebastian <sebasjm@gmail.com>2023-11-22 15:20:28 -0300
commit33c0267b37eecf44dc9f04e124eb44d27cba700c (patch)
tree9d5549dbb5a415b44005ab05711fc66c4643cbc9 /packages/demobank-ui/src/pages/RegistrationPage.tsx
parent5eec408d9fb5e8c2375937166997ef8267a4053c (diff)
downloadwallet-core-33c0267b37eecf44dc9f04e124eb44d27cba700c.tar.xz
settings and preferences, getting conversion info
Diffstat (limited to 'packages/demobank-ui/src/pages/RegistrationPage.tsx')
-rw-r--r--packages/demobank-ui/src/pages/RegistrationPage.tsx17
1 files changed, 10 insertions, 7 deletions
diff --git a/packages/demobank-ui/src/pages/RegistrationPage.tsx b/packages/demobank-ui/src/pages/RegistrationPage.tsx
index fdaa28bbb..9c3b21097 100644
--- a/packages/demobank-ui/src/pages/RegistrationPage.tsx
+++ b/packages/demobank-ui/src/pages/RegistrationPage.tsx
@@ -15,18 +15,18 @@
*/
import { AccessToken, Logger, TranslatedString } from "@gnu-taler/taler-util";
import {
+ LocalNotificationBanner,
+ ShowInputErrorLabel,
useLocalNotification,
useTranslationContext
} from "@gnu-taler/web-util/browser";
import { Fragment, VNode, h } from "preact";
import { useState } from "preact/hooks";
-import { ShowInputErrorLabel } from "@gnu-taler/web-util/browser";
import { useBankCoreApiContext } from "../context/config.js";
import { useBackendState } from "../hooks/backend.js";
-import { bankUiSettings } from "../settings.js";
-import { undefinedIfEmpty, withRuntimeErrorHandling } from "../utils.js";
+import { undefinedIfEmpty } from "../utils.js";
import { getRandomPassword, getRandomUsername } from "./rnd.js";
-import { LocalNotificationBanner } from "@gnu-taler/web-util/browser";
+import { useSettingsContext } from "../context/settings.js";
const logger = new Logger("RegistrationPage");
@@ -38,7 +38,8 @@ export function RegistrationPage({
onCancel: () => void;
}): VNode {
const { i18n } = useTranslationContext();
- if (!bankUiSettings.allowRegistrations) {
+ const {config} = useBankCoreApiContext();
+ if (!config.allow_registrations) {
return (
<p>{i18n.str`Currently, the bank is not accepting new registrations!`}</p>
);
@@ -62,6 +63,7 @@ function RegistrationForm({ onComplete, onCancel }: { onComplete: () => void, on
const [email, setEmail] = useState<string | undefined>();
const [repeatPassword, setRepeatPassword] = useState<string | undefined>();
const [notification, notify, handleError] = useLocalNotification()
+ const settings = useSettingsContext();
const { api } = useBankCoreApiContext()
// const { register } = useTestingAPI();
@@ -177,7 +179,8 @@ function RegistrationForm({ onComplete, onCancel }: { onComplete: () => void, on
async function doRandomRegistration(tries: number = 3) {
const user = getRandomUsername();
- const pass = getRandomPassword();
+
+ const pass = settings.simplePasswordForRandomAccounts ? "123" : getRandomPassword();
const username = `_${user.first}-${user.second}_`
await doRegistrationAndLogin(name, username, pass)
onComplete();
@@ -389,7 +392,7 @@ function RegistrationForm({ onComplete, onCancel }: { onComplete: () => void, on
</form>
- {bankUiSettings.allowRandomAccountCreation &&
+ {settings.allowRandomAccountCreation &&
<p class="mt-10 text-center text-sm text-gray-500 border-t">
<button type="submit"
class="flex mt-4 w-full justify-center rounded-md bg-green-600 px-3 py-1.5 text-sm font-semibold leading-6 text-white shadow-sm hover:bg-green-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-green-600"