"use strict";(()=>{var e={};e.id=9436,e.ids=[9436,2331],e.modules={53524:e=>{e.exports=require("@prisma/client")},20399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},98223:(e,r,s)=>{s.r(r),s.d(r,{originalPathname:()=>v,patchFetch:()=>x,requestAsyncStorage:()=>m,routeModule:()=>c,serverHooks:()=>w,staticGenerationAsyncStorage:()=>h});var t={};s.r(t),s.d(t,{POST:()=>l});var a=s(49303),n=s(88716),o=s(60670),i=s(87070),u=s(72331);let p=require("bcrypt");var d=s.n(p);async function l(e){try{let{token:r,password:s}=await e.json();if(!r||!s)return i.NextResponse.json({error:"Token dan password wajib diisi"},{status:400});if(s.length<8)return i.NextResponse.json({error:"Password minimal 8 karakter"},{status:400});let t=await u.default.user.findFirst({where:{resetToken:r,resetTokenExp:{gt:new Date}}});if(!t)return i.NextResponse.json({error:"Link reset password tidak valid atau sudah kedaluwarsa"},{status:400});let a=await d().hash(s,10);return await u.default.user.update({where:{id:t.id},data:{password:a,resetToken:null,resetTokenExp:null}}),i.NextResponse.json({success:!0})}catch(e){return console.error("[RESET PASSWORD]",e),i.NextResponse.json({error:"Terjadi kesalahan internal"},{status:500})}}let c=new a.AppRouteRouteModule({definition:{kind:n.x.APP_ROUTE,page:"/api/auth/reset-password/route",pathname:"/api/auth/reset-password",filename:"route",bundlePath:"app/api/auth/reset-password/route"},resolvedPagePath:"C:\\Users\\akmal\\OneDrive\\Documents\\AmaneNime Topup\\amanenime-topup\\app\\api\\auth\\reset-password\\route.ts",nextConfigOutput:"standalone",userland:t}),{requestAsyncStorage:m,staticGenerationAsyncStorage:h,serverHooks:w}=c,v="/api/auth/reset-password/route";function x(){return(0,o.patchFetch)({serverHooks:w,staticGenerationAsyncStorage:h})}},72331:(e,r,s)=>{s.r(r),s.d(r,{default:()=>n,prisma:()=>a});var t=s(53524);let a=globalThis.prisma??new t.PrismaClient({datasources:{db:{url:(()=>{if(process.env.DATABASE_URL)return process.env.DATABASE_URL;let e=process.env.DB_USER||"root",r=process.env.DB_PASSWORD||"",s=process.env.DB_HOST||"127.0.0.1",t=process.env.DB_PORT||"3306",a=process.env.DB_NAME||"amanenime_topup";return`mysql://${e}:${r}@${s}:${t}/${a}`})()}},log:["error"]}),n=a}};var r=require("../../../../webpack-runtime.js");r.C(e);var s=e=>r(r.s=e),t=r.X(0,[8948,5972],()=>s(98223));module.exports=t})();