[arvados-workbench2] updated: 2.6.3-39-g6159c98c

git repository hosting git at public.arvados.org
Fri Aug 18 18:23:15 UTC 2023


Summary of changes:
 src/views-components/login-form/login-form.tsx | 106 +++++++++++++------------
 1 file changed, 55 insertions(+), 51 deletions(-)

       via  6159c98c7ece2f9e0291482dba4b62e208b87343 (commit)
      from  4a389adfd855075773d7b5419891cfecd3d9b5dc (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 6159c98c7ece2f9e0291482dba4b62e208b87343
Author: Peter Amstutz <peter.amstutz at curii.com>
Date:   Fri Aug 18 14:22:56 2023 -0400

    18946: Don't navigate away from my-account page on password login
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>

diff --git a/src/views-components/login-form/login-form.tsx b/src/views-components/login-form/login-form.tsx
index 3aa9e3f2..6c590265 100644
--- a/src/views-components/login-form/login-form.tsx
+++ b/src/views-components/login-form/login-form.tsx
@@ -84,27 +84,31 @@ export const LoginForm = withStyles(styles)(
             setHelperText('');
             setSubmitting(true);
             handleSubmit(username, password)
-            .then((response) => {
-                setSubmitting(false);
-                if (response.data.uuid && response.data.api_token) {
-                    const apiToken = `v2/${response.data.uuid}/${response.data.api_token}`;
-                    const rd = new URL(window.location.href);
-                    const rdUrl = rd.pathname + rd.search;
-                    dispatch<any>(saveApiToken(apiToken)).finally(
-                        () => rdUrl === '/' ? dispatch(navigateToRootProject) : dispatch(replace(rdUrl))
-                    );
-                } else {
+                .then((response) => {
+                    setSubmitting(false);
+                    if (response.data.uuid && response.data.api_token) {
+                        const apiToken = `v2/${response.data.uuid}/${response.data.api_token}`;
+                        const rd = new URL(window.location.href);
+                        const rdUrl = rd.pathname + rd.search;
+                        dispatch<any>(saveApiToken(apiToken)).finally(
+                            () => {
+                                if ((new URL(window.location.href).pathname) !== '/my-account') {
+                                    rdUrl === '/' ? dispatch(navigateToRootProject) : dispatch(replace(rdUrl))
+                                }
+                            }
+                        );
+                    } else {
+                        setError(true);
+                        setHelperText(response.data.message || 'Please try again');
+                        setFocus();
+                    }
+                })
+                .catch((err) => {
                     setError(true);
-                    setHelperText(response.data.message || 'Please try again');
+                    setSubmitting(false);
+                    setHelperText(`${(err.response && err.response.data && err.response.data.errors[0]) || 'Error logging in: ' + err}`);
                     setFocus();
-                }
-            })
-            .catch((err) => {
-                setError(true);
-                setSubmitting(false);
-                setHelperText(`${(err.response && err.response.data && err.response.data.errors[0]) || 'Error logging in: '+err}`);
-                setFocus();
-            });
+                });
         };
 
         const handleKeyPress = (e: any) => {
@@ -117,38 +121,38 @@ export const LoginForm = withStyles(styles)(
 
         return (
             <React.Fragment>
-            <form className={classes.root} noValidate autoComplete="off">
-                <Card className={classes.card}>
-                    <div className={classes.wrapper}>
-                    <CardContent>
-                        <TextField
-                            inputRef={userInput}
-                            disabled={isSubmitting}
-                            error={error} fullWidth id="username" type="email"
-                            label="Username" margin="normal"
-                            onChange={(e) => setUsername(e.target.value)}
-                            onKeyPress={(e) => handleKeyPress(e)}
-                        />
-                        <TextField
-                            disabled={isSubmitting}
-                            error={error} fullWidth id="password" type="password"
-                            label="Password" margin="normal"
-                            helperText={helperText}
-                            onChange={(e) => setPassword(e.target.value)}
-                            onKeyPress={(e) => handleKeyPress(e)}
-                        />
-                    </CardContent>
-                    <CardActions>
-                        <Button variant="contained" size="large" color="primary"
-                            className={classes.loginBtn} onClick={() => handleLogin()}
-                            disabled={isSubmitting || isButtonDisabled}>
-                            {loginLabel || 'Log in'}
-                        </Button>
-                    </CardActions>
-                    { isSubmitting && <CircularProgress color='secondary' className={classes.progress} />}
-                    </div>
-                </Card>
-            </form>
+                <form className={classes.root} noValidate autoComplete="off">
+                    <Card className={classes.card}>
+                        <div className={classes.wrapper}>
+                            <CardContent>
+                                <TextField
+                                    inputRef={userInput}
+                                    disabled={isSubmitting}
+                                    error={error} fullWidth id="username" type="email"
+                                    label="Username" margin="normal"
+                                    onChange={(e) => setUsername(e.target.value)}
+                                    onKeyPress={(e) => handleKeyPress(e)}
+                                />
+                                <TextField
+                                    disabled={isSubmitting}
+                                    error={error} fullWidth id="password" type="password"
+                                    label="Password" margin="normal"
+                                    helperText={helperText}
+                                    onChange={(e) => setPassword(e.target.value)}
+                                    onKeyPress={(e) => handleKeyPress(e)}
+                                />
+                            </CardContent>
+                            <CardActions>
+                                <Button variant="contained" size="large" color="primary"
+                                    className={classes.loginBtn} onClick={() => handleLogin()}
+                                    disabled={isSubmitting || isButtonDisabled}>
+                                    {loginLabel || 'Log in'}
+                                </Button>
+                            </CardActions>
+                            {isSubmitting && <CircularProgress color='secondary' className={classes.progress} />}
+                        </div>
+                    </Card>
+                </form>
             </React.Fragment>
         );
     });

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list