PageSourceSearch

https://tamseyfs.com/_next/static/chunks/app/auth/signin/page-e28be9c2215680d5.js

js tamseyfs.com collected 2026-10-02 15:34:48 UTC 7,793 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4680],{18613:(e,r,s)=>{Promise.resolve().then(s.bind(s,36301))},36301:(e,r,s)=>{"use strict";s.r(r),s.d(r,{default:()=>g});var t=s(95155),a=s(12115),o=s(15239),i=s(52619),l=s.n(i),n=s(36489),c=s(20063),d=s(7077),m=s(79011),u=s(83267),h=s(72181);function g(){(0,c.useRouter)();let[e,r]=(0,a.useState)(!1),[s,i]=(0,a.useState)(""),[g,p]=(0,a.useState)(""),[f,w]=(0,a.useState)(!1),[x,v]=(0,a.useState)(!1),[b,y]=(0,a.useState)(!1),[j,N]=(0,a.useState)({secret:""}),[T,S]=(0,a.useState)(!1),L=async e=>{if(null!==e&&""!==e&&6===e.length)try{w(!0),S(!1),y(!1);let r=await fetch("/api/auth/set-pin-by-email-address",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:s,pin:e,secret:null==j?void 0:j.secret})}),t=await r.json(),a=r.status;200===a&&P(e),200!==a&&(""!==t.message&&d.mL.showToast("error",t.message),t.errors&&Object.values(t.errors).forEach(e=>{e.forEach(e=>{d.mL.showToast("error",e)})}))}catch(e){d.mL.showToast("error","Something went wrong")}finally{w(!1),S(!1),y(!1)}else d.mL.showToast("error","Please enter a valid 6-digit PIN")},P=async e=>{try{w(!0);let o=await (0,n.signIn)("credentials",{redirect:!1,email:s,password:e});if(!o)return;if(null==o?void 0:o.error){let e=JSON.parse(o.error);if(400===e.status){var r,t,a;(null==(r=e.data)?void 0:r.message)!==""&&d.mL.showToast("error",null==(a=e.data)?void 0:a.message),(null==(t=e.data)?void 0:t.errors)&&Object.values(e.data.errors).forEach(e=>{e.forEach(e=>{d.mL.showToast("error",e)})})}return}N({secret:""})}catch(e){d.mL.showToast("error","Something went wrong. Please try again.")}finally{w(!1)}},E=async e=>{w(!0);try{let r=await fetch("/api/auth/forgot-password",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e})}),s=await r.json(),t=r.status;200===t?(d.mL.showToast("success",s.message),y(!0)):(""!==s.message&&d.mL.showToast("error",s.message),s.errors&&Object.values(s.errors).forEach(e=>{e.forEach(e=>{d.mL.showToast("error",e)})}))}catch(e){d.mL.showToast("error","Something went wrong")}finally{w(!1)}},k=async e=>{if(e.preventDefault(),e.stopPropagation(),!s||!g)return void d.mL.showToast("error","Email and password are required.");if(!s.trim())return void d.mL.showToast("error","Email is required");if(!g.trim())return void d.mL.showToast("error","Password is required");if(!/\S+@\S+\.\S+/.test(s))return void d.mL.showToast("error","Please enter a valid email");if(g.length<6)return void d.mL.showToast("error","Password must be at least 6 characters long");x?localStorage.setItem("rememberEmail",s):localStorage.removeItem("rememberEmail");try{w(!0);let e=await (0,n.signIn)("credentials",{redirect:!1,email:s,password:g});if(!e)return;if(null==e?void 0:e.error){let i=JSON.parse(e.error);if(400===i.status){var r,t,a,o;if((null==(r=i.data)?void 0:r.message)!==""&&d.mL.showToast("error",null==(o=i.data)?void 0:o.message),(null==(t=i.data)?void 0:t.data)==="set_pin_by_email")return void E(s);(null==(a=i.data)?void 0:a.errors)&&Object.values(i.data.errors).forEach(e=>{e.forEach(e=>{d.mL.showToast("error",e)})})}return}}catch(e){d.mL.showToast("error","Something went wrong. Please try again.")}finally{w(!1)}};return(0,a.useEffect)(()=>{let e=localStorage.getItem("rememberEmail");e&&(i(e),v(!0))},[]),(0,t.jsxs)("div",{className:"login_wrapper",children:[(0,t.jsx)(m.A,{}),b&&(0,t.jsx)(u.A,{email:s,open:b,onClose:()=>{y(!1),w(!1)},onSubmit:e=>{e.status?""!==e.secret?(N(e),y(!1),S(!0)):d.mL.showToast("error","Something went wrong with set PIN, Please try again after some time."):""!==e.message&&d.mL.showToast("error",e.message)},route:"/api/auth/verify-set-pin-email-address"}),T&&(0,t.jsx)(h.A,{email:s,open:T,onClose:()=>{S(!1),w(!1)},onSubmit:e=>L(e)}),(0,t.jsx)("section",{className:"login__sec py-10",children:(0,t.jsxs)("div",{className:"container mx-auto max-w-md",children:[(0,t.jsx)("h3",{className:"mb-6 text-center text-2xl font-semibold",children:"Login"}),(0,t.jsxs)("form",{onSubmit:k,className:"login_form space-y-6",children:[(0,t.jsxs)("div",{className:"form-block",children:[(0,t.jsxs)("label",{className:"block mb-1 font-medium",children:["Email address ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsx)("input",{id:"email",name:"email",autoComplete:"email",className:"form-control w-full border rounded-lg px-3 py-2",type:"email",disabled:f,placeholder:"Enter your email address",value:s,onChange:e=>i(e.target.value)})]}),(0,t.jsxs)("div",{className:"form-block",children:[(0,t.jsxs)("label",{className:"block mb-1 font-medium",children:["Password / 6 Digit PIN ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsxs)("div",{className:"input-group relative",children:[(0,t.jsx)("input",{id:"password",name:"password",className:"form-control w-full border rounded-lg px-3 py-2",type:e?"text":"password",placeholder:"xxxxxx",disabled:f,style:{borderTopRightRadius:10,borderBottomRightRadius:10},value:g,onChange:e=>p(e.target.value)}),(0,t.jsx)("button",{type:"button",onClick:()=>r(!e),className:"input-group-text absolute right-3 top-1/2 -translate-y-1/2 border-0 password-eye",children:(0,t.jsx)(o.default,{src:e?"/images/eye-outline.svg":"/images/eye-off-outline.svg",alt:"Toggle Password",width:22,height:22})})]}),(0,t.jsx)("div",{className:"text-end mt-1",children:(0,t.jsx)(l(),{href:"/auth/forgot-password",className:"forgot_link text-sm text-blue-600",children:"Forgot your Password / PIN?"})})]}),(0,t.jsxs)("div",{className:"form-check mb-4 flex items-center gap-2",children:[(0,t.jsx)("input",{className:"form-check-input",type:"checkbox",id:"checkDefault",checked:x,onChange:e=>v(e.target.checked)}),(0,t.jsx)("label",{className:"form-check-label",htmlFor:"checkDefault",children:"Remember me"})]}),(0,t.jsx)("button",{type:"submit",disabled:f,className:"btn-theme fill secondary w-full py-3 rounded-lg bg-blue-600 text-white",children:f?"Logging in...":"Login"}),(0,t.jsxs)("div",{className:"create_info text-center mt-4",children:["Don’t have an account?"," ",(0,t.jsx)(l(),{href:"/auth/signup",className:"text-blue-600 font-medium",children:"Create an Account"})]})]})]})})]})}},79011:(e,r,s)=>{"use strict";s.d(r,{A:()=>m});var t=s(95155),a=s(12115),o=s(36489),i=s(52619),l=s.n(i),n=s(20063),c=s(7077);async function d(){return 200===(await fetch("/api/user/check-auth",{method:"PUT",headers:{"Content-Type":"application/json"}})).status?{user:!0}:null}function m(){let e=(0,n.useRouter)(),{data:r,status:s}=(0,o.useSession)(),i=!!(null==r?void 0:r.user),m=(0,n.usePathname)(),u=["/auth/signup","/auth/forgot-password","/auth/reset-password"];return((0,a.useEffect)(()=>{let s=async()=>{let s=await d();if(!s&&(await (0,o.signOut)({redirect:!1}),u.includes(m)||(0,n.redirect)("/auth/signin")),s){var t;let s=null==r||null==(t=r.user)?void 0:t.account_type;c.mL.userRoles().includes(s||"")||(await (0,o.signOut)({redirect:!1}),c.mL.showToast("error","Unauthorized account type."),(0,n.redirect)("/auth/signin")),"/auth/signin"===c.mL.redirectUserTo(s)&&(await (0,o.signOut)({redirect:!1}),c.mL.showToast("error","Unauthorized account type."),(0,n.redirect)("/auth/signin"));let a=new URLSearchParams(window.location.search).get("redirect");a?e.push("/auth/post-login?redirect=".concat(encodeURIComponent(a||""))):e.push("/auth/post-login")}};i&&s()},[i,n.redirect]),"loading"===s)?null:(0,t.jsx)("header",{className:"login_header",children:(0,t.jsx)("div",{className:"container mx-auto flex justify-center",children:(0,t.jsx)("div",{className:"logo",children:(0,t.jsx)(l(),{href:"/",children:(0,t.jsx)("img",{src:"/images/logo-transparent.svg",alt:"TamseyFS",width:150,height:50})})})})})}}},e=>{e.O(0,[9268,2719,6489,2619,5239,7077,3463,8441,1255,7358],()=>e(e.s=18613)),_N_E=e.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.