1import{_ as N,g as A,K as L,B as M,h as R,a4 as T,o,c as n,a as t,j as s,d as u,t as v,l as w,b as U,w as $,A as D,m as P,v as C,q as x,F as E,r as F,s as V,S as I,y as p,e as O,x as j,av as z}from"#entry";import{u as K}from"./DiAkLY_n.js";const W={class:"reset-wrap"},Y={class:"reset-card"},G={key:0,class:"muted"},H={key:0},J={key:1,class:"muted"},Q={key:2,class:"error-box"},X={key:3,class:"success-box"},Z={key:0,id:"pw-strength",class:"pw-strength","aria-live":"polite"},ee=["aria-label"],se={class:"pw-meta"},te={key:0,class:"pw-tip"},ae={class:"terms-check"},oe={key:1,class:"error"},ne=["disabled"],re={__name:"set-password",setup(ie){const h=A(),S=L(),{login:q}=M(),k=h.query.token||h.query.t||h.query.reset_token||"",g=h.query.email||"";K({title:"Set up your account",noindex:!0});const i=p(""),m=p(""),y=p(!1),f=p(!1),a=p(""),b=p(!1),d=p(null),c=j(()=>z(i.value));R(async()=>{if(!k){d.value=!1,a.value="This activation link is invalid or incomplete. Please ask your institution to resend the invite.";return}try{const r=await $fetch(T("check-reset-link"),{method:"POST",body:{token:k}});d.value=r.status==="success",d.value||(a.value="This activation link has expired or is invalid. Please ask your institution to resend the invite.")}catch{d.value=!1,a.value="This activation link has expired or is invalid. Please ask your institution to resend the invite."}});const B=async()=>{if(a.value="",i.value.length<8){a.value="Password must be at least 8 characters.";return}if(i.value!==m.value){a.value="Passwords do not match.";return}if(!y.value){a.value="Please accept the Terms & Conditions to continue.";return}f.value=!0;try{if(await $fetch(T("reset-password"),{method:"POST",body:{token:k,password:i.value,confirm_password:m.value,accept_terms:y.value}}),b.value=!0,g)try{const r=await q(String(g),i.value);if(r?.user){const e=String(r.user.role||"").toLowerCase(),_=e==="institution-admin"||e==="professor"?"/institute":"/student";setTimeout(()=>{S.push(_)},1200);return}}catch{}setTimeout(()=>{S.push("/?login=1")},2e3)}catch(r){a.value=r?.data?.msg||r?.data?.message||"This activation link has expired or is invalid. Please ask your institution to resend the invite."}finally{f.value=!1}};return(r,e)=>{const _=O;return o(),n("div",W,[t("div",Y,[e[11]||(e[11]=t("h1",null,"Set up your account",-1)),s(d)!==!1&&!s(b)?(o(),n("p",G,[e[3]||(e[3]=u(" Welcome to Passmed",-1)),s(g)?(o(),n("span",H," â "+v(s(g)),1)):w("",!0),e[4]||(e[4]=u(". Create a password to activate your account. ",-1))])):w("",!0),s(d)===null?(o(),n("div",J," Verifying your invitation⦠")):s(d)===!1?(o(),n("div",Q,[t("p",null,v(s(a)),1),e[6]||(e[6]=t("p",null," ",-1)),U(_,{to:"/?login=1",class:"btn-primary"},{default:$(()=>[...e[5]||(e[5]=[u(" Back to log in ",-1)])]),_:1})])):s(b)?(o(),n("div",X,[...e[7]||(e[7]=[t("h2",null,"Account ready",-1),t("p",null,"Your account is set up. Signing you inâ¦",-1)])])):(o(),n("form",{key:4,onSubmit:D(B,["prevent"])},[t("label",null,[e[8]||(e[8]=u(" Create password ",-1)),P(t("input",{"onUpdate:modelValue":e[0]||(e[0]=l=>x(i)?i.value=l:null),type:"password",autocomplete:"new-password",required:"",minlength:"8","aria-describedby":"pw-strength"},null,512),[[C,s(i)]])]),s(i)?(o(),n("div",Z,[t("div",{class:"pw-bar",role:"img","aria-label":`Password strength: ${s(c).label}`},[(o(),n(E,null,F(5,l=>t("span",{key:l,class:"pw-seg",style:V({background:l<=s(c).score+1?s(c).color:"#e5e7eb"})},null,4)),64))],8,ee),t("div",se,[t("span",{class:"pw-label",style:V({color:s(c).color})},v(s(c).label),5),s(c).suggestions.length?(o(),n("span",te,v(s(c).suggestions[0]),1)):w("",!0)])])):w("",!0),t("label",null,[e[9]||(e[9]=u(" Confirm password ",-1)),P(t("input",{"onUpdate:modelValue":e[1]||(e[1]=l=>x(m)?m.value=l:null),type:"password",autocomplete:"new-password",required:""},null,512),[[C,s(m)]])]),t("label",ae,[P(t("input",{"onUpdate:modelValue":e[2]||(e[2]=l=>x(y)?y.value=l:null),type:"checkbox"},null,512),[[I,s(y)]]),e[10]||(e[10]=t("span",null,[u(" I agree to the "),t("a",{href:"/terms",target:"_blank",rel:"noopener"},"Terms & Conditions"),u(" and "),t("a",{href:"/privacy",target:"_blank",rel:"noopener"},"Privacy Policy"),u(". ")],-1))]),s(a)?(o(),n("p",oe,v(s(a)),1)):w("",!0),t("button",{type:"submit",class:"btn-primary",disabled:s(f)},v(s(f)?"Setting upâ¦":"Create password & continue"),9,ne)],32))])])}}},de=N(re,[["__scopeId","data-v-7100ea45"]]);export{de as default};
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.