mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
fix: login redirect
This commit is contained in:
1
.env
1
.env
@@ -57,7 +57,6 @@ JWT_PASSPHRASE=827c9f8cce8bb82e75b2aec4a14a61f572ac28c7a8531f08dcdf1652573a7049
|
|||||||
LOCK_DSN=flock
|
LOCK_DSN=flock
|
||||||
###< symfony/lock ###
|
###< symfony/lock ###
|
||||||
|
|
||||||
OAUTH_AUTHORIZATION_URL=
|
|
||||||
OAUTH_CLIENT_ID=
|
OAUTH_CLIENT_ID=
|
||||||
OAUTH_CLIENT_SECRET=
|
OAUTH_CLIENT_SECRET=
|
||||||
OAUTH_AUTHORIZATION_URL=
|
OAUTH_AUTHORIZATION_URL=
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ export default function App() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getUser().then(() => {
|
getUser().then(() => {
|
||||||
setIsAuthenticated(true)
|
setIsAuthenticated(true)
|
||||||
if (location.pathname === '/login') navigate('/search/domain')
|
if (location.pathname === '/login') navigate('/home')
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
setIsAuthenticated(false)
|
setIsAuthenticated(false)
|
||||||
navigate('/home')
|
navigate('/home')
|
||||||
|
|||||||
@@ -1,12 +1,17 @@
|
|||||||
import {Card, Divider, Popconfirm, Typography} from "antd";
|
import {Card, Divider, Popconfirm, theme, Typography} from "antd";
|
||||||
import {t} from "ttag";
|
import {t} from "ttag";
|
||||||
import {DeleteFilled} from "@ant-design/icons";
|
import {DeleteFilled} from "@ant-design/icons";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import {Connector, deleteConnector} from "../../utils/api/connectors";
|
import {Connector, deleteConnector} from "../../utils/api/connectors";
|
||||||
|
|
||||||
|
const {useToken} = theme;
|
||||||
|
|
||||||
|
|
||||||
type ConnectorElement = Connector & { id: string }
|
type ConnectorElement = Connector & { id: string }
|
||||||
|
|
||||||
export function ConnectorsList({connectors, onDelete}: { connectors: ConnectorElement[], onDelete: () => void }) {
|
export function ConnectorsList({connectors, onDelete}: { connectors: ConnectorElement[], onDelete: () => void }) {
|
||||||
|
const {token} = useToken()
|
||||||
|
|
||||||
return <>
|
return <>
|
||||||
{connectors.map(connector =>
|
{connectors.map(connector =>
|
||||||
<>
|
<>
|
||||||
@@ -16,7 +21,7 @@ export function ConnectorsList({connectors, onDelete}: { connectors: ConnectorEl
|
|||||||
onConfirm={() => deleteConnector(connector.id).then(onDelete)}
|
onConfirm={() => deleteConnector(connector.id).then(onDelete)}
|
||||||
okText={t`Yes`}
|
okText={t`Yes`}
|
||||||
cancelText={t`No`}
|
cancelText={t`No`}
|
||||||
><DeleteFilled/> </Popconfirm>}>
|
><DeleteFilled style={{color: token.colorError}}/></Popconfirm>}>
|
||||||
<Typography.Paragraph>
|
<Typography.Paragraph>
|
||||||
{t`Provider`} : {connector.provider}
|
{t`Provider`} : {connector.provider}
|
||||||
</Typography.Paragraph>
|
</Typography.Paragraph>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React, {createContext, useContext, useState} from "react";
|
import React, {createContext, useContext, useEffect, useState} from "react";
|
||||||
import {Alert, Button, Card, Flex, Form, Input} from "antd";
|
import {Alert, Button, Card, Flex, Form, Input} from "antd";
|
||||||
import {login} from "../utils/api";
|
import {getUser, login} from "../utils/api";
|
||||||
import {useNavigate} from "react-router-dom";
|
import {useNavigate} from "react-router-dom";
|
||||||
import {t} from 'ttag'
|
import {t} from 'ttag'
|
||||||
|
|
||||||
@@ -11,7 +11,7 @@ type FieldType = {
|
|||||||
|
|
||||||
export const AuthenticatedContext = createContext<any>(null)
|
export const AuthenticatedContext = createContext<any>(null)
|
||||||
|
|
||||||
export default function Page() {
|
export default function LoginPage() {
|
||||||
|
|
||||||
const [error, setError] = useState()
|
const [error, setError] = useState()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
@@ -27,6 +27,13 @@ export default function Page() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getUser().then(() => {
|
||||||
|
setIsAuthenticated(true)
|
||||||
|
navigate('/home')
|
||||||
|
})
|
||||||
|
}, [])
|
||||||
|
|
||||||
return <Flex gap="middle" align="center" justify="center" vertical><Card
|
return <Flex gap="middle" align="center" justify="center" vertical><Card
|
||||||
title={t`Log in`}
|
title={t`Log in`}
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user