X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/70346cc28458475026a54c0d4ac1df2264080d55..3c7e3cdc547ad5468421e1c049daa94b0d4b8bc0:/src/views-components/login-form/login-form.tsx diff --git a/src/views-components/login-form/login-form.tsx b/src/views-components/login-form/login-form.tsx index 2d4451c6..e4ede79b 100644 --- a/src/views-components/login-form/login-form.tsx +++ b/src/views-components/login-form/login-form.tsx @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: AGPL-3.0 -import * as React from 'react'; +import React from 'react'; import { useState, useEffect, useRef } from 'react'; import { withStyles, WithStyles, StyleRulesCallback } from '@material-ui/core/styles'; import CircularProgress from '@material-ui/core/CircularProgress'; @@ -10,8 +10,8 @@ import { Button, Card, CardContent, TextField, CardActions } from '@material-ui/ import { green } from '@material-ui/core/colors'; import { AxiosPromise } from 'axios'; import { DispatchProp } from 'react-redux'; -import { saveApiToken } from '~/store/auth/auth-action'; -import { navigateToRootProject } from '~/store/navigation/navigation-action'; +import { saveApiToken } from 'store/auth/auth-action'; +import { navigateToRootProject } from 'store/navigation/navigation-action'; type CssRules = 'root' | 'loginBtn' | 'card' | 'wrapper' | 'progress'; @@ -46,10 +46,11 @@ const styles: StyleRulesCallback = theme => ({ type LoginFormProps = DispatchProp & WithStyles & { handleSubmit: (username: string, password: string) => AxiosPromise; + loginLabel?: string, }; export const LoginForm = withStyles(styles)( - ({ handleSubmit, dispatch, classes }: LoginFormProps) => { + ({ handleSubmit, loginLabel, dispatch, classes }: LoginFormProps) => { const userInput = useRef(null); const [username, setUsername] = useState(''); const [password, setPassword] = useState(''); @@ -84,8 +85,8 @@ export const LoginForm = withStyles(styles)( handleSubmit(username, password) .then((response) => { setSubmitting(false); - const apiToken = response.data.token; - if (apiToken) { + if (response.data.uuid && response.data.api_token) { + const apiToken = `v2/${response.data.uuid}/${response.data.api_token}`; dispatch(saveApiToken(apiToken)).finally( () => dispatch(navigateToRootProject)); } else { @@ -137,7 +138,7 @@ export const LoginForm = withStyles(styles)( { isSubmitting && }