gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-merchant-backoffice] branch master updated (db35cb9 -> c4665cc)


From: gnunet
Subject: [taler-merchant-backoffice] branch master updated (db35cb9 -> c4665cc)
Date: Mon, 31 May 2021 16:59:50 +0200

This is an automated email from the git hooks/post-receive script.

sebasjm pushed a change to branch master
in repository merchant-backoffice.

    from db35cb9  add tooltip for ‘<InputSelector<Entity> name="wire_method"’
     new bb786c9  prevent login dialog to be updated with secret-token
     new c4665cc  fix lint

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../frontend/src/components/exception/login.tsx    | 26 ++++++++++++----------
 .../instance/reserves/list/AutorizeTipModal.tsx    |  4 ++--
 2 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/packages/frontend/src/components/exception/login.tsx 
b/packages/frontend/src/components/exception/login.tsx
index 611af1a..e7c9802 100644
--- a/packages/frontend/src/components/exception/login.tsx
+++ b/packages/frontend/src/components/exception/login.tsx
@@ -31,18 +31,20 @@ interface Props {
   onConfirm: (backend: string, token?: string) => void;
 }
 
+function getTokenValuePart(t?: string): string | undefined {
+  if (!t) return t
+  const match = /secret-token:(.*)/.exec(t);
+  if (!match || !match[1]) return undefined;
+  return match[1]
+}
+
+
 export function LoginModal({ onConfirm, withMessage }: Props): VNode {
   const { url: backendUrl, token: baseToken } = useBackendContext()
   const { admin, token: instanceToken } = useInstanceContext()
-  const [token, setToken] = useState(!admin ? baseToken : instanceToken || '')
+  const currentToken = getTokenValuePart(!admin ? baseToken : instanceToken || 
'')
+  const [token, setToken] = useState(currentToken)
   
-  function updateToken(token:string) {
-    const value = token && token.startsWith('secret-token:')?
-      token.substring('secret-token:'.length) : token
-
-    setToken(`secret-token:${value}`)
-  }
-
   const [url, setURL] = useState(backendUrl)
   const i18n = useTranslator()
 
@@ -63,7 +65,7 @@ export function LoginModal({ onConfirm, withMessage }: 
Props): VNode {
                 <p class="control is-expanded">
                   <input class="input" type="text" placeholder="set new url" 
name="id"
                     value={url}
-                    onKeyPress={e => e.keyCode === 13 ? onConfirm(url, token ? 
token : undefined) : null}
+                    onKeyPress={e => e.keyCode === 13 ? onConfirm(url, token ? 
`secret-token:${token}` : undefined) : null}
                     onInput={(e): void => setURL(e?.currentTarget.value)}
                   />
                 </p>
@@ -78,9 +80,9 @@ export function LoginModal({ onConfirm, withMessage }: 
Props): VNode {
               <div class="field">
                 <p class="control is-expanded">
                   <input class="input" type="text" placeholder={"set new 
token"} name="token"
-                    onKeyPress={e => e.keyCode === 13 ? onConfirm(url, token ? 
token : undefined) : null}
+                    onKeyPress={e => e.keyCode === 13 ? onConfirm(url, token ? 
`secret-token:${token}` : undefined) : null}
                     value={token} 
-                    onInput={(e): void => updateToken(e?.currentTarget.value)}
+                    onInput={(e): void => setToken(e?.currentTarget.value)}
                   />
                 </p>
               </div>
@@ -89,7 +91,7 @@ export function LoginModal({ onConfirm, withMessage }: 
Props): VNode {
         </section>
         <footer class="modal-card-foot " style={{ justifyContent: 'flex-end', 
border: '1px solid', borderTop: 0 }} >
           <button class="button is-info" onClick={(): void => {
-            onConfirm(url, token ? token : undefined);
+            onConfirm(url, token ? `secret-token:${token}` : undefined);
           }} ><Translate>Confirm</Translate></button>
         </footer>
       </div>
diff --git 
a/packages/frontend/src/paths/instance/reserves/list/AutorizeTipModal.tsx 
b/packages/frontend/src/paths/instance/reserves/list/AutorizeTipModal.tsx
index 633559e..a4b8af8 100644
--- a/packages/frontend/src/paths/instance/reserves/list/AutorizeTipModal.tsx
+++ b/packages/frontend/src/paths/instance/reserves/list/AutorizeTipModal.tsx
@@ -71,8 +71,8 @@ export function AuthorizeTipModal({ onCancel, onConfirm, 
tipAuthorized }: Author
   return <ConfirmModal description="tip" active onCancel={onCancel} 
disabled={hasErrors} onConfirm={validateAndConfirm}>
 
     <FormProvider<State> errors={errors} object={form} valueHandler={setValue} 
>
-      <InputCurrency<State> name="amount" label={i18n`Amount`} 
tooltip={i18n`amount of tip`}/>
-      <Input<State> name="justification" label={i18n`Justification`} 
inputType="multiline" tooltip={i18n`reason for the tip`}/>
+      <InputCurrency<State> name="amount" label={i18n`Amount`} 
tooltip={i18n`amount of tip`} />
+      <Input<State> name="justification" label={i18n`Justification`} 
inputType="multiline" tooltip={i18n`reason for the tip`} />
       <Input<State> name="next_url" label={i18n`URL after tip`} 
tooltip={i18n`URL to visit after tip payment`} />
     </FormProvider>
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]