-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from websitesieutoc/big-migration-on-schema
change massive from Site to Project
- Loading branch information
Showing
83 changed files
with
2,520 additions
and
1,267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,30 @@ | ||
NEXTAUTH_SECRET=topsecret | ||
ARGON_SECRET=topsecret | ||
|
||
# Mandatory next-auth URL for localhost | ||
NEXTAUTH_URL=http://localhost:3000 | ||
NEXTAUTH_SECRET=topsecret | ||
|
||
# For Docker | ||
# --- Start for development | ||
POSTGRES_PORT=5433 | ||
POSTGRES_DB=postgres | ||
POSTGRES_USER=postgres | ||
POSTGRES_PASSWORD=password | ||
# --- End for development | ||
|
||
# PostgreSQL database URL – get one here: https://vercel.com/docs/storage/vercel-postgres/quickstart | ||
# PostgreSQL database URL | ||
DATABASE_URL="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:${POSTGRES_PORT}/${POSTGRES_DB}?schema=public" | ||
|
||
# Vercel Blob Storage for image uploads – currently in beta, please fill out this form for access: https://tally.so/r/nPDMNd. Setup instructions: https://vercel.com/docs/storage/vercel-blob/quickstart | ||
BLOB_READ_WRITE_TOKEN=asfdasdf | ||
# Use this one for Github Oauth and syncing | ||
# GITHUB_TOKEN= | ||
# GITHUB_ID= | ||
# GITHUB_SECRET= | ||
# GITHUB_ORG= | ||
|
||
# GitHub OAuth secrets for auth & login – generate these here: https://github-client-generator.vercel.app/ | ||
GITHUB_ID= | ||
GITHUB_SECRET= | ||
# Use this one for magic link authentication | ||
SMTP_USER=mailpit | ||
SMTP_PASSWORD=topsecret | ||
SMTP_HOST=0.0.0.0 | ||
SMTP_PORT=1025 | ||
EMAIL_FROM=[email protected] | ||
|
||
# Vercel authentication token that can be found here: https://vercel.com/account/tokens | ||
VERCEL_TOKEN= | ||
# Vercel Team ID that can be found here: https://vercel.com/teams/<org>/settings | ||
TEAM_ID_VERCEL= | ||
EASYPANEL_API_KEY= | ||
EASYPANEL_URL= | ||
|
||
# OpenAI API key for AI text generation – get one here: https://platform.openai.com/account/api-keys | ||
OPENAI_API_KEY= | ||
STRIPE_SECRET_KEY= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
'use client'; | ||
|
||
import { | ||
useEffect, | ||
useKeyPressEvent, | ||
useSearchParams, | ||
useState, | ||
useToast, | ||
} from '@/hooks'; | ||
import { | ||
Alert, | ||
AlertDescription, | ||
AlertIcon, | ||
AlertTitle, | ||
Box, | ||
Button, | ||
Input, | ||
Stack, | ||
} from '@/components/chakra'; | ||
import { signIn } from 'next-auth/react'; | ||
import { FlashIcon } from '@/icons'; | ||
|
||
export type LoginByEmailProps = { | ||
isRequested: boolean; | ||
}; | ||
|
||
export const LoginByEmail = ({ isRequested }: LoginByEmailProps) => { | ||
const toast = useToast(); | ||
const [isFocused, setFocused] = useState(false); | ||
const [isLoading, setLoading] = useState(false); | ||
|
||
// Get error message added by next/auth in URL. | ||
const searchParams = useSearchParams(); | ||
const error = searchParams?.get('error'); | ||
|
||
const [email, setEmail] = useState(''); | ||
|
||
const handleSignIn = async () => { | ||
const callbackUrl = searchParams?.get('callbackUrl') ?? '/'; | ||
|
||
setLoading(true); | ||
|
||
await signIn('email', { | ||
email, | ||
callbackUrl, | ||
}); | ||
}; | ||
|
||
useEffect(() => { | ||
const errorMessage = Array.isArray(error) ? error.pop() : error; | ||
errorMessage && toast({ description: errorMessage, status: 'error' }); | ||
}, [error, toast]); | ||
|
||
useKeyPressEvent('Enter', (e) => { | ||
if (isFocused && email && !isLoading) { | ||
e.preventDefault(); | ||
handleSignIn(); | ||
} | ||
}); | ||
|
||
return ( | ||
<Stack gap={4}> | ||
{isRequested && ( | ||
<Alert status="success" variant="subtle" borderRadius="md" pb={4}> | ||
<AlertIcon boxSize="20px" /> | ||
<Box> | ||
<AlertTitle mt={2}>Check your email!</AlertTitle> | ||
<AlertDescription fontSize="sm"> | ||
We sent an email to you with a magic link that will sign you in. You can | ||
close this window. | ||
</AlertDescription> | ||
</Box> | ||
</Alert> | ||
)} | ||
|
||
<Input | ||
size="lg" | ||
value={email} | ||
borderWidth="2px" | ||
focusBorderColor="brand.500" | ||
placeholder="[email protected]" | ||
onFocus={() => setFocused(true)} | ||
onBlur={() => setFocused(false)} | ||
onChange={(e) => setEmail(e.target.value)} | ||
/> | ||
|
||
<Button | ||
size="lg" | ||
colorScheme="brand" | ||
isLoading={isLoading} | ||
isDisabled={isLoading || !email} | ||
leftIcon={<FlashIcon />} | ||
onClick={handleSignIn} | ||
> | ||
Login with Email | ||
</Button> | ||
</Stack> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
'use client'; | ||
|
||
import { useState, useEffect, useSearchParams, useToast } from '@/hooks'; | ||
import { Button, Stack, Text } from '@/components/chakra'; | ||
import { signIn } from 'next-auth/react'; | ||
import { GithubIcon } from '@/icons'; | ||
|
||
export type LoginByGithubProps = { | ||
org?: string; | ||
}; | ||
|
||
export const LoginByGithub = ({ org }: LoginByGithubProps) => { | ||
const toast = useToast(); | ||
const [isLoading, setLoading] = useState(false); | ||
|
||
// Get error message added by next/auth in URL. | ||
const searchParams = useSearchParams(); | ||
const error = searchParams?.get('error'); | ||
|
||
useEffect(() => { | ||
const errorMessage = Array.isArray(error) ? error.pop() : error; | ||
errorMessage && toast({ description: errorMessage, status: 'error' }); | ||
}, [error, toast]); | ||
|
||
const getCallbackUrl = () => { | ||
const callbackUrl = searchParams?.get('callbackUrl'); | ||
|
||
if (typeof callbackUrl === 'string') { | ||
return callbackUrl; | ||
} | ||
|
||
return '/'; | ||
}; | ||
|
||
return ( | ||
<Stack gap={1} textAlign="center"> | ||
<Button | ||
size="lg" | ||
colorScheme="brand" | ||
isLoading={isLoading} | ||
isDisabled={isLoading} | ||
leftIcon={<GithubIcon />} | ||
loadingText="Login with GitHub" | ||
onClick={() => { | ||
setLoading(true); | ||
signIn('github', { | ||
redirect: true, | ||
callbackUrl: getCallbackUrl(), | ||
}); | ||
}} | ||
> | ||
Login with GitHub | ||
</Button> | ||
|
||
{org && ( | ||
<Text fontSize="small" color="gray"> | ||
Only for members of @{org} at this time. | ||
</Text> | ||
)} | ||
</Stack> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './LoginByGithub'; | ||
export * from './LoginByEmail'; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.