Merge branch 'feature/add-basic-authentication' of https://github.com/ajnart/homarr into feature/add-basic-authentication
This commit is contained in:
@@ -5,13 +5,15 @@ import { z } from 'zod';
|
||||
|
||||
interface CreateAccountStepProps {
|
||||
nextStep: ({ eMail, username }: { username: string; eMail: string }) => void;
|
||||
defaultUsername: string;
|
||||
defaultEmail: string;
|
||||
}
|
||||
|
||||
export const CreateAccountStep = ({ nextStep }: CreateAccountStepProps) => {
|
||||
export const CreateAccountStep = ({ defaultEmail, defaultUsername, nextStep }: CreateAccountStepProps) => {
|
||||
const form = useForm({
|
||||
initialValues: {
|
||||
username: '',
|
||||
eMail: '',
|
||||
username: defaultUsername,
|
||||
eMail: defaultEmail,
|
||||
},
|
||||
validateInputOnBlur: true,
|
||||
validateInputOnChange: true,
|
||||
|
||||
@@ -43,17 +43,19 @@ function getStrength(password: string) {
|
||||
}
|
||||
|
||||
interface CreateAccountSecurityStepProps {
|
||||
defaultPassword: string;
|
||||
nextStep: ({ password }: { password: string }) => void;
|
||||
prevStep: () => void;
|
||||
}
|
||||
|
||||
export const CreateAccountSecurityStep = ({
|
||||
defaultPassword,
|
||||
nextStep,
|
||||
prevStep,
|
||||
}: CreateAccountSecurityStepProps) => {
|
||||
const form = useForm({
|
||||
initialValues: {
|
||||
password: '',
|
||||
password: defaultPassword,
|
||||
},
|
||||
validateInputOnBlur: true,
|
||||
validateInputOnChange: true,
|
||||
|
||||
@@ -26,6 +26,7 @@ import {
|
||||
IconUser,
|
||||
IconUsers,
|
||||
} from '@tabler/icons-react';
|
||||
import { useSession } from 'next-auth/react';
|
||||
import Image from 'next/image';
|
||||
import Link from 'next/link';
|
||||
import { ReactNode } from 'react';
|
||||
@@ -47,6 +48,9 @@ export const ManageLayout = ({ children }: ManageLayoutProps) => {
|
||||
const [burgerMenuOpen, { toggle: toggleBurgerMenu, close: closeBurgerMenu }] =
|
||||
useDisclosure(false);
|
||||
|
||||
const data = useSession();
|
||||
const isAdmin = data.data?.user.isAdmin ?? false;
|
||||
|
||||
const navigationLinks = (
|
||||
<>
|
||||
<NavLink
|
||||
@@ -69,37 +73,43 @@ export const ManageLayout = ({ children }: ManageLayoutProps) => {
|
||||
component={Link}
|
||||
href="/manage/boards"
|
||||
/>
|
||||
<NavLink
|
||||
label="Users"
|
||||
icon={
|
||||
<ThemeIcon size="md" variant="light" color="red">
|
||||
<IconUser size="1rem" />
|
||||
</ThemeIcon>
|
||||
}
|
||||
>
|
||||
<NavLink
|
||||
icon={<IconUsers size="1rem" />}
|
||||
label="Manage"
|
||||
component={Link}
|
||||
href="/manage/users"
|
||||
/>
|
||||
<NavLink
|
||||
icon={<IconMailForward size="1rem" />}
|
||||
label="Invites"
|
||||
component={Link}
|
||||
href="/manage/users/invites"
|
||||
/>
|
||||
</NavLink>
|
||||
<NavLink
|
||||
label="Settings"
|
||||
icon={
|
||||
<ThemeIcon size="md" variant="light" color="red">
|
||||
<IconSettings2 size="1rem" />
|
||||
</ThemeIcon>
|
||||
}
|
||||
component={Link}
|
||||
href="/manage/settings"
|
||||
/>
|
||||
|
||||
{isAdmin && (
|
||||
<>
|
||||
<NavLink
|
||||
label="Users"
|
||||
icon={
|
||||
<ThemeIcon size="md" variant="light" color="red">
|
||||
<IconUser size="1rem" />
|
||||
</ThemeIcon>
|
||||
}
|
||||
>
|
||||
<NavLink
|
||||
icon={<IconUsers size="1rem" />}
|
||||
label="Manage"
|
||||
component={Link}
|
||||
href="/manage/users"
|
||||
/>
|
||||
<NavLink
|
||||
icon={<IconMailForward size="1rem" />}
|
||||
label="Invites"
|
||||
component={Link}
|
||||
href="/manage/users/invites"
|
||||
/>
|
||||
</NavLink>
|
||||
<NavLink
|
||||
label="Settings"
|
||||
icon={
|
||||
<ThemeIcon size="md" variant="light" color="red">
|
||||
<IconSettings2 size="1rem" />
|
||||
</ThemeIcon>
|
||||
}
|
||||
component={Link}
|
||||
href="/manage/settings"
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
<NavLink
|
||||
label="Help"
|
||||
icon={
|
||||
|
||||
@@ -2,6 +2,7 @@ import { Avatar, Badge, Menu, UnstyledButton, useMantineTheme } from '@mantine/c
|
||||
import { useDisclosure } from '@mantine/hooks';
|
||||
import {
|
||||
IconDashboard,
|
||||
IconHomeShare,
|
||||
IconInfoCircle,
|
||||
IconLogin,
|
||||
IconLogout,
|
||||
@@ -53,6 +54,9 @@ export const AvatarMenu = () => {
|
||||
<Menu.Item component={Link} href="/board" icon={<IconDashboard size="1rem" />}>
|
||||
{t('actions.avatar.defaultBoard')}
|
||||
</Menu.Item>
|
||||
<Menu.Item component={Link} href="/manage" icon={<IconHomeShare size="1rem" />}>
|
||||
Manage
|
||||
</Menu.Item>
|
||||
<Menu.Divider />
|
||||
</>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user