Add credentials provider, fix header active style
This commit is contained in:
parent
0631ae3897
commit
65cf59e96b
14 changed files with 144 additions and 254 deletions
|
@ -18,18 +18,21 @@ const Auth = ({
|
|||
const [serverPassword, setServerPassword] = useState("")
|
||||
const [errorMsg, setErrorMsg] = useState("")
|
||||
const signingIn = page === "signin"
|
||||
const signText = signingIn ? "In" : "Up"
|
||||
const [username, setUsername] = useState("")
|
||||
const [password, setPassword] = useState("")
|
||||
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<div className={styles.form}>
|
||||
<div className={styles.formContentSpace}>
|
||||
<h1>{signingIn ? "Sign In" : "Sign Up"}</h1>
|
||||
<h1>Sign {signText}</h1>
|
||||
</div>
|
||||
{/* <form onSubmit={handleSubmit}> */}
|
||||
<form>
|
||||
<div className={styles.formGroup}>
|
||||
{/* <Input
|
||||
htmlType="text"
|
||||
<Input
|
||||
type="text"
|
||||
id="username"
|
||||
value={username}
|
||||
onChange={(event) => setUsername(event.currentTarget.value)}
|
||||
|
@ -37,9 +40,10 @@ const Auth = ({
|
|||
required
|
||||
minLength={3}
|
||||
width="100%"
|
||||
aria-label="Username"
|
||||
/>
|
||||
<Input
|
||||
htmlType="password"
|
||||
type="password"
|
||||
id="password"
|
||||
value={password}
|
||||
onChange={(event) => setPassword(event.currentTarget.value)}
|
||||
|
@ -47,8 +51,8 @@ const Auth = ({
|
|||
required
|
||||
minLength={6}
|
||||
width="100%"
|
||||
/> */}
|
||||
{/* sign in with github */}
|
||||
aria-label="Password"
|
||||
/>
|
||||
{requiresServerPassword && (
|
||||
<Input
|
||||
type="password"
|
||||
|
@ -63,6 +67,21 @@ const Auth = ({
|
|||
aria-label="Server Password"
|
||||
/>
|
||||
)}
|
||||
<Button
|
||||
width={"100%"}
|
||||
type="submit"
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
signIn("credentials", {
|
||||
username,
|
||||
password,
|
||||
callbackUrl: "/"
|
||||
})
|
||||
}}
|
||||
>
|
||||
Sign {signText}
|
||||
</Button>
|
||||
<hr style={{ width: "100%" }} />
|
||||
<Button
|
||||
type="submit"
|
||||
buttonType="primary"
|
||||
|
@ -78,12 +97,8 @@ const Auth = ({
|
|||
})
|
||||
}}
|
||||
>
|
||||
Sign in with GitHub
|
||||
Sign {signText.toLowerCase()} with GitHub
|
||||
</Button>
|
||||
|
||||
{/* <Button width={"100%"} htmlType="submit">
|
||||
{signingIn ? "Sign In" : "Sign Up"}
|
||||
</Button> */}
|
||||
</div>
|
||||
<div className={styles.formContentSpace}>
|
||||
{signingIn ? (
|
||||
|
|
|
@ -37,7 +37,7 @@ const MarkdownPreview = ({
|
|||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body
|
||||
body,
|
||||
})
|
||||
|
||||
if (resp.ok) {
|
||||
|
|
|
@ -95,7 +95,7 @@ const Post = ({
|
|||
console.error(json)
|
||||
setToast({
|
||||
id: "error",
|
||||
message: "Please fill out all fields",
|
||||
message: json.error ?? "Please fill out all fields",
|
||||
type: "error"
|
||||
})
|
||||
setPasswordModalVisible(false)
|
||||
|
@ -151,7 +151,7 @@ const Post = ({
|
|||
setSubmitting(false)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
await sendRequest("/api/post", {
|
||||
title,
|
||||
files: docs,
|
||||
|
|
|
@ -53,9 +53,9 @@
|
|||
align-items: center;
|
||||
}
|
||||
|
||||
.active a,
|
||||
.active button {
|
||||
color: var(--fg);
|
||||
.active,
|
||||
.active {
|
||||
color: var(--fg) !important;
|
||||
}
|
||||
|
||||
.buttonGroup,
|
||||
|
|
|
@ -42,15 +42,15 @@ const Header = () => {
|
|||
const { setTheme, resolvedTheme } = useTheme()
|
||||
|
||||
const getButton = (tab: Tab) => {
|
||||
const isActive = pathname === tab.href
|
||||
const activeStyle = isActive ? styles.active : ""
|
||||
const isActive = `${pathname}` === tab.href
|
||||
const activeStyle = isActive ? styles.active : undefined
|
||||
if (tab.onClick) {
|
||||
return (
|
||||
<Button
|
||||
key={tab.value}
|
||||
iconLeft={tab.icon}
|
||||
onClick={tab.onClick}
|
||||
className={clsx(styles.tab, activeStyle)}
|
||||
className={activeStyle}
|
||||
aria-label={tab.name}
|
||||
aria-current={isActive ? "page" : undefined}
|
||||
data-tab={tab.value}
|
||||
|
@ -63,10 +63,9 @@ const Header = () => {
|
|||
<Link
|
||||
key={tab.value}
|
||||
href={tab.href}
|
||||
className={clsx(styles.tab, activeStyle)}
|
||||
data-tab={tab.value}
|
||||
>
|
||||
<Button iconLeft={tab.icon}>{tab.name ? tab.name : undefined}</Button>
|
||||
<Button className={activeStyle} iconLeft={tab.icon}>{tab.name ? tab.name : undefined}</Button>
|
||||
</Link>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -44,6 +44,9 @@ const PostList = ({
|
|||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"x-page": `${posts.length / 10 + 1}`
|
||||
},
|
||||
next: {
|
||||
revalidate: 10
|
||||
}
|
||||
})
|
||||
const json = await res.json()
|
||||
|
@ -159,7 +162,7 @@ const PostList = ({
|
|||
</div>
|
||||
)}
|
||||
{!searching && hasMorePosts && !setSearchValue && (
|
||||
<div className={styles.moreContainer}>
|
||||
<div>
|
||||
<Button width={"100%"} onClick={loadMoreClick}>
|
||||
Load more
|
||||
</Button>
|
||||
|
|
|
@ -15,7 +15,7 @@ export default async function Page() {
|
|||
const getPostsPromise = getAllPosts({
|
||||
where: { visibility: "public" },
|
||||
include: {
|
||||
files: true,
|
||||
files: true
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -69,4 +69,4 @@ async function PublicPostList({
|
|||
)
|
||||
}
|
||||
|
||||
export const revalidate = 60
|
||||
export const revalidate = 30
|
||||
|
|
|
@ -8,6 +8,7 @@ type Config = {
|
|||
url: string
|
||||
github_client_id: string
|
||||
github_client_secret: string
|
||||
nextauth_secret: string
|
||||
}
|
||||
|
||||
type EnvironmentValue = string | undefined
|
||||
|
@ -74,7 +75,8 @@ export const config = (env: Environment): Config => {
|
|||
welcome_title: env.WELCOME_TITLE ?? "Drift",
|
||||
url: process.env.VERCEL_URL ?? throwIfUndefined("DRIFT_URL"),
|
||||
github_client_id: env.GITHUB_CLIENT_ID ?? "",
|
||||
github_client_secret: env.GITHUB_CLIENT_SECRET ?? ""
|
||||
github_client_secret: env.GITHUB_CLIENT_SECRET ?? "",
|
||||
nextauth_secret: throwIfUndefined("NEXTAUTH_SECRET"),
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
|
|
@ -1,47 +1,73 @@
|
|||
import { PrismaAdapter } from "@next-auth/prisma-adapter"
|
||||
import { NextAuthOptions } from "next-auth"
|
||||
import GitHubProvider from "next-auth/providers/github"
|
||||
import CredentialsProvider from "next-auth/providers/credentials"
|
||||
import { prisma } from "@lib/server/prisma"
|
||||
import config from "@lib/config"
|
||||
import * as crypto from "crypto"
|
||||
|
||||
const providers: NextAuthOptions["providers"] = [
|
||||
GitHubProvider({
|
||||
clientId: config.github_client_id,
|
||||
clientSecret: config.github_client_secret
|
||||
}),
|
||||
// CredentialsProvider({
|
||||
// name: "Credentials",
|
||||
// credentials: {
|
||||
// username: { label: "Username", type: "text", placeholder: "jsmith" },
|
||||
// password: { label: "Password", type: "password" }
|
||||
// },
|
||||
// async authorize(credentials) {
|
||||
// const user = await prisma.user.findUnique({
|
||||
// where: {
|
||||
// username: credentials.username
|
||||
// }
|
||||
// })
|
||||
CredentialsProvider({
|
||||
name: "Credentials",
|
||||
credentials: {
|
||||
username: { label: "Username", type: "text", placeholder: "jsmith" },
|
||||
password: { label: "Password", type: "password" }
|
||||
},
|
||||
async authorize(credentials) {
|
||||
if (!credentials) {
|
||||
return null
|
||||
}
|
||||
|
||||
// if (!user) {
|
||||
// // create with prisma
|
||||
// // return user
|
||||
// const newUser = await prisma.account.create({
|
||||
// data: {
|
||||
// provider: "credentials",
|
||||
// providerAccountId: credentials.username,
|
||||
// user: {
|
||||
// create: {
|
||||
// name: credentials.username,
|
||||
// displayName: credentials.username
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
const user = await prisma.user.findUnique({
|
||||
where: {
|
||||
username: credentials.username
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
displayName: true,
|
||||
role: true,
|
||||
password: true
|
||||
}
|
||||
})
|
||||
|
||||
// return user
|
||||
// }
|
||||
// })
|
||||
const hashedPassword = crypto
|
||||
.createHash("sha256")
|
||||
.update
|
||||
(credentials
|
||||
.password
|
||||
+ config.nextauth_secret)
|
||||
.digest("hex")
|
||||
|
||||
if (!user) {
|
||||
const newUser = await prisma.user.create({
|
||||
data: {
|
||||
username: credentials.username,
|
||||
displayName: credentials.username,
|
||||
role: "user",
|
||||
password: hashedPassword,
|
||||
name: credentials.username,
|
||||
}
|
||||
})
|
||||
|
||||
return newUser
|
||||
} else if (
|
||||
user.password &&
|
||||
crypto.timingSafeEqual(
|
||||
Buffer.from(user.password),
|
||||
Buffer.from(hashedPassword)
|
||||
)
|
||||
) {
|
||||
return user
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
})
|
||||
]
|
||||
|
||||
export const authOptions: NextAuthOptions = {
|
||||
|
@ -52,6 +78,8 @@ export const authOptions: NextAuthOptions = {
|
|||
},
|
||||
pages: {
|
||||
signIn: "/signin"
|
||||
// TODO
|
||||
// error: "/auth/error",
|
||||
},
|
||||
providers,
|
||||
callbacks: {
|
||||
|
@ -69,7 +97,14 @@ export const authOptions: NextAuthOptions = {
|
|||
async jwt({ token, user }) {
|
||||
const dbUser = await prisma.user.findFirst({
|
||||
where: {
|
||||
email: token.email
|
||||
OR: [
|
||||
{
|
||||
username: user?.username
|
||||
},
|
||||
{
|
||||
email: user?.email
|
||||
}
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -77,7 +112,6 @@ export const authOptions: NextAuthOptions = {
|
|||
// TODO: user should be defined? should we invalidate/signout?
|
||||
if (user) {
|
||||
token.id = user.id
|
||||
token.role = "user"
|
||||
}
|
||||
return token
|
||||
}
|
||||
|
@ -87,7 +121,8 @@ export const authOptions: NextAuthOptions = {
|
|||
name: dbUser.displayName,
|
||||
email: dbUser.email,
|
||||
picture: dbUser.image,
|
||||
role: dbUser.role || "user"
|
||||
role: dbUser.role || "user",
|
||||
username: dbUser.username
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
"@radix-ui/react-tooltip": "^1.0.2",
|
||||
"@wcj/markdown-to-html": "^2.1.2",
|
||||
"@wits/next-themes": "0.2.14",
|
||||
"bcrypt": "^5.1.0",
|
||||
"client-only": "^0.0.1",
|
||||
"client-zip": "2.2.1",
|
||||
"jest": "^29.3.1",
|
||||
|
|
|
@ -25,7 +25,20 @@ async function handlePost(req: NextApiRequest, res: NextApiResponse<any>) {
|
|||
return res.status(401).json({ error: "Unauthorized" })
|
||||
}
|
||||
|
||||
const files = req.body.files as (Omit<File, 'content' | 'html'> & { content: string; html: string; })[]
|
||||
const user = await prisma.user.findUnique({
|
||||
where: {
|
||||
id: session.user.id
|
||||
}
|
||||
})
|
||||
|
||||
if (!user) {
|
||||
return res.status(404).json({ error: "User not found" })
|
||||
}
|
||||
|
||||
const files = req.body.files as (Omit<File, "content" | "html"> & {
|
||||
content: string
|
||||
html: string
|
||||
})[]
|
||||
const fileTitles = files.map((file) => file.title)
|
||||
const missingTitles = fileTitles.filter((title) => title === "")
|
||||
if (missingTitles.length > 0) {
|
||||
|
|
|
@ -18,7 +18,6 @@ specifiers:
|
|||
'@types/react-dom': 18.0.3
|
||||
'@wcj/markdown-to-html': ^2.1.2
|
||||
'@wits/next-themes': 0.2.14
|
||||
bcrypt: ^5.1.0
|
||||
client-only: ^0.0.1
|
||||
client-zip: 2.2.1
|
||||
clsx: ^1.2.1
|
||||
|
@ -57,7 +56,6 @@ dependencies:
|
|||
'@radix-ui/react-tooltip': 1.0.2_jbvntnid6ohjelon6ccj5dhg2u
|
||||
'@wcj/markdown-to-html': 2.1.2
|
||||
'@wits/next-themes': 0.2.14_rhfownvlqkszea7w3lnpwl7bzy
|
||||
bcrypt: 5.1.0
|
||||
client-only: 0.0.1
|
||||
client-zip: 2.2.1
|
||||
jest: 29.3.1_@types+node@17.0.23
|
||||
|
@ -775,24 +773,6 @@ packages:
|
|||
'@jridgewell/sourcemap-codec': 1.4.14
|
||||
dev: false
|
||||
|
||||
/@mapbox/node-pre-gyp/1.0.10:
|
||||
resolution: {integrity: sha512-4ySo4CjzStuprMwk35H5pPbkymjv1SF3jGLj6rAHp/xT/RF7TL7bd9CTm1xDY49K2qF7jmR/g7k+SkLETP6opA==}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
detect-libc: 2.0.1
|
||||
https-proxy-agent: 5.0.1
|
||||
make-dir: 3.1.0
|
||||
node-fetch: 2.6.7
|
||||
nopt: 5.0.0
|
||||
npmlog: 5.0.1
|
||||
rimraf: 3.0.2
|
||||
semver: 7.3.8
|
||||
tar: 6.1.12
|
||||
transitivePeerDependencies:
|
||||
- encoding
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
/@next-auth/prisma-adapter/1.0.5_4eojhct6t46nl4awizrjr4dkya:
|
||||
resolution: {integrity: sha512-VqMS11IxPXrPGXw6Oul6jcyS/n8GLOWzRMrPr3EMdtD6eOalM6zz05j08PcNiis8QzkfuYnCv49OvufTuaEwYQ==}
|
||||
peerDependencies:
|
||||
|
@ -1741,10 +1721,6 @@ packages:
|
|||
react-dom: 18.2.0_react@18.2.0
|
||||
dev: false
|
||||
|
||||
/abbrev/1.1.1:
|
||||
resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==}
|
||||
dev: false
|
||||
|
||||
/acorn-jsx/5.3.2_acorn@8.8.1:
|
||||
resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==}
|
||||
peerDependencies:
|
||||
|
@ -1764,15 +1740,6 @@ packages:
|
|||
hasBin: true
|
||||
dev: true
|
||||
|
||||
/agent-base/6.0.2:
|
||||
resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==}
|
||||
engines: {node: '>= 6.0.0'}
|
||||
dependencies:
|
||||
debug: 4.3.4
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
/ajv/6.12.6:
|
||||
resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==}
|
||||
dependencies:
|
||||
|
@ -1821,18 +1788,6 @@ packages:
|
|||
resolution: {integrity: sha512-gkco+qxENJV+8vFcDiiFhuoSvRXb2a/QPqpSoWhVz829VNJfOTnELbBmPmNKFxf3xdNnw4DWCkzkDaavcX/1YQ==}
|
||||
dev: true
|
||||
|
||||
/aproba/2.0.0:
|
||||
resolution: {integrity: sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==}
|
||||
dev: false
|
||||
|
||||
/are-we-there-yet/2.0.0:
|
||||
resolution: {integrity: sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==}
|
||||
engines: {node: '>=10'}
|
||||
dependencies:
|
||||
delegates: 1.0.0
|
||||
readable-stream: 3.6.0
|
||||
dev: false
|
||||
|
||||
/argparse/1.0.10:
|
||||
resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==}
|
||||
dependencies:
|
||||
|
@ -2021,18 +1976,6 @@ packages:
|
|||
resolution: {integrity: sha512-zy5swVXwQ25ttElhoN9Dgnqm6VFlMkeDNljvHSGqGNr4zClUosdFzxD+fQHJVmx3g3KY+r//wV/fmBHsa1ErnA==}
|
||||
dev: false
|
||||
|
||||
/bcrypt/5.1.0:
|
||||
resolution: {integrity: sha512-RHBS7HI5N5tEnGTmtR/pppX0mmDSBpQ4aCBsj7CEQfYXDcO74A8sIBYcJMuCsis2E81zDxeENYhv66oZwLiA+Q==}
|
||||
engines: {node: '>= 10.0.0'}
|
||||
requiresBuild: true
|
||||
dependencies:
|
||||
'@mapbox/node-pre-gyp': 1.0.10
|
||||
node-addon-api: 5.0.0
|
||||
transitivePeerDependencies:
|
||||
- encoding
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
/big.js/3.2.0:
|
||||
resolution: {integrity: sha512-+hN/Zh2D08Mx65pZ/4g5bsmNiZUuChDiQfTUQ7qJr4/kuopCr88xZsAXv6mBoZEsUI4OuGHlX59qE94K2mMW8Q==}
|
||||
dev: true
|
||||
|
@ -2188,11 +2131,6 @@ packages:
|
|||
dev: false
|
||||
optional: true
|
||||
|
||||
/chownr/2.0.0:
|
||||
resolution: {integrity: sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==}
|
||||
engines: {node: '>=10'}
|
||||
dev: false
|
||||
|
||||
/ci-info/3.6.1:
|
||||
resolution: {integrity: sha512-up5ggbaDqOqJ4UqLKZ2naVkyqSJQgJi5lwD6b6mM748ysrghDBX0bx/qJTUHzw7zu6Mq4gycviSF5hJnwceD8w==}
|
||||
engines: {node: '>=8'}
|
||||
|
@ -2279,11 +2217,6 @@ packages:
|
|||
dev: false
|
||||
optional: true
|
||||
|
||||
/color-support/1.1.3:
|
||||
resolution: {integrity: sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==}
|
||||
hasBin: true
|
||||
dev: false
|
||||
|
||||
/color/4.2.3:
|
||||
resolution: {integrity: sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==}
|
||||
engines: {node: '>=12.5.0'}
|
||||
|
@ -2323,10 +2256,6 @@ packages:
|
|||
/concat-map/0.0.1:
|
||||
resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==}
|
||||
|
||||
/console-control-strings/1.1.0:
|
||||
resolution: {integrity: sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==}
|
||||
dev: false
|
||||
|
||||
/convert-source-map/1.9.0:
|
||||
resolution: {integrity: sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==}
|
||||
dev: false
|
||||
|
@ -2508,10 +2437,6 @@ packages:
|
|||
object-keys: 1.1.1
|
||||
dev: true
|
||||
|
||||
/delegates/1.0.0:
|
||||
resolution: {integrity: sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==}
|
||||
dev: false
|
||||
|
||||
/dependency-tree/8.1.2:
|
||||
resolution: {integrity: sha512-c4CL1IKxkKng0oT5xrg4uNiiMVFqTGOXqHSFx7XEFdgSsp6nw3AGGruICppzJUrfad/r7GLqt26rmWU4h4j39A==}
|
||||
engines: {node: ^10.13 || ^12 || >=14}
|
||||
|
@ -2535,6 +2460,7 @@ packages:
|
|||
resolution: {integrity: sha512-463v3ZeIrcWtdgIg6vI6XUncguvr2TnGl4SzDXinkt9mSLpBJKXT3mW6xT3VQdDN11+WVs29pgvivTc4Lp8v+w==}
|
||||
engines: {node: '>=8'}
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/detect-newline/3.1.0:
|
||||
resolution: {integrity: sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==}
|
||||
|
@ -3269,13 +3195,6 @@ packages:
|
|||
dev: false
|
||||
optional: true
|
||||
|
||||
/fs-minipass/2.1.0:
|
||||
resolution: {integrity: sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==}
|
||||
engines: {node: '>= 8'}
|
||||
dependencies:
|
||||
minipass: 3.3.4
|
||||
dev: false
|
||||
|
||||
/fs.realpath/1.0.0:
|
||||
resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==}
|
||||
|
||||
|
@ -3303,21 +3222,6 @@ packages:
|
|||
resolution: {integrity: sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==}
|
||||
dev: true
|
||||
|
||||
/gauge/3.0.2:
|
||||
resolution: {integrity: sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==}
|
||||
engines: {node: '>=10'}
|
||||
dependencies:
|
||||
aproba: 2.0.0
|
||||
color-support: 1.1.3
|
||||
console-control-strings: 1.1.0
|
||||
has-unicode: 2.0.1
|
||||
object-assign: 4.1.1
|
||||
signal-exit: 3.0.7
|
||||
string-width: 4.2.3
|
||||
strip-ansi: 6.0.1
|
||||
wide-align: 1.1.5
|
||||
dev: false
|
||||
|
||||
/generic-names/1.0.3:
|
||||
resolution: {integrity: sha512-b6OHfQuKasIKM9b6YPkX+KUj/TLBTx3B/1aT1T5F12FEuEqyFMdr59OMS53aoaSw8eVtapdqieX6lbg5opaOhA==}
|
||||
dependencies:
|
||||
|
@ -3507,10 +3411,6 @@ packages:
|
|||
has-symbols: 1.0.3
|
||||
dev: true
|
||||
|
||||
/has-unicode/2.0.1:
|
||||
resolution: {integrity: sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==}
|
||||
dev: false
|
||||
|
||||
/has/1.0.3:
|
||||
resolution: {integrity: sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==}
|
||||
engines: {node: '>= 0.4.0'}
|
||||
|
@ -3658,16 +3558,6 @@ packages:
|
|||
resolution: {integrity: sha512-0quDb7s97CfemeJAnW9wC0hw78MtW7NU3hqtCD75g2vFlDLt36llsYD7uB7SUzojLMP24N5IatXf7ylGXiGG9A==}
|
||||
dev: false
|
||||
|
||||
/https-proxy-agent/5.0.1:
|
||||
resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==}
|
||||
engines: {node: '>= 6'}
|
||||
dependencies:
|
||||
agent-base: 6.0.2
|
||||
debug: 4.3.4
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
/human-signals/2.1.0:
|
||||
resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==}
|
||||
engines: {node: '>=10.17.0'}
|
||||
|
@ -5129,21 +5019,6 @@ packages:
|
|||
/minimist/1.2.7:
|
||||
resolution: {integrity: sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==}
|
||||
|
||||
/minipass/3.3.4:
|
||||
resolution: {integrity: sha512-I9WPbWHCGu8W+6k1ZiGpPu0GkoKBeorkfKNuAFBNS1HNFJvke82sxvI5bzcCNpWPorkOO5QQ+zomzzwRxejXiw==}
|
||||
engines: {node: '>=8'}
|
||||
dependencies:
|
||||
yallist: 4.0.0
|
||||
dev: false
|
||||
|
||||
/minizlib/2.1.2:
|
||||
resolution: {integrity: sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==}
|
||||
engines: {node: '>= 8'}
|
||||
dependencies:
|
||||
minipass: 3.3.4
|
||||
yallist: 4.0.0
|
||||
dev: false
|
||||
|
||||
/mkdirp-classic/0.5.3:
|
||||
resolution: {integrity: sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==}
|
||||
dev: false
|
||||
|
@ -5153,6 +5028,7 @@ packages:
|
|||
resolution: {integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==}
|
||||
engines: {node: '>=10'}
|
||||
hasBin: true
|
||||
dev: true
|
||||
|
||||
/module-definition/3.4.0:
|
||||
resolution: {integrity: sha512-XxJ88R1v458pifaSkPNLUTdSPNVGMP2SXVncVmApGO+gAfrLANiYe6JofymCzVceGOMwQE2xogxBSc8uB7XegA==}
|
||||
|
@ -5321,18 +5197,7 @@ packages:
|
|||
/node-addon-api/5.0.0:
|
||||
resolution: {integrity: sha512-CvkDw2OEnme7ybCykJpVcKH+uAOLV2qLqiyla128dN9TkEWfrYmxG6C2boDe5KcNQqZF3orkqzGgOMvZ/JNekA==}
|
||||
dev: false
|
||||
|
||||
/node-fetch/2.6.7:
|
||||
resolution: {integrity: sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==}
|
||||
engines: {node: 4.x || >=6.0.0}
|
||||
peerDependencies:
|
||||
encoding: ^0.1.0
|
||||
peerDependenciesMeta:
|
||||
encoding:
|
||||
optional: true
|
||||
dependencies:
|
||||
whatwg-url: 5.0.0
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/node-int64/0.4.0:
|
||||
resolution: {integrity: sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==}
|
||||
|
@ -5349,14 +5214,6 @@ packages:
|
|||
'@babel/parser': 7.20.3
|
||||
dev: true
|
||||
|
||||
/nopt/5.0.0:
|
||||
resolution: {integrity: sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==}
|
||||
engines: {node: '>=6'}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
abbrev: 1.1.1
|
||||
dev: false
|
||||
|
||||
/normalize-path/3.0.0:
|
||||
resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
@ -5372,15 +5229,6 @@ packages:
|
|||
path-key: 3.1.1
|
||||
dev: false
|
||||
|
||||
/npmlog/5.0.1:
|
||||
resolution: {integrity: sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==}
|
||||
dependencies:
|
||||
are-we-there-yet: 2.0.0
|
||||
console-control-strings: 1.1.0
|
||||
gauge: 3.0.2
|
||||
set-blocking: 2.0.0
|
||||
dev: false
|
||||
|
||||
/nth-check/2.1.1:
|
||||
resolution: {integrity: sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==}
|
||||
dependencies:
|
||||
|
@ -6315,6 +6163,7 @@ packages:
|
|||
hasBin: true
|
||||
dependencies:
|
||||
glob: 7.2.3
|
||||
dev: true
|
||||
|
||||
/run-parallel/1.2.0:
|
||||
resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==}
|
||||
|
@ -6396,10 +6245,6 @@ packages:
|
|||
resolution: {integrity: sha512-qepMx2JxAa5jjfzxG79yPPq+8BuFToHd1hm7kI+Z4zAq1ftQiP7HcxMhDDItrbtwVeLg/cY2JnKnrcFkmiswNA==}
|
||||
dev: false
|
||||
|
||||
/set-blocking/2.0.0:
|
||||
resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==}
|
||||
dev: false
|
||||
|
||||
/sharp/0.31.2:
|
||||
resolution: {integrity: sha512-DUdNVEXgS5A97cTagSLIIp8dUZ/lZtk78iNVZgHdHbx1qnQR7JAHY0BnXnwwH39Iw+VKhO08CTYhIg0p98vQ5Q==}
|
||||
engines: {node: '>=14.15.0'}
|
||||
|
@ -6733,18 +6578,6 @@ packages:
|
|||
dev: false
|
||||
optional: true
|
||||
|
||||
/tar/6.1.12:
|
||||
resolution: {integrity: sha512-jU4TdemS31uABHd+Lt5WEYJuzn+TJTCBLljvIAHZOz6M9Os5pJ4dD+vRFLxPa/n3T0iEFzpi+0x1UfuDZYbRMw==}
|
||||
engines: {node: '>=10'}
|
||||
dependencies:
|
||||
chownr: 2.0.0
|
||||
fs-minipass: 2.1.0
|
||||
minipass: 3.3.4
|
||||
minizlib: 2.1.2
|
||||
mkdirp: 1.0.4
|
||||
yallist: 4.0.0
|
||||
dev: false
|
||||
|
||||
/temp/0.4.0:
|
||||
resolution: {integrity: sha512-IsFisGgDKk7qzK9erMIkQe/XwiSUdac7z3wYOsjcLkhPBy3k1SlvLoIh2dAHIlEpgA971CgguMrx9z8fFg7tSA==}
|
||||
engines: {'0': node >=0.4.0}
|
||||
|
@ -6793,10 +6626,6 @@ packages:
|
|||
engines: {node: '>=6'}
|
||||
dev: true
|
||||
|
||||
/tr46/0.0.3:
|
||||
resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==}
|
||||
dev: false
|
||||
|
||||
/trim-lines/3.0.1:
|
||||
resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==}
|
||||
dev: false
|
||||
|
@ -7190,10 +7019,6 @@ packages:
|
|||
resolution: {integrity: sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==}
|
||||
dev: false
|
||||
|
||||
/webidl-conversions/3.0.1:
|
||||
resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==}
|
||||
dev: false
|
||||
|
||||
/webpack-bundle-analyzer/4.7.0:
|
||||
resolution: {integrity: sha512-j9b8ynpJS4K+zfO5GGwsAcQX4ZHpWV+yRiHDiL+bE0XHJ8NiPYLTNVQdlFYWxtpg9lfAQNlwJg16J9AJtFSXRg==}
|
||||
engines: {node: '>= 10.13.0'}
|
||||
|
@ -7213,13 +7038,6 @@ packages:
|
|||
- utf-8-validate
|
||||
dev: true
|
||||
|
||||
/whatwg-url/5.0.0:
|
||||
resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==}
|
||||
dependencies:
|
||||
tr46: 0.0.3
|
||||
webidl-conversions: 3.0.1
|
||||
dev: false
|
||||
|
||||
/which-boxed-primitive/1.0.2:
|
||||
resolution: {integrity: sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==}
|
||||
dependencies:
|
||||
|
@ -7237,12 +7055,6 @@ packages:
|
|||
dependencies:
|
||||
isexe: 2.0.0
|
||||
|
||||
/wide-align/1.1.5:
|
||||
resolution: {integrity: sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==}
|
||||
dependencies:
|
||||
string-width: 4.2.3
|
||||
dev: false
|
||||
|
||||
/word-wrap/1.2.3:
|
||||
resolution: {integrity: sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
|
|
@ -96,6 +96,9 @@ model User {
|
|||
posts Post[]
|
||||
accounts Account[]
|
||||
sessions Session[]
|
||||
// below are added for CredentialProvider
|
||||
username String? @unique
|
||||
password String? @map("hashed_password")
|
||||
|
||||
@@map("users")
|
||||
}
|
||||
|
|
9
src/types/next-auth.d.ts
vendored
9
src/types/next-auth.d.ts
vendored
|
@ -17,4 +17,13 @@ declare module "next-auth" {
|
|||
role: string
|
||||
}
|
||||
}
|
||||
|
||||
// override user
|
||||
interface User {
|
||||
username?: string | null
|
||||
email?: string | null
|
||||
role?: string | null
|
||||
id: UserId
|
||||
displayName?: string | null
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue