Remove login form, only allow the SudoVanilla Gateway
This commit is contained in:
parent
5686e9db83
commit
8a0c3a0745
1 changed files with 4 additions and 64 deletions
|
@ -4,17 +4,13 @@ import {
|
|||
Card,
|
||||
Center,
|
||||
CheckIcon,
|
||||
Divider,
|
||||
Group,
|
||||
Modal,
|
||||
PasswordInput,
|
||||
PinInput,
|
||||
Text,
|
||||
TextInput,
|
||||
Title,
|
||||
} from '@mantine/core';
|
||||
import { useForm } from '@mantine/form';
|
||||
import { IconBrandDiscordFilled, IconBrandGithub, IconBrandGoogle, IconKey } from '@tabler/icons-react';
|
||||
import useFetch from 'hooks/useFetch';
|
||||
import Head from 'next/head';
|
||||
import Link from 'next/link';
|
||||
|
@ -24,7 +20,6 @@ export { getServerSideProps } from 'middleware/getServerSideProps';
|
|||
|
||||
export default function Login({
|
||||
title,
|
||||
user_registration,
|
||||
oauth_registration,
|
||||
bypass_local_login,
|
||||
oauth_providers: unparsed,
|
||||
|
@ -40,20 +35,6 @@ export default function Login({
|
|||
|
||||
const oauth_providers = JSON.parse(unparsed);
|
||||
|
||||
const show_local_login =
|
||||
router.query.local === 'true' || !(bypass_local_login && oauth_providers?.length > 0);
|
||||
|
||||
const icons = {
|
||||
GitHub: IconBrandGithub,
|
||||
Discord: IconBrandDiscordFilled,
|
||||
Google: IconBrandGoogle,
|
||||
Authentik: IconKey,
|
||||
};
|
||||
|
||||
for (const provider of oauth_providers) {
|
||||
provider.Icon = icons[provider.name];
|
||||
}
|
||||
|
||||
const form = useForm({
|
||||
initialValues: {
|
||||
username: '',
|
||||
|
@ -124,7 +105,7 @@ export default function Login({
|
|||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>{full_title}</title>
|
||||
<title>SudoVanilla Zipline</title>
|
||||
</Head>
|
||||
<Modal
|
||||
opened={totpOpen}
|
||||
|
@ -166,11 +147,6 @@ export default function Login({
|
|||
</Button>
|
||||
</Modal>
|
||||
<Center sx={{ height: '100vh' }}>
|
||||
<Card radius='md'>
|
||||
<Title size={30} align='left'>
|
||||
{bypass_local_login ? ` Login to ${title} with` : title}
|
||||
</Title>
|
||||
|
||||
{oauth_registration && (
|
||||
<>
|
||||
<Group grow>
|
||||
|
@ -178,55 +154,19 @@ export default function Login({
|
|||
<Button
|
||||
key={i}
|
||||
size='sm'
|
||||
variant='outline'
|
||||
radius='md'
|
||||
variant='filled'
|
||||
radius='lg'
|
||||
fullWidth
|
||||
leftIcon={<Icon size='1rem' />}
|
||||
my='xs'
|
||||
component={Link}
|
||||
href={url}
|
||||
>
|
||||
{name}
|
||||
Login via SudoVanilla Gateway
|
||||
</Button>
|
||||
))}
|
||||
</Group>
|
||||
{show_local_login && <Divider my='xs' label='or' labelPosition='center' />}
|
||||
</>
|
||||
)}
|
||||
|
||||
{show_local_login && (
|
||||
<form onSubmit={form.onSubmit((v) => onSubmit(v))}>
|
||||
<TextInput
|
||||
my='xs'
|
||||
radius='md'
|
||||
size='md'
|
||||
id='username'
|
||||
label='Username'
|
||||
{...form.getInputProps('username')}
|
||||
/>
|
||||
<PasswordInput
|
||||
my='xs'
|
||||
radius='md'
|
||||
size='md'
|
||||
id='password'
|
||||
label='Password'
|
||||
{...form.getInputProps('password')}
|
||||
/>
|
||||
|
||||
<Group position='apart'>
|
||||
{user_registration && (
|
||||
<Anchor size='xs' href='/auth/register' component={Link}>
|
||||
Don't have an account? Register
|
||||
</Anchor>
|
||||
)}
|
||||
|
||||
<Button size='sm' p='xs' radius='md' my='xs' type='submit' loading={loading}>
|
||||
Login
|
||||
</Button>
|
||||
</Group>
|
||||
</form>
|
||||
)}
|
||||
</Card>
|
||||
</Center>
|
||||
</>
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue