|
@ -5,7 +5,7 @@ import settings from 'electron-settings'; |
|
|
import { Button, Form, ControlLabel, Message } from 'rsuite'; |
|
|
import { Button, Form, ControlLabel, Message } from 'rsuite'; |
|
|
import axios from 'axios'; |
|
|
import axios from 'axios'; |
|
|
import setDefaultSettings from '../shared/setDefaultSettings'; |
|
|
import setDefaultSettings from '../shared/setDefaultSettings'; |
|
|
import { StyledInput } from '../shared/styled'; |
|
|
import { StyledInput, StyledInputGroup } from '../shared/styled'; |
|
|
import { LoginPanel } from './styled'; |
|
|
import { LoginPanel } from './styled'; |
|
|
import GenericPage from '../layout/GenericPage'; |
|
|
import GenericPage from '../layout/GenericPage'; |
|
|
|
|
|
|
|
@ -29,14 +29,12 @@ const Login = () => { |
|
|
// Since a valid request will return a 200 response, we need to check that there
|
|
|
// Since a valid request will return a 200 response, we need to check that there
|
|
|
// are no additional failures reported by the server
|
|
|
// are no additional failures reported by the server
|
|
|
if (testConnection.data['subsonic-response'].status === 'failed') { |
|
|
if (testConnection.data['subsonic-response'].status === 'failed') { |
|
|
setMessage( |
|
|
setMessage(`${testConnection.data['subsonic-response'].error.message}`); |
|
|
`Connection error: ${testConnection.data['subsonic-response'].error.message}` |
|
|
|
|
|
); |
|
|
|
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
} catch (err) { |
|
|
} catch (err) { |
|
|
if (err instanceof Error) { |
|
|
if (err instanceof Error) { |
|
|
setMessage(`Connection error: ${err.message}`); |
|
|
setMessage(`${err.message}`); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
setMessage('An unknown error occurred'); |
|
|
setMessage('An unknown error occurred'); |
|
@ -69,24 +67,28 @@ const Login = () => { |
|
|
<LoginPanel bordered> |
|
|
<LoginPanel bordered> |
|
|
{message !== '' && <Message type="error" description={message} />} |
|
|
{message !== '' && <Message type="error" description={message} />} |
|
|
<Form id="login-form" fluid style={{ paddingTop: '20px' }}> |
|
|
<Form id="login-form" fluid style={{ paddingTop: '20px' }}> |
|
|
<ControlLabel>Server hostname</ControlLabel> |
|
|
<ControlLabel>Server</ControlLabel> |
|
|
|
|
|
<StyledInputGroup> |
|
|
<StyledInput |
|
|
<StyledInput |
|
|
id="login-servername" |
|
|
id="login-servername" |
|
|
name="servername" |
|
|
name="servername" |
|
|
value={serverName} |
|
|
value={serverName} |
|
|
onChange={(e: string) => setServerName(e)} |
|
|
onChange={(e: string) => setServerName(e)} |
|
|
/> |
|
|
/> |
|
|
|
|
|
</StyledInputGroup> |
|
|
<br /> |
|
|
<br /> |
|
|
<ControlLabel>Username</ControlLabel> |
|
|
<ControlLabel>Username</ControlLabel> |
|
|
|
|
|
<StyledInputGroup> |
|
|
<StyledInput |
|
|
<StyledInput |
|
|
id="login-username" |
|
|
id="login-username" |
|
|
name="name" |
|
|
name="name" |
|
|
value={userName} |
|
|
value={userName} |
|
|
onChange={(e: string) => setUserName(e)} |
|
|
onChange={(e: string) => setUserName(e)} |
|
|
/> |
|
|
/> |
|
|
|
|
|
</StyledInputGroup> |
|
|
<br /> |
|
|
<br /> |
|
|
|
|
|
|
|
|
<ControlLabel>Password</ControlLabel> |
|
|
<ControlLabel>Password</ControlLabel> |
|
|
|
|
|
<StyledInputGroup> |
|
|
<StyledInput |
|
|
<StyledInput |
|
|
id="login-password" |
|
|
id="login-password" |
|
|
name="password" |
|
|
name="password" |
|
@ -94,6 +96,7 @@ const Login = () => { |
|
|
value={password} |
|
|
value={password} |
|
|
onChange={(e: string) => setPassword(e)} |
|
|
onChange={(e: string) => setPassword(e)} |
|
|
/> |
|
|
/> |
|
|
|
|
|
</StyledInputGroup> |
|
|
<br /> |
|
|
<br /> |
|
|
<Button |
|
|
<Button |
|
|
id="login-button" |
|
|
id="login-button" |
|
|