Resources Seite für Desktop-client
This commit is contained in:
@@ -4,7 +4,7 @@ import Credentials from "next-auth/providers/credentials";
|
||||
import { DiscordAccount, prisma, User } from "@repo/db";
|
||||
import bcrypt from "bcryptjs";
|
||||
import oldUser from "./var.User.json";
|
||||
import { OldUser } from "../../../../types/oldUser";
|
||||
import { createNewUserFromOld, OldUser } from "../../../../types/oldUser";
|
||||
import { sendVerificationLink } from "(app)/admin/user/action";
|
||||
|
||||
export const options: AuthOptions = {
|
||||
@@ -28,48 +28,7 @@ export const options: AuthOptions = {
|
||||
"v1 User Passwords match:",
|
||||
bcrypt.compareSync(credentials.password, v1User.password),
|
||||
);
|
||||
const newUser = await prisma.user.create({
|
||||
data: {
|
||||
email: v1User.email,
|
||||
password: v1User.password,
|
||||
migratedFromV1: true,
|
||||
firstname: v1User.firstname,
|
||||
lastname: v1User.lastname,
|
||||
publicId: v1User.publicId,
|
||||
badges: [
|
||||
...v1User.badges
|
||||
.map((badge) => {
|
||||
switch (badge) {
|
||||
case "day-1-member":
|
||||
return "DAY1";
|
||||
case "d-1":
|
||||
return "D1";
|
||||
case "p-1":
|
||||
return "P1";
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.filter((badge) => badge !== null),
|
||||
"V1Veteran",
|
||||
],
|
||||
},
|
||||
});
|
||||
if (v1User.discord) {
|
||||
await prisma.discordAccount.create({
|
||||
data: {
|
||||
tokenType: "Bearer",
|
||||
refreshToken: v1User.discord.tokens.refresh_token,
|
||||
discordId: v1User.discord.profile.id,
|
||||
userId: newUser.id,
|
||||
username: v1User.discord.profile.username,
|
||||
globalName: v1User.discord.profile.global_name,
|
||||
avatar: v1User.discord.profile.avatar,
|
||||
email: v1User.discord.profile.email,
|
||||
verified: v1User.discord.profile.verified,
|
||||
},
|
||||
});
|
||||
}
|
||||
const newUser = await createNewUserFromOld(v1User);
|
||||
await sendVerificationLink(newUser.id);
|
||||
return newUser;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user