feat: add OAuth2 authentication (#16)
This commit is contained in:
@ -1,10 +1,10 @@
|
||||
import { GetStaticProps, NextPage } from 'next'
|
||||
import useTranslation from 'next-translate/useTranslation'
|
||||
|
||||
import { ErrorPage } from 'components/ErrorPage'
|
||||
import { Head } from 'components/Head'
|
||||
import { Header } from 'components/Header'
|
||||
import { Footer, FooterProps } from 'components/Footer'
|
||||
import { ErrorPage } from '../components/ErrorPage'
|
||||
import { Head } from '../components/Head'
|
||||
import { Header } from '../components/Header'
|
||||
import { Footer, FooterProps } from '../components/Footer'
|
||||
|
||||
const Error404: NextPage<FooterProps> = (props) => {
|
||||
const { t } = useTranslation()
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { GetStaticProps, NextPage } from 'next'
|
||||
import useTranslation from 'next-translate/useTranslation'
|
||||
|
||||
import { ErrorPage } from 'components/ErrorPage'
|
||||
import { Head } from 'components/Head'
|
||||
import { Header } from 'components/Header'
|
||||
import { Footer, FooterProps } from 'components/Footer'
|
||||
import { ErrorPage } from '../components/ErrorPage'
|
||||
import { Head } from '../components/Head'
|
||||
import { Header } from '../components/Header'
|
||||
import { Footer, FooterProps } from '../components/Footer'
|
||||
|
||||
const Error500: NextPage<FooterProps> = (props) => {
|
||||
const { t } = useTranslation()
|
||||
|
@ -3,7 +3,7 @@ import { AppProps } from 'next/app'
|
||||
import { ThemeProvider } from 'next-themes'
|
||||
import useTranslation from 'next-translate/useTranslation'
|
||||
|
||||
import 'styles/global.css'
|
||||
import '../styles/global.css'
|
||||
|
||||
import '@fontsource/montserrat/400.css'
|
||||
import '@fontsource/montserrat/500.css'
|
||||
@ -13,7 +13,7 @@ import '@fontsource/montserrat/700.css'
|
||||
import '@fontsource/roboto/400.css'
|
||||
import '@fontsource/roboto/700.css'
|
||||
|
||||
import { cookies } from 'tools/cookies'
|
||||
import { cookies } from '../tools/cookies'
|
||||
|
||||
const Application = ({ Component, pageProps }: AppProps): JSX.Element => {
|
||||
const { lang } = useTranslation()
|
||||
|
@ -1,21 +1,24 @@
|
||||
import { NextPage } from 'next'
|
||||
|
||||
import { Head } from 'components/Head'
|
||||
import { Application } from 'components/Application'
|
||||
import { Messages } from 'components/Application/Messages'
|
||||
import { SendMessage } from 'components/Application/SendMessage'
|
||||
import { Head } from '../../../../components/Head'
|
||||
import { Application } from '../../../../components/Application'
|
||||
import { Messages } from '../../../../components/Application/Messages'
|
||||
import { SendMessage } from '../../../../components/Application/SendMessage'
|
||||
import {
|
||||
authenticationFromServerSide,
|
||||
AuthenticationProvider,
|
||||
PagePropsWithAuthentication
|
||||
} from 'tools/authentication'
|
||||
import { GuildMember, GuildMemberProvider } from 'contexts/GuildMember'
|
||||
import { GuildLeftSidebar } from 'components/Application/GuildLeftSidebar'
|
||||
import { ChannelsProvider } from 'contexts/Channels'
|
||||
import { GuildsProvider } from 'contexts/Guilds'
|
||||
import { Channel } from 'models/Channel'
|
||||
import { MessagesProvider } from 'contexts/Messages'
|
||||
import { MembersProviders } from 'contexts/Members'
|
||||
} from '../../../../tools/authentication'
|
||||
import {
|
||||
GuildMember,
|
||||
GuildMemberProvider
|
||||
} from '../../../../contexts/GuildMember'
|
||||
import { GuildLeftSidebar } from '../../../../components/Application/GuildLeftSidebar'
|
||||
import { ChannelsProvider } from '../../../../contexts/Channels'
|
||||
import { GuildsProvider } from '../../../../contexts/Guilds'
|
||||
import { Channel } from '../../../../models/Channel'
|
||||
import { MessagesProvider } from '../../../../contexts/Messages'
|
||||
import { MembersProviders } from '../../../../contexts/Members'
|
||||
|
||||
export interface ChannelPageProps extends PagePropsWithAuthentication {
|
||||
channelId: number
|
||||
|
@ -1,19 +1,22 @@
|
||||
import { NextPage } from 'next'
|
||||
|
||||
import { Head } from 'components/Head'
|
||||
import { Application } from 'components/Application'
|
||||
import { Head } from '../../../../components/Head'
|
||||
import { Application } from '../../../../components/Application'
|
||||
import {
|
||||
authenticationFromServerSide,
|
||||
AuthenticationProvider,
|
||||
PagePropsWithAuthentication
|
||||
} from 'tools/authentication'
|
||||
import { GuildMember, GuildMemberProvider } from 'contexts/GuildMember'
|
||||
import { GuildLeftSidebar } from 'components/Application/GuildLeftSidebar'
|
||||
import { ChannelSettings } from 'components/Application/ChannelSettings'
|
||||
import { ChannelsProvider } from 'contexts/Channels'
|
||||
import { GuildsProvider } from 'contexts/Guilds'
|
||||
import { Channel } from 'models/Channel'
|
||||
import { MembersProviders } from 'contexts/Members'
|
||||
} from '../../../../tools/authentication'
|
||||
import {
|
||||
GuildMember,
|
||||
GuildMemberProvider
|
||||
} from '../../../../contexts/GuildMember'
|
||||
import { GuildLeftSidebar } from '../../../../components/Application/GuildLeftSidebar'
|
||||
import { ChannelSettings } from '../../../../components/Application/ChannelSettings'
|
||||
import { ChannelsProvider } from '../../../../contexts/Channels'
|
||||
import { GuildsProvider } from '../../../../contexts/Guilds'
|
||||
import { Channel } from '../../../../models/Channel'
|
||||
import { MembersProviders } from '../../../../contexts/Members'
|
||||
|
||||
export interface ChannelSettingsPageProps extends PagePropsWithAuthentication {
|
||||
channelId: number
|
||||
|
@ -1,15 +1,18 @@
|
||||
import { NextPage } from 'next'
|
||||
|
||||
import { Head } from 'components/Head'
|
||||
import { Application } from 'components/Application'
|
||||
import { Head } from '../../../../components/Head'
|
||||
import { Application } from '../../../../components/Application'
|
||||
import {
|
||||
authenticationFromServerSide,
|
||||
AuthenticationProvider,
|
||||
PagePropsWithAuthentication
|
||||
} from 'tools/authentication'
|
||||
import { CreateChannel } from 'components/Application/CreateChannel'
|
||||
import { GuildsProvider } from 'contexts/Guilds'
|
||||
import { GuildMember, GuildMemberProvider } from 'contexts/GuildMember'
|
||||
} from '../../../../tools/authentication'
|
||||
import { CreateChannel } from '../../../../components/Application/CreateChannel'
|
||||
import { GuildsProvider } from '../../../../contexts/Guilds'
|
||||
import {
|
||||
GuildMember,
|
||||
GuildMemberProvider
|
||||
} from '../../../../contexts/GuildMember'
|
||||
|
||||
export interface CreateChannelPageProps extends PagePropsWithAuthentication {
|
||||
guildId: number
|
||||
|
@ -1,15 +1,15 @@
|
||||
import { NextPage } from 'next'
|
||||
|
||||
import { Head } from 'components/Head'
|
||||
import { Application } from 'components/Application'
|
||||
import { Head } from '../../../components/Head'
|
||||
import { Application } from '../../../components/Application'
|
||||
import {
|
||||
authenticationFromServerSide,
|
||||
AuthenticationProvider,
|
||||
PagePropsWithAuthentication
|
||||
} from 'tools/authentication'
|
||||
import { GuildMember, GuildMemberProvider } from 'contexts/GuildMember'
|
||||
import { GuildsProvider } from 'contexts/Guilds'
|
||||
import { GuildSettings } from 'components/Application/GuildSettings'
|
||||
} from '../../../tools/authentication'
|
||||
import { GuildMember, GuildMemberProvider } from '../../../contexts/GuildMember'
|
||||
import { GuildsProvider } from '../../../contexts/Guilds'
|
||||
import { GuildSettings } from '../../../components/Application/GuildSettings'
|
||||
|
||||
export interface GuildSettingsPageProps extends PagePropsWithAuthentication {
|
||||
guildId: number
|
||||
|
@ -1,15 +1,15 @@
|
||||
import { NextPage } from 'next'
|
||||
import useTranslation from 'next-translate/useTranslation'
|
||||
|
||||
import { Head } from 'components/Head'
|
||||
import { Application } from 'components/Application'
|
||||
import { Head } from '../../../components/Head'
|
||||
import { Application } from '../../../components/Application'
|
||||
import {
|
||||
authenticationFromServerSide,
|
||||
AuthenticationProvider,
|
||||
PagePropsWithAuthentication
|
||||
} from 'tools/authentication'
|
||||
import { CreateGuild } from 'components/Application/CreateGuild'
|
||||
import { GuildsProvider } from 'contexts/Guilds'
|
||||
} from '../../../tools/authentication'
|
||||
import { CreateGuild } from '../../../components/Application/CreateGuild'
|
||||
import { GuildsProvider } from '../../../contexts/Guilds'
|
||||
|
||||
const CreateGuildPage: NextPage<PagePropsWithAuthentication> = (props) => {
|
||||
const { t } = useTranslation()
|
||||
|
@ -1,15 +1,15 @@
|
||||
import { NextPage } from 'next'
|
||||
import useTranslation from 'next-translate/useTranslation'
|
||||
|
||||
import { Head } from 'components/Head'
|
||||
import { Application } from 'components/Application'
|
||||
import { Head } from '../../../components/Head'
|
||||
import { Application } from '../../../components/Application'
|
||||
import {
|
||||
authenticationFromServerSide,
|
||||
AuthenticationProvider,
|
||||
PagePropsWithAuthentication
|
||||
} from 'tools/authentication'
|
||||
import { JoinGuildsPublic } from 'components/Application/JoinGuildsPublic'
|
||||
import { GuildsProvider } from 'contexts/Guilds'
|
||||
} from '../../../tools/authentication'
|
||||
import { JoinGuildsPublic } from '../../../components/Application/JoinGuildsPublic'
|
||||
import { GuildsProvider } from '../../../contexts/Guilds'
|
||||
|
||||
const JoinGuildPage: NextPage<PagePropsWithAuthentication> = (props) => {
|
||||
const { t } = useTranslation()
|
||||
|
@ -1,14 +1,14 @@
|
||||
import { NextPage } from 'next'
|
||||
|
||||
import { Head } from 'components/Head'
|
||||
import { Application } from 'components/Application'
|
||||
import { PopupGuild } from 'components/Application/PopupGuild'
|
||||
import { Head } from '../../components/Head'
|
||||
import { Application } from '../../components/Application'
|
||||
import { PopupGuild } from '../../components/Application/PopupGuild'
|
||||
import {
|
||||
authenticationFromServerSide,
|
||||
AuthenticationProvider,
|
||||
PagePropsWithAuthentication
|
||||
} from 'tools/authentication'
|
||||
import { GuildsProvider } from 'contexts/Guilds'
|
||||
} from '../../tools/authentication'
|
||||
import { GuildsProvider } from '../../contexts/Guilds'
|
||||
|
||||
const ApplicationPage: NextPage<PagePropsWithAuthentication> = (props) => {
|
||||
return (
|
||||
|
@ -1,16 +1,16 @@
|
||||
import { NextPage } from 'next'
|
||||
|
||||
import { Head } from 'components/Head'
|
||||
import { Application } from 'components/Application'
|
||||
import { Head } from '../../../../components/Head'
|
||||
import { Application } from '../../../../components/Application'
|
||||
import {
|
||||
authenticationFromServerSide,
|
||||
AuthenticationProvider,
|
||||
PagePropsWithAuthentication
|
||||
} from 'tools/authentication'
|
||||
import { UserProfile } from 'components/Application/UserProfile'
|
||||
import { GuildsProvider } from 'contexts/Guilds'
|
||||
import { UserPublic } from 'models/User'
|
||||
import { Guild } from 'models/Guild'
|
||||
} from '../../../../tools/authentication'
|
||||
import { UserProfile } from '../../../../components/Application/UserProfile'
|
||||
import { GuildsProvider } from '../../../../contexts/Guilds'
|
||||
import { UserPublic } from '../../../../models/User'
|
||||
import { Guild } from '../../../../models/Guild'
|
||||
|
||||
export interface UserProfilePageProps extends PagePropsWithAuthentication {
|
||||
user: UserPublic
|
||||
|
@ -1,14 +1,14 @@
|
||||
import { NextPage } from 'next'
|
||||
|
||||
import { Head } from 'components/Head'
|
||||
import { Application } from 'components/Application'
|
||||
import { Head } from '../../../components/Head'
|
||||
import { Application } from '../../../components/Application'
|
||||
import {
|
||||
authenticationFromServerSide,
|
||||
AuthenticationProvider,
|
||||
PagePropsWithAuthentication
|
||||
} from 'tools/authentication'
|
||||
import { UserSettings } from 'components/Application/UserSettings'
|
||||
import { GuildsProvider } from 'contexts/Guilds'
|
||||
} from '../../../tools/authentication'
|
||||
import { UserSettings } from '../../../components/Application/UserSettings'
|
||||
import { GuildsProvider } from '../../../contexts/Guilds'
|
||||
|
||||
const UserSettingsPage: NextPage<PagePropsWithAuthentication> = (props) => {
|
||||
return (
|
||||
|
@ -3,19 +3,19 @@ import Link from 'next/link'
|
||||
import useTranslation from 'next-translate/useTranslation'
|
||||
import axios from 'axios'
|
||||
|
||||
import { AuthenticationForm } from 'components/Authentication'
|
||||
import { Head } from 'components/Head'
|
||||
import { Header } from 'components/Header'
|
||||
import { Main } from 'components/design/Main'
|
||||
import { Footer, FooterProps } from 'components/Footer'
|
||||
import { Input } from 'components/design/Input'
|
||||
import { Button } from 'components/design/Button'
|
||||
import { FormState } from 'components/design/FormState'
|
||||
import { authenticationFromServerSide } from 'tools/authentication'
|
||||
import { ScrollableBody } from 'components/ScrollableBody'
|
||||
import { userSchema } from 'models/User'
|
||||
import { api } from 'tools/api'
|
||||
import { HandleSubmitCallback, useForm } from 'hooks/useForm'
|
||||
import { AuthenticationForm } from '../../components/Authentication'
|
||||
import { Head } from '../../components/Head'
|
||||
import { Header } from '../../components/Header'
|
||||
import { Main } from '../../components/design/Main'
|
||||
import { Footer, FooterProps } from '../../components/Footer'
|
||||
import { Input } from '../../components/design/Input'
|
||||
import { Button } from '../../components/design/Button'
|
||||
import { FormState } from '../../components/design/FormState'
|
||||
import { authenticationFromServerSide } from '../../tools/authentication'
|
||||
import { ScrollableBody } from '../../components/ScrollableBody'
|
||||
import { userSchema } from '../../models/User'
|
||||
import { api } from '../../tools/api'
|
||||
import { HandleSubmitCallback, useForm } from '../../hooks/useForm'
|
||||
|
||||
const ForgotPassword: NextPage<FooterProps> = (props) => {
|
||||
const { t } = useTranslation()
|
||||
|
@ -3,19 +3,19 @@ import { useRouter } from 'next/router'
|
||||
import useTranslation from 'next-translate/useTranslation'
|
||||
import axios from 'axios'
|
||||
|
||||
import { Head } from 'components/Head'
|
||||
import { Header } from 'components/Header'
|
||||
import { Main } from 'components/design/Main'
|
||||
import { Footer, FooterProps } from 'components/Footer'
|
||||
import { Input } from 'components/design/Input'
|
||||
import { Button } from 'components/design/Button'
|
||||
import { FormState } from 'components/design/FormState'
|
||||
import { authenticationFromServerSide } from 'tools/authentication'
|
||||
import { AuthenticationForm } from 'components/Authentication'
|
||||
import { ScrollableBody } from 'components/ScrollableBody/ScrollableBody'
|
||||
import { HandleSubmitCallback, useForm } from 'hooks/useForm'
|
||||
import { api } from 'tools/api'
|
||||
import { userSchema } from 'models/User'
|
||||
import { Head } from '../../components/Head'
|
||||
import { Header } from '../../components/Header'
|
||||
import { FormState } from '../../components/design/FormState'
|
||||
import { Main } from '../../components/design/Main'
|
||||
import { Footer, FooterProps } from '../../components/Footer'
|
||||
import { Input } from '../../components/design/Input'
|
||||
import { Button } from '../../components/design/Button'
|
||||
import { authenticationFromServerSide } from '../../tools/authentication'
|
||||
import { AuthenticationForm } from '../../components/Authentication'
|
||||
import { ScrollableBody } from '../../components/ScrollableBody/ScrollableBody'
|
||||
import { HandleSubmitCallback, useForm } from '../../hooks/useForm'
|
||||
import { api } from '../../tools/api'
|
||||
import { userSchema } from '../../models/User'
|
||||
|
||||
const ResetPassword: NextPage<FooterProps> = (props) => {
|
||||
const { t } = useTranslation()
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { NextPage } from 'next'
|
||||
import useTranslation from 'next-translate/useTranslation'
|
||||
|
||||
import { Head } from 'components/Head'
|
||||
import { Authentication } from 'components/Authentication'
|
||||
import { Header } from 'components/Header'
|
||||
import { Footer, FooterProps } from 'components/Footer'
|
||||
import { authenticationFromServerSide } from 'tools/authentication'
|
||||
import { ScrollableBody } from 'components/ScrollableBody'
|
||||
import { Head } from '../../components/Head'
|
||||
import { Authentication } from '../../components/Authentication'
|
||||
import { Header } from '../../components/Header'
|
||||
import { Footer, FooterProps } from '../../components/Footer'
|
||||
import { authenticationFromServerSide } from '../../tools/authentication'
|
||||
import { ScrollableBody } from '../../components/ScrollableBody'
|
||||
|
||||
const Signin: NextPage<FooterProps> = (props) => {
|
||||
const { version } = props
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { NextPage } from 'next'
|
||||
import useTranslation from 'next-translate/useTranslation'
|
||||
|
||||
import { Head } from 'components/Head'
|
||||
import { Authentication } from 'components/Authentication'
|
||||
import { Header } from 'components/Header'
|
||||
import { Footer, FooterProps } from 'components/Footer'
|
||||
import { authenticationFromServerSide } from 'tools/authentication'
|
||||
import { ScrollableBody } from 'components/ScrollableBody'
|
||||
import { Head } from '../../components/Head'
|
||||
import { Authentication } from '../../components/Authentication'
|
||||
import { Header } from '../../components/Header'
|
||||
import { Footer, FooterProps } from '../../components/Footer'
|
||||
import { authenticationFromServerSide } from '../../tools/authentication'
|
||||
import { ScrollableBody } from '../../components/ScrollableBody'
|
||||
|
||||
const Signup: NextPage<FooterProps> = (props) => {
|
||||
const { version } = props
|
||||
|
@ -4,13 +4,13 @@ import Image from 'next/image'
|
||||
import Translation from 'next-translate/Trans'
|
||||
import useTranslation from 'next-translate/useTranslation'
|
||||
|
||||
import { Head } from 'components/Head'
|
||||
import { Header } from 'components/Header'
|
||||
import { Main } from 'components/design/Main'
|
||||
import { Footer, FooterProps } from 'components/Footer'
|
||||
import { SocialMediaLink } from 'components/design/SocialMediaButton'
|
||||
import { ButtonLink } from 'components/design/Button'
|
||||
import { ScrollableBody } from 'components/ScrollableBody'
|
||||
import { Head } from '../components/Head'
|
||||
import { Header } from '../components/Header'
|
||||
import { Main } from '../components/design/Main'
|
||||
import { Footer, FooterProps } from '../components/Footer'
|
||||
import { SocialMediaLink } from '../components/design/SocialMediaButton'
|
||||
import { ButtonLink } from '../components/design/Button'
|
||||
import { ScrollableBody } from '../components/ScrollableBody'
|
||||
|
||||
const Home: NextPage<FooterProps> = (props) => {
|
||||
const { t } = useTranslation()
|
||||
|
Reference in New Issue
Block a user