summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorMS <ms@taler.net>2022-09-08 17:10:14 +0200
committerMS <ms@taler.net>2022-09-08 17:10:14 +0200
commitd236cd90cfb8df3c5ab846dc400821b6b414c8a1 (patch)
tree6ce6e8c9f294032ae781179f27a2cf7b9e60b609 /packages
parent8b243bc0e4161281ed5f76ad6b9ff69cdf7e9c7f (diff)
downloadmerchant-backoffice-d236cd90cfb8df3c5ab846dc400821b6b414c8a1.tar.gz
merchant-backoffice-d236cd90cfb8df3c5ab846dc400821b6b414c8a1.tar.bz2
merchant-backoffice-d236cd90cfb8df3c5ab846dc400821b6b414c8a1.zip
login and registration forms
clean credentials state after the submission. At this point, the cleanup happens regardless of the outcome; in future versions, the credentials should be kept upon failures.
Diffstat (limited to 'packages')
-rw-r--r--packages/bank/src/pages/home/index.tsx30
1 files changed, 15 insertions, 15 deletions
diff --git a/packages/bank/src/pages/home/index.tsx b/packages/bank/src/pages/home/index.tsx
index 110adf2..51cceb2 100644
--- a/packages/bank/src/pages/home/index.tsx
+++ b/packages/bank/src/pages/home/index.tsx
@@ -11,10 +11,9 @@ import talerLogo from "../../assets/logo-white.svg";
import { LangSelectorLikePy as LangSelector} from "../../components/menu/LangSelector";
// Uncomment to allow test runs:
-
-/*const __LIBEUFIN_UI_ALLOW_REGISTRATIONS__ = 1;
-const __LIBEUFIN_UI_IS_DEMO__ = 0;
-const __LIBEUFIN_UI_BANK_NAME__ = 0;*/
+// const __LIBEUFIN_UI_ALLOW_REGISTRATIONS__ = 1;
+// const __LIBEUFIN_UI_IS_DEMO__ = 0;
+// const __LIBEUFIN_UI_BANK_NAME__ = 0;
/**
* FIXME:
@@ -1232,6 +1231,7 @@ function LoginForm(Props: any): VNode {
<div class="pure-form">
<input
type="text"
+ value={submitData && submitData.username}
placeholder="username"
required
onInput={(e): void => {
@@ -1241,6 +1241,7 @@ function LoginForm(Props: any): VNode {
}))}} />
<input
type="password"
+ value={submitData && submitData.password}
placeholder="password"
required
onInput={(e): void => {
@@ -1256,10 +1257,13 @@ function LoginForm(Props: any): VNode {
if (typeof submitData === "undefined") return;
if (submitData.password.length > 0 && submitData.username.length > 0)
loginCall(
- submitData,
+ // Deep copy, to avoid the cleanup
+ // below make data disappear.
+ {...submitData},
backendStateSetter,
pageStateSetter
);
+ submitDataSetter(undefined);
}}>{i18n`Login`}</button>
</div>
</form>);
@@ -1290,6 +1294,7 @@ function RegistrationForm(Props: any): VNode {
<input
type="text"
placeholder="username"
+ value={submitData && submitData.username}
required
autofocus
onInput={(e): void => {
@@ -1300,6 +1305,7 @@ function RegistrationForm(Props: any): VNode {
<input
type="password"
placeholder="password"
+ value={submitData && submitData.password}
required
autofocus
onInput={(e): void => {
@@ -1320,10 +1326,11 @@ function RegistrationForm(Props: any): VNode {
submitData.username.length === 0) return;
console.log("submitting the registration..");
registrationCall(
- submitData,
+ {...submitData},
Props.backendStateSetter, // will store BE URL, if OK.
pageStateSetter
- );}}>{i18n`Register`}</button>
+ );
+ submitDataSetter(undefined)}}>{i18n`Register`}</button>
</form>
</div>
</article>
@@ -1450,9 +1457,7 @@ function Account(Props: any): VNode {
* login would cache a 404 error to X's profile, resulting
* in the legitimate request after the registration to still
* be flagged as 404. Clearing the cache should prevent
- * this and likely not pose additional problems (given that
- * the user couldn't have been logged before).
- */
+ * this. */
(cache as any).clear();
return <p>Profile not found...</p>;
}
@@ -1742,11 +1747,6 @@ export function BankHome(): VNode {
</PageContext.Provider>
);
}
- /**
- * Credentials were correct, now render the bank account page,
- * with balance, transactions history, and a Taler withdrawal
- * button.
- */
if (pageState.isLoggedIn) {
if (typeof backendState === "undefined") {
pageStateSetter((prevState) => ({