gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] 02/03: Enable 'enter' keystroke support for login page


From: gnunet
Subject: [libeufin] 02/03: Enable 'enter' keystroke support for login page
Date: Thu, 18 Jun 2020 18:18:40 +0200

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

heng-yeow pushed a commit to branch master
in repository libeufin.

commit b6c1f45066da01cb28bbdd8e2d81c1c2bb8ed872
Author: tanhengyeow <E0032242@u.nus.edu>
AuthorDate: Fri Jun 19 00:17:45 2020 +0800

    Enable 'enter' keystroke support for login page
---
 frontend/src/components/login/Index.tsx | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/frontend/src/components/login/Index.tsx 
b/frontend/src/components/login/Index.tsx
index e73e234..15f2b50 100644
--- a/frontend/src/components/login/Index.tsx
+++ b/frontend/src/components/login/Index.tsx
@@ -20,6 +20,21 @@ const Login = ({ loginConnect }: Props) => {
     wrapperCol: { span: 32 },
   };
 
+  const login = () => {
+    loginConnect(nexusURL, username, password)
+      .then(() => {
+        setAuthenticationFailure(false);
+      })
+      .catch((err) => setAuthenticationFailure(true));
+  };
+
+  const enterPressed = (event) => {
+    let code = event.keyCode || event.which;
+    if (code === 13) {
+      login();
+    }
+  };
+
   return (
     <div className="login">
       {authenticationFailure ? (
@@ -43,25 +58,21 @@ const Login = ({ loginConnect }: Props) => {
           <Input
             placeholder="Username"
             onChange={(e) => setUsername(e.target.value)}
+            onKeyPress={(e) => enterPressed(e)}
           />
         </Form.Item>
         <Form.Item>
           <Input.Password
             placeholder="Password"
             onChange={(e) => setPassword(e.target.value)}
+            onKeyPress={(e) => enterPressed(e)}
           />
         </Form.Item>
         <div className="button">
           <Button
             type="primary"
             icon={<LoginOutlined />}
-            onClick={() =>
-              loginConnect(nexusURL, username, password)
-                .then(() => {
-                  setAuthenticationFailure(false);
-                })
-                .catch((err) => setAuthenticationFailure(true))
-            }
+            onClick={() => login()}
           >
             Login
           </Button>

-- 
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]