mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-17 17:55:42 +00:00
feat: add login grid
This commit is contained in:
parent
34b0ce7a9b
commit
b569083db6
@ -1,13 +1,19 @@
|
||||
import React, {createContext, useContext, useEffect, useState} from "react";
|
||||
import {Alert, Button, Card, Flex, Form, Input} from "antd";
|
||||
import {Alert, Button, Card, Form, Input} from "antd";
|
||||
import {getConfiguration, getUser, InstanceConfig, login} from "../utils/api";
|
||||
import {useNavigate} from "react-router-dom";
|
||||
import {t} from 'ttag'
|
||||
import TextPage from "./TextPage";
|
||||
|
||||
type FieldType = {
|
||||
username: string;
|
||||
password: string;
|
||||
};
|
||||
}
|
||||
|
||||
const gridStyle: React.CSSProperties = {
|
||||
width: '50%',
|
||||
textAlign: 'center',
|
||||
}
|
||||
|
||||
export const AuthenticatedContext = createContext<any>(null)
|
||||
|
||||
@ -24,7 +30,11 @@ export default function LoginPage() {
|
||||
navigate('/home')
|
||||
}).catch((e) => {
|
||||
setIsAuthenticated(false)
|
||||
if (e.response.data.message !== undefined) {
|
||||
setError(e.response.data.message)
|
||||
} else {
|
||||
setError(e.response.data['hydra:description'])
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -36,9 +46,8 @@ export default function LoginPage() {
|
||||
getConfiguration().then(setConfiguration)
|
||||
}, [])
|
||||
|
||||
return <Flex gap="middle" align="center" justify="center" vertical><Card
|
||||
title={t`Log in`}
|
||||
>
|
||||
return <Card title={t`Log in`} style={{width: '100%'}}>
|
||||
<Card.Grid style={gridStyle} hoverable={false}>
|
||||
{error &&
|
||||
<Alert
|
||||
type='error'
|
||||
@ -73,16 +82,19 @@ export default function LoginPage() {
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item wrapperCol={{offset: 8, span: 16}}>
|
||||
<Button type="primary" htmlType="submit">
|
||||
<Button block type="primary" htmlType="submit">
|
||||
{t`Submit`}
|
||||
</Button>
|
||||
</Form.Item>
|
||||
{configuration?.ssoLogin && <Form.Item wrapperCol={{offset: 8, span: 16}}>
|
||||
<Button type="primary" htmlType="button" href="/login/oauth">
|
||||
<Button type="dashed" htmlType="button" href="/login/oauth" block>
|
||||
{t`Log in with SSO`}
|
||||
</Button>
|
||||
</Form.Item>}
|
||||
</Form>
|
||||
</Card.Grid>
|
||||
<Card.Grid style={gridStyle} hoverable={false}>
|
||||
<TextPage resource='ads.md'/>
|
||||
</Card.Grid>
|
||||
</Card>
|
||||
</Flex>
|
||||
}
|
||||
@ -33,7 +33,7 @@ readonly class JWTAuthenticator implements AuthenticationSuccessHandlerInterface
|
||||
public function handleAuthenticationSuccess(UserInterface $user, $jwt = null): Response
|
||||
{
|
||||
if (($user instanceof User) && !$user->isVerified()) {
|
||||
throw new AccessDeniedHttpException('This user has not yet validated their email address.');
|
||||
throw new AccessDeniedHttpException('You have not yet validated your email address.');
|
||||
}
|
||||
|
||||
if (null === $jwt) {
|
||||
|
||||
@ -57,8 +57,8 @@ msgstr ""
|
||||
#: assets/components/tracking/ConnectorForm.tsx:110
|
||||
#: assets/components/tracking/ConnectorForm.tsx:119
|
||||
#: assets/components/tracking/WatchlistForm.tsx:103
|
||||
#: assets/pages/LoginPage.tsx:62
|
||||
#: assets/pages/LoginPage.tsx:70
|
||||
#: assets/pages/LoginPage.tsx:71
|
||||
#: assets/pages/LoginPage.tsx:79
|
||||
msgid "Required"
|
||||
msgstr ""
|
||||
|
||||
@ -326,7 +326,7 @@ msgid "Log out"
|
||||
msgstr ""
|
||||
|
||||
#: assets/components/Sider.tsx:120
|
||||
#: assets/pages/LoginPage.tsx:40
|
||||
#: assets/pages/LoginPage.tsx:49
|
||||
msgid "Log in"
|
||||
msgstr ""
|
||||
|
||||
@ -434,7 +434,7 @@ msgid ""
|
||||
"their country of origin."
|
||||
msgstr ""
|
||||
|
||||
#: assets/pages/LoginPage.tsx:60
|
||||
#: assets/pages/LoginPage.tsx:69
|
||||
#: assets/pages/watchdog/UserPage.tsx:18
|
||||
msgid "Username"
|
||||
msgstr ""
|
||||
@ -463,19 +463,19 @@ msgstr ""
|
||||
msgid "Sorry, the page you visited does not exist."
|
||||
msgstr ""
|
||||
|
||||
#: assets/pages/LoginPage.tsx:45
|
||||
#: assets/pages/LoginPage.tsx:54
|
||||
msgid "Error"
|
||||
msgstr ""
|
||||
|
||||
#: assets/pages/LoginPage.tsx:68
|
||||
#: assets/pages/LoginPage.tsx:77
|
||||
msgid "Password"
|
||||
msgstr ""
|
||||
|
||||
#: assets/pages/LoginPage.tsx:77
|
||||
#: assets/pages/LoginPage.tsx:86
|
||||
msgid "Submit"
|
||||
msgstr ""
|
||||
|
||||
#: assets/pages/LoginPage.tsx:82
|
||||
#: assets/pages/LoginPage.tsx:91
|
||||
msgid "Log in with SSO"
|
||||
msgstr ""
|
||||
|
||||
@ -531,7 +531,7 @@ msgstr ""
|
||||
msgid "Documentation"
|
||||
msgstr ""
|
||||
|
||||
#: assets/App.tsx:106
|
||||
#: assets/App.tsx:107
|
||||
#, javascript-format
|
||||
msgid ""
|
||||
"${ ProjectLink } is an open source project distributed under the ${ "
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user