mirror of
https://github.com/wassname/Open-Assistant.git
synced 2026-09-09 11:15:08 +08:00
updated avatar component name, added ability to change username (only works server side for now), updated signin page, updated Footer
Still working on the account settings page but didn't want to get behind on commits.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type { AuthOptions } from "next-auth";
|
||||
import NextAuth from "next-auth";
|
||||
import { NextApiHandler } from "next";
|
||||
import DiscordProvider from "next-auth/providers/discord";
|
||||
import EmailProvider from "next-auth/providers/email";
|
||||
import { PrismaAdapter } from "@next-auth/prisma-adapter";
|
||||
@@ -37,7 +38,7 @@ export const authOptions: AuthOptions = {
|
||||
adapter: PrismaAdapter(prisma),
|
||||
providers,
|
||||
pages: {
|
||||
signIn: "/auth/signup",
|
||||
signIn: "/auth/signin",
|
||||
verifyRequest: "/auth/verify",
|
||||
// error: "/auth/error", -Will be used later
|
||||
},
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import { getSession } from "next-auth/react";
|
||||
import { Prisma } from "@prisma/client";
|
||||
import Email from "next-auth/providers/email";
|
||||
|
||||
// POST /api/post
|
||||
// Required fields in body: title
|
||||
// Optional fields in body: content
|
||||
export default async function handle(req, res) {
|
||||
const { username } = req.body;
|
||||
const { email } = req.body;
|
||||
|
||||
const session = await getSession({ req });
|
||||
const result = await prisma.user.update({
|
||||
where: {
|
||||
email: session?.user?.email,
|
||||
},
|
||||
data: {
|
||||
name: username,
|
||||
},
|
||||
});
|
||||
res.json({ name: result.name });
|
||||
}
|
||||
Reference in New Issue
Block a user