1import{_ as R}from"./B-cqxV1P.js";import{d as O,h as k,_ as x,x as N,r as y,c as g,o as a,a as o,k as p,t as s,f as h,y as A,g as w,A as F,Y as D,F as M,z as j,i as E,T as U,w as I,v as P,l as T,q as H,b as d,e as _,n as Y,B,j as v}from"#entry";import{f as z,a as G,b as J}from"./LrbwgdqD.js";import{_ as K}from"./BW3jUCXS.js";import{F as Q}from"./Cu-Rz3C9.js";const W=O(),S=k(),X=N({components:{BaseButton:D},props:{provider:{type:F,required:!0},connected:{type:Boolean,required:!0},email:{type:String,required:!1,default:void 0}},data(){return{loading:!1}},computed:{connectUrl:function(){return`/auth/${this.provider.name}/connect?src=${encodeURIComponent(this.source)}`},source:function(){return window.parent.location.href.split("#")[0]}},methods:{async disconnectAuthenticationProvider(e){this.loading=!0,await S.$manageAccountRepository.disconnectSocialSignIn(e).then(async()=>{let t=await S.$userRepository.get(W.params.id);S.$bus.$emit("update_user_details",t)}).catch(t=>{console.error(t)}).finally(()=>{this.loading=!1})}}}),Z=["textContent"],ee=["textContent"],te=["textContent"],ne=["textContent"];function oe(e,t,r,i,n,c){const f=y("BaseButton");return a(),g("div",null,[o("h3",{class:"mb-0",textContent:s(e.$t(`manage-account.connections-section.login-${e.provider.name}-title`))},null,8,Z),o("p",{textContent:s(e.$t(`manage-account.connections-section.social-${e.connected?"signin":"signout"}-explanation`,{service:e.$t(e.provider.name)}))},null,8,ee),e.connected?(a(),p(f,{key:0,class:"mb-2",loading:e.loading,onClick:t[0]||(t[0]=w(u=>e.disconnectAuthenticationProvider(e.provider.name),["prevent"]))},{default:h(()=>[(a(),p(A(e.provider.icon),{class:"position-relative me-2",style:"top: -.1rem"})),o("span",{class:"text-dark",textContent:s(e.$t("global.button-disconnect",{email:e.email}))},null,8,te)]),_:1},8,["loading"])):(a(),p(f,{key:1,class:"mb-2",loading:e.loading,external:!0,to:e.connectUrl},{default:h(()=>[(a(),p(A(e.provider.icon),{class:"position-relative me-2",style:"top: -.1rem"})),o("span",{class:"text-dark",textContent:s(e.$t(`global.button-connect-${e.provider.name}`))},null,8,ne)]),_:1},8,["loading","to"]))])}const se=Object.assign(x(X,[["render",oe]]),{__name:"SingleSignOnConnection"}),ie={props:{userAuthenticationProviders:{type:Array,required:!0}}},ae=["textContent"];function re(e,t,r,i,n,c){const f=se;return a(),g("div",null,[o("h2",{class:"mb-5",textContent:s(e.$t("manage-account.connections-section.title"))},null,8,ae),(a(!0),g(M,null,j(e.$pinia.$availableAuthenticationProviders,u=>(a(),p(f,{key:u.name,class:"mb-5",provider:u,connected:!!r.userAuthenticationProviders.find(C=>C.name===u.name),email:(r.userAuthenticationProviders.find(C=>C.name===u.name)||{}).email},null,8,["provider","connected","email"]))),128))])}const le=Object.assign(x(ie,[["render",re]]),{__name:"SingleSignOnConnections"}),$=k(),ce={components:{ConfirmModal:U},props:{userDetails:{type:Object,required:!0},deleteState:{type:E,required:!0}},emits:["error","loading"],data(){return{accountDeletionErrorDetails:null,faExclamationCircle:z,email:""}},methods:{deleteAccount(){if(this.$emit("error",null),!this.email||!this.email.trim()){this.$emit("error",$.$i18n.t("manage-account.security-section.confirm-delete.error-email-empty")),this.$refs.deleteModalEmail.focus();return}if(this.userDetails.attributes.email!==this.email.trim()){this.$emit("error",$.$i18n.t("manage-account.security-section.confirm-delete.error-email-does-not-match")),this.$refs.deleteModalEmail.focus();return}this.$emit("loading",!0),$.$manageAccountRepository.deleteAccount().then(()=>{T()}).catch(e=>{this.$emit("loading",!1);const t=e._data||{};if(t.errors[0].status===409){t.errors[0].hasOwnProperty("detail")&&t.errors[0].detail!==""&&(this.accountDeletionErrorDetails=!0,this.$emit("error",t.errors[0].detail));return}this.$emit("error",$.$i18n.t("manage-account.security-section.confirm-delete.error"))})}}},ue=["innerHTML"],me={class:"form-group mb-3"},de=["placeholder"],ge=["textContent"];function he(e,t,r,i,n,c){const f=y("ConfirmModal");return a(),p(f,{state:r.deleteState,title:e.$t("manage-account.security-section.confirm-delete.heading"),"confirm-button-text":e.$t("global.modals.confirm-button"),"cancel-button-text":e.$t("global.modals.cancel-button"),"confirm-button-variant":"danger",onConfirm:c.deleteAccount,onCancel:t[1]||(t[1]=u=>r.deleteState.reset())},{default:h(()=>[o("div",{innerHTML:e.$t("manage-account.security-section.confirm-delete.text")},null,8,ue),o("div",me,[I(o("input",{ref:"deleteModalEmail","onUpdate:modelValue":t[0]||(t[0]=u=>n.email=u),type:"email",class:"form-control",placeholder:e.$t("manage-account.security-section.confirm-delete.email-placeholder")},null,8,de),[[P,n.email]]),o("span",{class:"small",textContent:s(r.userDetails.attributes.email)},null,8,ge)])]),_:1}
1,8,["state","title","confirm-button-text","cancel-button-text","onConfirm"])}const fe=Object.assign(x(ce,[["render",he],["__scopeId","data-v-1405777a"]]),{__name:"DeleteAccountModal"}),l=k(),pe={components:{FontAwesomeIcon:Q,BaseMessage:H,BaseButton:D},async setup(){let e=B(null);e.value=await l.$userRepository.get();const t=B(""),r=i=>t.value=i;return r(e.value.attributes.email),{userDetails:e,changeEmailInput:t,verified:!e.value.links.verifyEmail,handleChangeEmailInput:r}},data(){return{changePasswordButtonLoading:!1,deleteState:new E,changeEmailState:new E,resendVerificationEmailState:new E,error:null,success:null,faCheckCircle:J,faTimesCircle:G}},mounted(){l.$bus.$on("update_user_details",e=>{this.userDetails=e})},methods:{changeEmail(){this.error=null,this.success=null,this.verified?l.$manageAccountRepository.sendEmailChangeLink().then(()=>{this.success={title:l.$i18n.t("manage-account.email-section.send-email-success-toast")}}).catch(e=>{this.error={title:l.$i18n.t("manage-account.email-section.send-email-error-toast")},console.log("error",e)}):this.changeEmailState.show()},sendChangePasswordEmail(){this.error=null,this.success=null,this.changePasswordButtonLoading=!0,l.$manageAccountRepository.sendChangePasswordEmail().then(()=>{this.success={title:l.$i18n.t("manage-account.security-section.change-password-email-success-toast")}}).catch(e=>{let{error:t}=e.response.data;console.log("Error: ",e),this.error={title:l.$i18n.t("manage-account.security-section.change-password-email-error-toast"),text:t}}).finally(()=>{this.changePasswordButtonLoading=!1,this.scrollToErrorSuccessMessage()})},confirmChangeEmail(){this.error=null,this.success=null,this.changeEmailState.loading=!0,l.$manageAccountRepository.saveNewEmail(this.changeEmailInput).then(()=>T()).catch(e=>{let{errors:t}=e._data;t&&t.findIndex(r=>r.code==="invalid_email")!==-1?t[0].suggestion?this.error={title:this.$t("sign-up.form.email_not_valid_error"),suggestion:t[0].suggestion}:this.error={title:this.$t("sign-up.form.email_not_valid_error")}:t&&t.findIndex(r=>r.description)!==-1?this.error={title:l.$i18n.t("manage-account.email-section.change-email-error-toast"),text:t[0].description}:this.error={title:l.$i18n.t("manage-account.email-section.change-email-error-toast")}}).finally(()=>{this.changeEmailState.reset(),this.scrollToErrorSuccessMessage()})},resendEmail(){this.error=null,this.success=null,this.resendVerificationEmailState.loading=!0,l.$manageAccountRepository.resendEmailVerificationEmail(this.userDetails.links.verifyEmail).then(()=>{this.success={title:l.$i18n.t("manage-account.email-section.resend-email-success-toast")}}).catch(e=>{this.error={title:l.$i18n.t("manage-account.email-section.resend-email-error-toast")},console.log("error",e)}).finally(()=>{this.scrollToErrorSuccessMessage(),this.resendVerificationEmailState.loading=!1})},scrollToErrorSuccessMessage(){setTimeout(()=>{let e=document.getElementById("baseMessage");e&&e.scrollIntoView({block:"start",behavior:"smooth"})},100)},handleDeleteAccountError(e){this.deleteState.error=e},handleDeleteAccountLoading(e){this.deleteState.loading=e}}},_e={class:"col-lg-8"},Ce=["textContent"],ve={class:"m-0"},ye=["textContent"],be={key:0},$e=["textContent"],Ee=["textContent"],xe=["textContent"],Se=["textContent"],we=["textContent"],ke={key:1,class:"d-flex align-items-center mb-4"},Ae=["textContent"],Be=["textContent"],De={class:"mb-0 message-unverified-email"},Me=["textContent"],Ie=["innerHTML"],Pe=["placeholder"],Te=["textContent"],Le=["textContent"],Ve=["textContent"],qe=["textContent"],Re=["textContent"];function Oe(e,t,r,i,n,c){const f=R,u=y("BaseMessage"),C=y("FontAwesomeIcon"),b=y("BaseButton"),L=le,V=fe,q=K;return a(),g("div",_e,[o("h1",{class:"mb-5",textContent:s(e.$t("manage-account.heading"))},null,8,Ce),d(f),n.error||n.success?(a(),p(u,{key:0,id:"baseMessage",class:"errorSuccessMessage",variant:n.error?"danger":"success",icon:!0},{default:h(()=>[o("p",ve,[o("strong",{textContent:s(n.error?n.error.title:n.success.title)},null,8,ye)]),n.error&&n.error.suggestion?(a(),g("p",be,[o("span",{textContent:s(e.$t("sign-up.form.email_suggestion_error"))},null,8,$e),o("span",{class:"btn-link text-underline ps-1",role:"button",onClick:t[0]||(t[0]=m=>i.handleChangeEmailInput(n.error.suggestion)),textContent:s(n.error.suggestion)},null,8,Ee),t[6]||(t[6]=o("span",{textContent:"?"},null,-1))])):_("",!0),o("p",{class:"m-0 small",textContent:s(n.error&&n.error.text?n.error.text:n.success&&n.success.text?n.success.text:"")},null,8,xe)]),_:1},8,["variant"])):_("",!0),o("h2",{class:"mb-5",textContent:s(e.$t("manage-account.email-section.heading"))},null,8,Se),o("h3",{class:"mb-0",textContent:s(e.$t("manage-account.email-section.email-title"))},null,8,we),i.userDetails?(a(),g("div",ke,[o("p",{class:"m-0 me-2",textContent:s(i.userDetails.attributes.email)},null,8,Ae),d(C,{icon:i.verified?n.faCheckCircle:n.faTimesCircle,class:Y(["me-2",i.verified?"text-success":"text-danger"])},null,8,["icon","class"]),o("span",{class:"text-muted verify-label",textContent:s(e.$t(`manage-account.email-section.label-${i.verified?"verified":"unverified"}`))},null,8,Be)])):_("",!0),i.userDetails&&!i.verified?(a(),p(u,{key:2,variant:"yellow",icon:!1},{default:h(()=>[o("p",De,[v(s(e.$t("manage-account.email-section.message-unverified-email",{email:i.userDetails.attributes.email}))+" ",1),d(b,{variant:"link",class:"p-0",loading:n.resendVerificationEmailState.loading,onClick:w(c.resendEmail,["prevent"])},{default:h(()=>[v(s(e.$t("manage-account.email-section.resend-email-button")),1
1)]),_:1},8,["loading","onClick"])])]),_:1})):_("",!0),o("form",{onSubmit:t[2]||(t[2]=w((...m)=>c.changeEmail&&c.changeEmail(...m),["prevent"]))},[o("h3",{class:"mt-5 mb-0",textContent:s(e.$t("manage-account.email-section.change-email-title"))},null,8,Me),i.verified?(a(),g("p",{key:0,class:"mb-4",innerHTML:e.$t("manage-account.email-section.email-action-explanation")},null,8,Ie)):_("",!0),i.verified?_("",!0):I((a(),g("input",{key:1,"onUpdate:modelValue":t[1]||(t[1]=m=>i.changeEmailInput=m),type:"email",class:"form-control my-4",required:"required",placeholder:e.$t("sign-up.form.email.placeholder")},null,8,Pe)),[[P,i.changeEmailInput]]),d(b,{type:"submit",loading:n.changeEmailState.shown},{default:h(()=>[v(s(e.$t(`manage-account.email-section.${i.verified?"email-change-button":"save-changed-email-button"}`)),1)]),_:1},8,["loading"])],32),t[8]||(t[8]=o("hr",{class:"my-5"},null,-1)),o("h2",{class:"mb-5",textContent:s(e.$t("manage-account.security-section.heading"))},null,8,Te),o("h3",{class:"mb-0",textContent:s(e.$t("manage-account.security-section.change-password-title"))},null,8,Le),o("p",{class:"mb-4",textContent:s(e.$t("manage-account.security-section.password-action-explanation"))},null,8,Ve),d(b,{loading:n.changePasswordButtonLoading,class:"mb-4",onClick:c.sendChangePasswordEmail},{default:h(()=>[v(s(e.$t("manage-account.security-section.password-change-button")),1)]),_:1},8,["loading","onClick"]),i.userDetails?.type?.includes("student")?(a(),g(M,{key:3},[o("h3",{class:"mb-0 mt-3",textContent:s(e.$t("manage-account.security-section.delete-account-title"))},null,8,qe),o("p",{class:"mb-4",textContent:s(e.$t("manage-account.security-section.delete-account-action-explanation"))},null,8,Re),d(b,{loading:n.deleteState.shown,onClick:t[3]||(t[3]=m=>n.deleteState.show())},{default:h(()=>[v(s(e.$t("manage-account.security-section.delete-account-button")),1)]),_:1},8,["loading"]),t[7]||(t[7]=o("hr",{class:"my-5"},null,-1)),d(L,{"user-authentication-providers":i.userDetails.attributes.authenticationProviders||[]},null,8,["user-authentication-providers"])],64)):_("",!0),d(V,{"delete-state":n.deleteState,"user-details":i.userDetails,onError:t[4]||(t[4]=m=>c.handleDeleteAccountError(m)),onLoading:t[5]||(t[5]=m=>c.handleDeleteAccountLoading(m))},null,8,["delete-state","user-details"]),d(q,{message:e.$t("manage-account.security-section.confirm-change-email-modal",{newEmail:i.changeEmailInput}),"modal-state":n.changeEmailState,"confirm-action":c.confirmChangeEmail},null,8,["message","modal-state","confirm-action"])])}const Ye=x(pe,[["render",Oe]]);export{Ye 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.