mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-14 00:31:25 +10:00
switch back to json
This commit is contained in:
@ -1,6 +1,10 @@
|
||||
import { AuthMec, Invitation } from "@prisma/client";
|
||||
import prisma from "~/server/internal/db/database";
|
||||
import { createHashArgon2 } from "~/server/internal/security/simple";
|
||||
import {
|
||||
createHashArgon2,
|
||||
simpleAuth,
|
||||
SimpleAuthType,
|
||||
} from "~/server/internal/security/simple";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import * as jdenticon from "jdenticon";
|
||||
import objectHandler from "~/server/internal/objects";
|
||||
@ -67,13 +71,16 @@ export default defineEventHandler(async (h3) => {
|
||||
[`internal:read`, `${userId}:write`]
|
||||
);
|
||||
|
||||
const hash = await createHashArgon2(user.password);
|
||||
const creds: SimpleAuthType = {
|
||||
version: "v1.0.0",
|
||||
password: await createHashArgon2(user.password),
|
||||
};
|
||||
|
||||
const [linkMec] = await prisma.$transaction([
|
||||
prisma.linkedAuthMec.create({
|
||||
data: {
|
||||
mec: AuthMec.Simple,
|
||||
credentials: {},
|
||||
password: hash,
|
||||
credentials: creds,
|
||||
user: {
|
||||
create: {
|
||||
id: userId,
|
||||
|
||||
Reference in New Issue
Block a user