PageSourceSearch

https://www.spcthailand.com/_next/static/chunks/pages/account/change-password-be3e2f4a4ab7f525.js

js spcthailand.com collected 2026-10-08 11:13:02 UTC 10,396 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1481],{59347:function(e,s,l){(window.__NEXT_P=window.__NEXT_P||[]).push(["/account/change-password",function(){return l(35293)}])},65409:function(e,s,l){"use strict";var t=l(85893),a=l(67294);let n=e=>{let{className:s,id:l,placeholder:n,forms:r}=e,[i,o]=(0,a.useState)(!1),d=e=>{o(!i)};return(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("input",{maxLength:20,type:i?"text":"password",className:"".concat(s),id:l||"",...r,placeholder:n||""}),(0,t.jsx)("div",{className:"absolute inset-y-0 right-0 pr-3 flex items-center text-sm leading-5",children:i?(0,t.jsx)("svg",{className:"h-5 text-gray-700",fill:"none",xmlns:"http://www.w3.org/2000/svg",onClick:d,viewBox:"0 0 640 512",children:(0,t.jsx)("path",{fill:"currentColor",d:"M320 400c-75.85 0-137.25-58.71-142.9-133.11L72.2 185.82c-13.79 17.3-26.48 35.59-36.72 55.59a32.35 32.35 0 0 0 0 29.19C89.71 376.41 197.07 448 320 448c26.91 0 52.87-4 77.89-10.46L346 397.39a144.13 144.13 0 0 1-26 2.61zm313.82 58.1l-110.55-85.44a331.25 331.25 0 0 0 81.25-102.07 32.35 32.35 0 0 0 0-29.19C550.29 135.59 442.93 64 320 64a308.15 308.15 0 0 0-147.32 37.7L45.46 3.37A16 16 0 0 0 23 6.18L3.37 31.45A16 16 0 0 0 6.18 53.9l588.36 454.73a16 16 0 0 0 22.46-2.81l19.64-25.27a16 16 0 0 0-2.82-22.45zm-183.72-142l-39.3-30.38A94.75 94.75 0 0 0 416 256a94.76 94.76 0 0 0-121.31-92.21A47.65 47.65 0 0 1 304 192a46.64 46.64 0 0 1-1.54 10l-73.61-56.89A142.31 142.31 0 0 1 320 112a143.92 143.92 0 0 1 144 144c0 21.63-5.29 41.79-13.9 60.11z"})}):(0,t.jsx)("svg",{className:"h-5 text-gray-700",fill:"none",xmlns:"http://www.w3.org/2000/svg",onClick:d,viewBox:"0 0 576 512",children:(0,t.jsx)("path",{fill:"currentColor",d:"M572.52 241.4C518.29 135.59 410.93 64 288 64S57.68 135.64 3.48 241.41a32.35 32.35 0 0 0 0 29.19C57.71 376.41 165.07 448 288 448s230.32-71.64 284.52-177.41a32.35 32.35 0 0 0 0-29.19zM288 400a144 144 0 1 1 144-144 143.93 143.93 0 0 1-144 144zm0-240a95.31 95.31 0 0 0-25.31 3.79 47.85 47.85 0 0 1-66.9 66.9A95.78 95.78 0 1 0 288 160z"})})})]})};s.Z=n},94725:function(e,s,l){"use strict";var t=l(85893);let a=e=>{let{className:s}=e;return(0,t.jsx)("div",{className:"".concat(s," absolute top-0 left-0 right-0 h-full bg-white opacity-80 rounded-lg cursor-wait"),children:(0,t.jsxs)("div",{className:"text-center translate-y-1/2",children:[(0,t.jsx)("span",{className:"loading loading-ring loading-3xl text-primary text-3xl"}),(0,t.jsx)("p",{children:"Loading ..."})]})})};s.Z=a},53579:function(e,s,l){"use strict";var t=l(85893),a=l(67294),n=l(11163),r=l(33299),i=l(41664),o=l.n(i),d=l(14280),c=l(90815),u=l(28253),m=l(30835),x=l(78781);let h=()=>{let[e,s]=(0,a.useState)(!0),l=(0,n.useRouter)(),{t:i}=(0,d.$G)("header"),{data:h}=(0,r.useSession)();(0,a.useEffect)(()=>{h&&s(!1)},[h]);let p=()=>{(0,r.signOut)()};return(0,t.jsxs)("div",{className:"m-2 bg-base-100 rounded-box overflow-hidden shadow divide-y text-[#05384E]",children:[(0,t.jsxs)("div",{className:"flex flex-col border-[#F4F4F4] items-center my-4 text-[#A82C31] font-bold text-xl",children:[(0,t.jsx)(x.Z,{image:null==h?void 0:h.user.image,name:"".concat(null==h?void 0:h.user.name),loading:e,className:"m-2",size:"xl"}),e?(0,t.jsx)("div",{className:" rounded-full w-36 h-8 bg-gray-200 my-2"}):(0,t.jsx)("div",{className:"min-h-8 my-2 text-center px-2",children:(0,t.jsx)("p",{children:null==h?void 0:h.user.name})})]}),(0,t.jsx)("ul",{className:"p-0 border-[#F4F4F4]",children:c.j.map((e,s)=>(0,t.jsx)("li",{className:"pt-2 pl-4 md:pl-6 ".concat(l.pathname.startsWith((0,u.nu)(m.D.ACCOUNT,{slug:e.slug},{}))?"bg-[#E2EAF8]":""),children:(0,t.jsx)(o(),{href:"reviews"===e.slug?"/reviews":(0,u.nu)(m.D.ACCOUNT,{slug:e.slug},{}),className:"hover:text-[#BC0F14] focus:text-inherit",children:(0,t.jsxs)("div",{className:"avatar placeholder mr-1",children:[(0,t.jsx)("div",{className:"inline-block text-neutral-content rounded-full w-5",children:(0,t.jsx)("img",{src:"/images/icons/icon-".concat(e.slug,".svg"),alt:e.slug})}),(0,t.jsx)("span",{className:"ml-2",children:i(e.title)})]})})},s))}),(0,t.jsx)("div",{className:"bg-[#FFE8E9] border-none text-center p-2 hover:text-[#BC0F14] focus:text-inherit",children:(0,t.jsx)("a",{href:"#",onClick:e=>p(),children:(0,t.jsx)("span",{className:"rounded-b-lg",children:i("Logout")})})})]})};s.Z=h},82941:function(e,s,l){"use strict";l.d(s,{jo:function(){return r},rE:function(){return n}});var t=l(24103),a=l(86605);let n=async e=>{let{data:s,language:l}=e,n=await (0,a.Pz)("".concat(t.h4.CONFIRM_EMAIL),s,l,{});return n},r=async function(e){let s=await (0,a.Pz)("".concat(t.h4.AUTH_ME),{},e.language,{},e.access_token);return s}},35293:function(e,s,l){"use strict";l.r(s),l.d(s,{__N_SSP:function(){return N},default:function(){return b}});var t=l(85893),a=l(67294),n=l(11163),r=l(33299),i=l(14280),o=l(346),d=l(53579),c=l(82941),u=l(9473),m=l(69800),x=l(87536),h=l(65409),p=l(94725),v=l(55459),f=l(30835),w=l(17533),g=l(41269);let j=e=>{var s,l,o,d,c;let{}=e,j=(0,u.I0)(),N=(0,n.useRouter)(),b=N.locale||"th",{t:_}=(0,i.$G)("common"),{register:C,formState:{errors:y},handleSubmit:F,watch:k}=(0,x.cI)(),[E,P]=(0,a.useState)(!1),{data:A,status:L}=(0,r.useSession)(),S=null==A?void 0:A.user.is_set_password,T=async e=>{w.B({action:g.n.ChangePassword,category:g.S.Account,label:void 0,value:void 0}),P(!0);let s={password:e.password};(null==A?void 0:A.user.is_set_password)&&(s.old_password=e.old_password);let l=await (0,v.Cp)(s,b);P(!1),200===l.statusCode?j((0,m.ak)({message:_("Password changed successfully."),onClose:async()=>{N.push(f.D.ACCOUNT_PROFILE)}})):j((0,m.ak)({message:l.message,onClose:()=>{}}))},D=e=>{N.back()},O=k("password"),Z=k("confirm_password");return"loading"===L?(0,t.jsx)("div",{children:"Loading..."}):(0,t.jsxs)("div",{className:"m-2 bg-base-100 rounded-box overflow-hidden shadow text-[#05384E] relative",children:[(0,t.jsx)("div",{className:"p-6",children:(0,t.jsx)("h1",{className:"font-bold text-2xl text-[#05384E]",children:_("Change Password")})}),(0,t.jsx)("div",{className:"p-6",children:(0,t.jsxs)("form",{method:"post",onSubmit:F(T),autoComplete:"off",children:[(0,t.jsxs)("div",{className:" flex flex-wrap",children:[S&&(0,t.jsx)("div",{className:"w-full my-2",children:(0,t.jsxs)("div",{className:"form-control mx-0 md:mr-2",children:[(0,t.jsx)("label",{className:"label-text ".concat((null==y?void 0:y.old_password)&&"text-red-600"),children:_("Old Password")}),(0,t.jsx)(h.Z,{placeholder:_("Old Password")||"",className:"input input-bordered w-full ".concat((null==y?void 0:y.old_password)&&"input-error text-red-600"),forms:{...C("old_password",{required:!0,maxLength:20,minLength:6})},id:null}),(null==y?void 0:null===(s=y.old_password)||void 0===s?void 0:s.type)==="required"&&(0,t.jsx)("p",{className:" text-red-600 text-sm font-light mt-1",children:_("This field is required")}),(null==y?void 0:null===(l=y.old_password)||void 0===l?void 0:l.type)==="minLength"&&(0,t.jsx)("p",{className:" text-red-600 text-sm font-light mt-1",children:_("Please set a password with at least 6 characters.")})]})}),(0,t.jsx)("div",{className:"w-full my-2",children:(0,t.jsxs)("div",{className:"form-control mx-0 md:mr-2",children:[(0,t.jsx)("label",{className:"label-text ".concat((null==y?void 0:y.password)&&"text-red-600"),children:_("New Password")}),(0,t.jsx)(h.Z,{placeholder:_("New Password")||"",className:"input input-bordered w-full ".concat((null==y?void 0:y.password)&&"input-error text-red-600"),forms:{...C("password",{required:!0,maxLength:20,minLength:6})},id:null}),(null==y?void 0:null===(o=y.password)||void 0===o?void 0:o.type)==="required"&&(0,t.jsx)("p",{className:" text-red-600 text-sm font-light mt-1",children:_("This field is required")}),(null==y?void 0:null===(d=y.password)||void 0===d?void 0:d.type)==="minLength"&&(0,t.jsx)("p",{className:" text-red-600 text-sm font-light mt-1",children:_("Please set a password with at least 6 characters.")})]})}),(0,t.jsx)("div",{className:"w-full my-2",children:(0,t.jsxs)("div",{className:"form-control mx-0 ",children:[(0,t.jsx)("label",{className:"label-text ".concat((null==y?void 0:y.confirm_password)&&"text-red-600"),children:_("Confirm New Password")}),(0,t.jsx)(h.Z,{placeholder:_("Confirm New Password")||"",className:"input input-bordered w-full ".concat((null==y?void 0:y.confirm_password)&&"input-error text-red-600"),forms:{...C("confirm_password",{required:!0,maxLength:20,validate:e=>e===O||"Passwords do not match"})},id:null}),(null==y?void 0:null===(c=y.confirm_password)||void 0===c?void 0:c.type)==="required"&&(0,t.jsx)("p",{className:" text-red-600 text-sm font-light mt-1",children:_("This field is required")}),(null==O?void 0:O.length)>
10&&O!==Z&&(0,t.jsx)("p",{className:" text-red-600 text-sm font-light mt-1",children:_("The password confirmation is incorrect.")})]})})]}),(0,t.jsxs)("div",{className:"flex mb-3 mt-3 justify-center",children:[(0,t.jsx)("button",{className:"btn w-32 mx-3 normal-case rounded-full text-[#FFFFFF] bg-[#ADADAD] hover:bg-[#BDBDBD] ".concat(E&&"btn-disabled"),onClick:D,children:_("Cancel")}),(0,t.jsx)("button",{className:"btn w-32 mx-3 normal-case rounded-full text-[#FFFFFF] bg-[#A82C31] hover:bg-[#DE2F2F] ".concat(E&&"btn-disabled"),children:E?_("Submitting"):_("Save")})]})]})}),E&&(0,t.jsx)(p.Z,{className:""})]})};var N=!0;function b(e){let[s,l]=(0,a.useState)(!0),[x,h]=(0,a.useState)(!1),[p,v]=(0,a.useState)(null),f=(0,u.I0)(),w=(0,n.useRouter)(),g=w.locale||"th",{data:N,status:b}=(0,r.useSession)(),{t:_}=(0,i.$G)("common"),C=async()=>{if(N){var e;let s=await (0,c.jo)({access_token:null==N?void 0:null===(e=N.token)||void 0===e?void 0:e.accessToken,language:g});200===s.statusCode?(v(s.data),l(!1)):f((0,m.ak)({message:_("กรุณาเข้าสู่ระบบใหม่"),onClose:()=>{w.push("/login")}}))}else null===N&&w.push("/login")};(0,a.useEffect)(()=>{C()},[N,g,w]);let y={title:_("My Profile"),description:"",keywords:"",image_url:"",path:"/account/change-password"};return(0,t.jsx)(o.Z,{page:y,children:(0,t.jsxs)("main",{className:"container mx-auto mt-8 flex flex-row",children:[(0,t.jsx)("div",{className:"hidden lg:block lg:basis-3/12",children:(0,t.jsx)(d.Z,{})}),(0,t.jsx)("div",{className:"mx-2 p-6 pt-0 basis-full lg:basis-9/12",children:(0,t.jsx)(j,{})})]})})}}},function(e){e.O(0,[2678,3714,4885,6225,4927,7536,8253,346,9774,2888,179],function(){return e(e.s=59347)}),_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.