Login bug fix

This commit is contained in:
2024-03-04 17:09:23 +08:00
parent 0f2280f116
commit a3f507169a
20 changed files with 216 additions and 76 deletions

View File

@@ -6,29 +6,6 @@ import { randomOTP } from "./rondom_otp";
export async function auth_funLogin(nomor: string) {
const codeOtp = randomOTP();
// const res = await fetch(
// `https://wa.wibudev.com/code?nom=${nomor}&text=Masukan Kode OTP:${codeOtp}`
// );
// const sendWa = await res.json();
// if (sendWa.status !== "success")
// return { status: 400, message: "WA Tidak Terdaftar" };
// const createOtpId = await prisma.kodeOtp.create({
// data: {
// nomor: nomor,
// otp: codeOtp,
// },
// });
// if (!createOtpId) return { status: 400, message: "Gagal Membuat Kode OTP" };
// return {
// status: 200,
// message: "Kode Verifikasi Dikirim",
// kodeOtpId: createOtpId.id
// };
try {
const res = await fetch(
`https://wa.wibudev.com/code?nom=${nomor}&text=Masukan Kode OTP:${codeOtp}`

View File

@@ -1,6 +1,7 @@
"use server";
import prisma from "@/app/lib/prisma";
import { revalidatePath } from "next/cache";
import { cookies } from "next/headers";
export async function auth_Logout(kodeId: string) {
@@ -8,6 +9,7 @@ export async function auth_Logout(kodeId: string) {
name: "ssn",
value: "",
maxAge: 0,
path: "/dev/auth/login",
});
const c = cookies().get("ssn");
@@ -19,7 +21,7 @@ export async function auth_Logout(kodeId: string) {
},
});
if (!del) return { status: 400, message: "Gagal Hapus Kode OTP Id" };
if (!del) return { status: 400, message: "Gagal Hapus Kode OTP Id"};
revalidatePath("/dev/katalog")
return { status: 200, message: "Logout Berhasil" };
}

View File

@@ -31,8 +31,8 @@ export async function Auth_funRegister(data: any) {
const seal = await sealData(
JSON.stringify({
id: data.id,
username: data.username,
id: create.id,
username: create.username,
}),
{
password: await config.server.password,