| Current Path : /home/users/unlimited/www/learnoid.codeskitter.site/public/build/assets/ |
| Current File : /home/users/unlimited/www/learnoid.codeskitter.site/public/build/assets/VerifyOtp-D6N86VI6.js |
import{_ as x,r as u,I as O,E as $,c as l,a as e,t as n,e as v,w as S,F as T,A as P,z as g,S as d,f as I,o as i,b as V,v as j}from"./app-DM0q11P6.js";/* empty css */const C={class:"bg-light vh-100 d-flex align-items-center justify-content-center"},B={class:"login-wizard bg-white col-12 col-lg-8 theme-shadow p-4"},A={class:"row"},R={class:"col-12 col-lg-6 px-5 py-4"},D={class:"d-flex h-100"},E={class:"my-auto w-100"},L={class:"fw-bold mb-3"},N={class:"text-muted"},z={class:"otp-fields d-flex mb-4"},F=["onUpdate:modelValue","onInput"],M={key:0,class:"d-block mb-3"},U={class:"text-primary"},q={type:"submit",class:"btn btn-primary w-100 rounded-pill mt-3"},W={__name:"VerifyOtp",setup(Y){const h=O(),_=I(),r=u(["","","",""]),f=u([]),p=u(h.query.email),y=$(),a=u(59);setInterval(()=>{a.value>0&&(a.value--,a.value<10?a.value="0"+a.value:a.value)},1e3);const w=async()=>{var s,t;try{const o=await g.post("/reset-password/validate",{otp:r.value.join(""),email:p.value});y.setAuthData(o.data.data.token,o.data.data.user),d.fire({icon:"success",title:$t("OTP Verified"),text:$t("You can now change your password"),showConfirmButton:!1,timer:1500}),_.push("/new_password")}catch(o){d.fire({icon:"error",title:"Oops...",text:((t=(s=o.response)==null?void 0:s.data)==null?void 0:t.message)||$t("Something went wrong. Please try again")})}},b=async()=>{var s,t;try{g.post("/reset-password",{email:p.value},{headers:{"Content-Type":"application/json",Accept:"application/json"}}),d.fire({icon:"success",title:"Success",text:$t("Password reset link sent to your email address"),showConfirmButton:!1,timer:1500}),a.value=59}catch(o){d.fire({icon:"error",title:"Oops...",text:((t=(s=o.response)==null?void 0:s.data)==null?void 0:t.message)||$t("Something went wrong. Please try again")})}},k=(s,t)=>{const o=s.target;o.value.length===1&&(r.value.splice(t,1,o.value),t<r.value.length-1&&f.value[t+1].focus())};return(s,t)=>(i(),l("section",C,[e("section",B,[e("div",A,[e("div",R,[t[0]||(t[0]=e("img",{src:"/assets/images/logo-new.png",class:"object-fit-cover",alt:"Login",height:"50px"},null,-1)),e("div",D,[e("div",E,[e("h3",L,n(s.$t("Enter Code")),1),e("span",N,[v(n(s.$t("We sent an OTP code to your email address"))+" - ",1),e("strong",null,n(p.value),1)]),e("form",{onSubmit:S(w,["prevent"]),class:"my-4"},[e("div",z,[(i(!0),l(T,null,P(r.value,(o,c)=>V((i(),l("input",{type:"number",class:"form-control text-center py-3 me-3",maxlength:"1",key:c,ref_for:!0,ref_key:"otpInput",ref:f,"onUpdate:modelValue":m=>r.value[c]=m,onInput:m=>k(m,c),placeholder:"_"},null,40,F)),[[j,r.value[c]]])),128))]),a.value!=="00"?(i(),l("span",M,[v(n(s.$t("Resend OTP in"))+" ",1),e("span",U,"00:"+n(a.value),1)])):(i(),l("a",{key:1,onClick:b,class:"text-primary d-block"},n(s.$t("Resend OTP")),1)),e("button",q,n(s.$t("Confirm OTP")),1)],32)])])]),t[1]||(t[1]=e("div",{class:"d-none d-lg-block col-6"},[e("img",{src:"/assets/images/login-bg.png",class:"side-image object-fit-cover w-100"})],-1))])])]))}},J=x(W,[["__scopeId","data-v-a73abd39"]]);export{J as default};