PageSourceSearch

https://code80.ai/assets/OidcCallbackView-BhKeB9id.js

js code80.ai collected 2026-10-05 14:21:23 UTC 14,714 bytes, 2 lines download raw bytes

1import{d as Ie,r,c as ie,w as Z,o as Ue,_ as ze,a4 as He,D as Ke,M as ye,A as n,k as we,B as l,u as s,z as _,C as D,N as R,a6 as xe,F as I,O as $,a1 as J,a5 as We,G as v}from"./vendor-vue-DmILWSqk.js";import"./AppHeader.vue_vue_type_style_index_0_scoped_e13b152f_lang-CxnbIJKA.js";import{u as je,a as Ge,z as Ae,A as Ce,V as Ye,Z as Ze,Y as $e,k as re,a4 as Fe,a0 as Je,F as Qe}from"./index-BUiVe6m5.js";import"./vendor-misc-G-tVwJov.js";import"./useTheme-ppzYR-Gp.js";import"./useClipboard-seVhsrj5.js";/* empty css                                                                       */import{A as Xe}from"./AuthLayout-jOHxvi3g.js";import{P as et}from"./PendingOAuthCreateAccountForm-DvODMzb8.js";import{c as Q,l as Se,o as Te}from"./oauthAffiliate-CrlUwkd1.js";import{u as tt}from"./vendor-i18n-CkjPFrjs.js";const at={class:"space-y-6"},ot={class:"text-center"},nt={class:"text-2xl font-bold text-gray-900 dark:text-white"},st={class:"mt-2 text-sm text-gray-500 dark:text-dark-400"},it={key:0,class:"space-y-4"},rt={key:0,class:"rounded-xl border border-gray-200 bg-gray-50 p-4 dark:border-dark-600 dark:bg-dark-800/60"},lt={class:"space-y-3"},ut={class:"space-y-1"},ct={class:"text-sm font-medium text-gray-900 dark:text-white"},dt={class:"text-xs text-gray-500 dark:text-dark-400"},vt={key:0,class:"flex items-start gap-3 rounded-lg border border-gray-200 bg-white p-3 text-sm dark:border-dark-600 dark:bg-dark-900/50"},ht={class:"space-y-1"},_t={class:"block font-medium text-gray-900 dark:text-white"},pt={class:"block text-gray-500 dark:text-dark-400"},gt={key:1,class:"flex items-start gap-3 rounded-lg border border-gray-200 bg-white p-3 text-sm dark:border-dark-600 dark:bg-dark-900/50"},ft=["src","alt"],mt={class:"space-y-1"},bt={class:"block font-medium text-gray-900 dark:text-white"},kt={class:"block break-all text-gray-500 dark:text-dark-400"},yt={class:"text-sm text-gray-700 dark:text-gray-300"},wt=["placeholder","disabled"],xt=["disabled"],At={class:"text-sm text-gray-700 dark:text-gray-300"},Ct=["disabled"],Ft={key:3,class:"rounded-xl border border-gray-200 bg-gray-50 p-4 dark:border-dark-600 dark:bg-dark-800/60"},St={class:"space-y-4"},Tt={class:"space-y-1"},Pt={class:"text-sm font-medium text-gray-900 dark:text-white"},Nt={class:"text-xs text-gray-500 dark:text-dark-400"},qt={class:"grid gap-3 sm:grid-cols-2"},Dt=["disabled"],Rt=["disabled"],Lt={class:"text-sm text-gray-700 dark:text-gray-300"},Bt={class:"text-sm text-gray-700 dark:text-gray-300"},Et={class:"space-y-3"},Ot=["placeholder","disabled"],Vt=["placeholder","disabled"],Mt=["disabled"],It=["disabled"],Ut={class:"text-sm text-gray-700 dark:text-gray-300"},zt={class:"space-y-3"},Ht=["disabled"],Kt=["disabled"],Wt=Ie({__name:"OidcCallbackView",setup(jt){const le=ze(),U=He(),{t:o}=tt(),L=je(),k=Ge(),h=r(!0),z=r(""),y=r(!1),S=r(""),i=r(!1),X=r(""),B=r("/dashboard"),p=r("OIDC"),ee=r(!1),E=r(""),P=r(""),H=r(!0),K=r(!0),w=r(!1),g=r("none"),x=r(""),f=r(""),T=r(""),te=r(""),m=r(""),N=r(!1),Pe=o("profile.authBindings.bindSuccess"),W=r(!1),j=r(""),q=r(""),O=r(""),ae=r(""),ue=ie(()=>g.value==="create_account"),ce=ie(()=>g.value==="choose_account_action"),de=ie(()=>g.value==="bind_login");Z(X,e=>{e&&k.showError(e)}),Z(m,e=>{e&&k.showError(e)}),Z(O,e=>{e&&k.showError(e)}),Z(z,e=>{e&&k.showError(e)});function A(e){L.setPendingAuthSession({token:"",token_field:"pending_oauth_token",provider:"oidc",redirect:V(e||B.value)})}function ve(){L.clearPendingAuthSession()}function Ne(){const e=typeof window<"u"?window.location.hash:"",t=e.startsWith("#")?e.slice(1):e;return new URLSearchParams(t)}function qe(e){var F,d,b,ke;const t=((F=e.get("access_token"))==null?void 0:F.trim())||"";if(!t)return null;const a={access_token:t},u=((d=e.get("refresh_token"))==null?void 0:d.trim())||"";u&&(a.refresh_token=u);const c=Number.parseInt(((b=e.get("expires_in"))==null?void 0:b.trim())||"",10);Number.isFinite(c)&&c>0&&(a.expires_in=c);const C=((ke=e.get("token_type"))==null?void 0:ke.trim())||"";return C&&(a.token_type=C),a}function V(e){return!e||!e.startsWith("/")||e.startsWith("//")||e.includes("://")||e.includes(`
2`)||e.includes("\r")?"/dashboard":e}async function De(){var e;try{const a=(e=(await Ye()).oidc_oauth_provider_name)==null?void 0:e.trim();a&&(p.value=a)}catch{}}function G(){return{adoptDisplayName:H.value,adoptAvatar:K.value}}function oe(e){const t={};return typeof e.adoptDisplayName=="boolean"&&(t.adopt_display_name=e.adoptDisplayName),typeof e.adoptAvatar=="boolean"&&(t.adopt_avatar=e.adoptAvatar),t}function he(e){ee.value=e.adoption_required===!0,E.value=e.suggested_display_name||"",P.value=e.suggested_avatar_url||"",E.value||(H.value=!1),P.value||(K.value=!1)}function Re(e){return!!(e.suggested_display_name||e.suggested_avatar_url)}function Le(e){return(e==null?void 0:e.trim().toLowerCase())||""}function Be(e){return(e.pending_email||e.existing_account_email||e.compat_email||e.resolved_email||e.email||e.suggested_email||"").trim()}function Ee(e){const t=Le(e.step||e.error||e.intent);
2return t==="choice"||t==="choose_account_action_required"||t==="choose_account_action"||t==="choose_account"||t==="choose"?"choose_account_action":t==="email_required"||t==="create_account_required"||t==="create_account"?"create_account":t==="bind_login_required"||t==="bind_login"||t==="existing_account_binding_required"||t==="existing_account_required"||t==="adopt_existing_user_by_email"?"bind_login":"none"}function _e(e){const t=Ee(e);g.value=t,m.value="",W.value=!1,j.value="",q.value="",O.value="",ae.value="";const a=Be(e);if(t==="choose_account_action"){x.value=a,f.value=a,T.value="",N.value=!1;return}if(t==="create_account"){x.value=a,N.value=!0;return}if(t==="bind_login"){f.value=a,T.value="",N.value=!1;return}N.value=!1}function pe(e){return e.requires_2fa!==!0||!e.temp_token?!1:(g.value="none",y.value=!1,w.value=!1,W.value=!0,j.value=e.temp_token,q.value="",O.value="",ae.value=e.user_email_masked||"",h.value=!1,!0)}function ne(e){g.value="bind_login",f.value=f.value.trim()||(e==null?void 0:e.trim())||x.value.trim(),T.value="",m.value="",N.value=!0}function ge(){g.value="create_account",x.value=x.value.trim()||f.value.trim(),m.value=""}function M(e,t){var u,c,C,F;const a=e;return((c=(u=a.response)==null?void 0:u.data)==null?void 0:c.detail)||((F=(C=a.response)==null?void 0:C.data)==null?void 0:F.message)||a.message||t}function Oe(e){var u;const t=(u=e.response)==null?void 0:u.data,a=[t==null?void 0:t.reason,t==null?void 0:t.error,t==null?void 0:t.code,t==null?void 0:t.step,t==null?void 0:t.intent].map(c=>c==null?void 0:c.trim().toLowerCase()).filter(c=>!!c);return a.includes("email_exists")||a.includes("bind_login_required")||a.includes("bind_login")||a.includes("adopt_existing_user_by_email")||a.includes("existing_account_required")||a.includes("existing_account_binding_required")}async function fe(e,t){if(Ze(e)==="bind"){const a=V(e.redirect||"/profile");ve(),Q(),k.showSuccess(Pe),await U.replace(a);return}if(!$e(e))throw new Error(o("auth.oidc.callbackMissingToken"));Ae(e),await L.setToken(e.access_token),Q(),k.showSuccess(o("auth.loginSuccess")),await U.replace(t)}async function Y(e){he(e);const t=V(e.redirect||B.value);if(e.error==="invitation_required"){g.value="none",y.value=!0,w.value=!1,h.value=!1,A(t);return}if(pe(e)){A(t);return}if(_e(e),g.value!=="none"){y.value=!1,w.value=!1,h.value=!1,A(t);return}if(e.auth_result==="pending_session"){y.value=!1,w.value=!1,h.value=!1,A(t);return}await fe(e,t)}async function me(){var e,t;if(X.value="",!!S.value.trim()){i.value=!0;try{const a=Se(),u=G(),c=te.value?(await re.post("/auth/oauth/oidc/complete-registration",{pending_oauth_token:te.value,invitation_code:S.value.trim(),...Te(a),...oe(u)})).data:a?await Fe(S.value.trim(),u,a):await Fe(S.value.trim(),u);await Y(c)}catch(a){const u=a;X.value=((t=(e=u.response)==null?void 0:e.data)==null?void 0:t.message)||u.message||o("auth.oidc.completeRegistrationFailed")}finally{i.value=!1}}}async function Ve(){i.value=!0;try{const e=await Ce(G());await Y(e)}catch(e){z.value=M(e,o("auth.loginFailed")),w.value=!1}finally{i.value=!1}}async function Me(e){if(m.value="",!(!e.email||!e.password)){i.value=!0;try{const{data:t}=await re.post("/auth/oauth/pending/create-account",{email:e.email,password:e.password,verify_code:e.verifyCode||void 0,...e.turnstileToken?{turnstile_token:e.turnstileToken}:{},...e.tencentCaptchaTicket?{tencent_captcha_ticket:e.tencentCaptchaTicket,tencent_captcha_randstr:e.tencentCaptchaRandstr}:{}
2,invitation_code:e.invitationCode||void 0,...Te(Se()),...oe(G())});await Y(t)}catch(t){if(Oe(t)){ne(e.email.trim());return}m.value=M(t,o("auth.loginFailed"))}finally{i.value=!1}}}async function se(){m.value="";const e=f.value.trim(),t=T.value;if(!(!e||!t)){i.value=!0;try{const{data:a}=await re.post("/auth/oauth/pending/bind-login",{email:e,password:t,...oe(G())});await Y(a)}catch(a){m.value=M(a,o("auth.loginFailed"))}finally{i.value=!1}}}async function be(){O.value="";const e=q.value.trim();if(!(!j.value||e.length!==6)){i.value=!0;try{const t=await Je({temp_token:j.value,totp_code:e});await L.setToken(t.access_token),Q(),k.showSuccess(o("auth.loginSuccess")),await U.replace(B.value)}catch(t){O.value=M(t,o("auth.loginFailed"))}finally{i.value=!1}}}return Ue(async()=>{var F;De();const e=Ne(),t=qe(e),a=((F=e.get("pending_oauth_token"))==null?void 0:F.trim())||"",u=e.get("error"),c=e.get("error_description")||e.get("error_message")||"",C=V(e.get("redirect")||le.query.redirect||"/dashboard");try{if(t){Ae(t),await L.setToken(t.access_token),Q(),k.showSuccess(o("auth.loginSuccess")),await U.replace(C);return}if(u==="invitation_required"&&a){te.value=a,B.value=C,y.value=!0,h.value=!1;return}if(u){z.value=c||u,h.value=!1;return}const d=await Ce(),b=V(d.redirect||le.query.redirect||"/dashboard");if(he(d),B.value=b,d.error==="invitation_required"){y.value=!0,h.value=!1,A(b);return}if(pe(d)){A(b);return}if(_e(d),g.value!=="none"){h.value=!1,A(b);return}if(ee.value&&Re(d)){w.value=!0,h.value=!1,A(b);return}await fe(d,b)}catch(d){ve(),z.value=M(d,o("auth.loginFailed")),h.value=!1}}),(e,t)=>(v(),Ke(s(Xe),null,{default:ye(()=>[n("div",at,[n("div",ot,[n("h2",nt,l(s(o)("auth.oidc.callbackTitle",{providerName:p.value})),1),n("p",st,l(h.value?s(o)("auth.oidc.callbackProcessing",{providerName:p.value}):s(o)("auth.oidc.callbackHint")),1)]),we(We,{name:"fade"},{default:ye(()=>[y.value||w.value||ce.value||ue.value||de.value||W.value?(v(),_("div",it,[ee.value&&(E.value||P.value)?(v(),_("div",rt,[n("div",lt,[n("div",ut,[n("p",ct,l(s(o)("auth.oauthFlow.profileDetailsTitle",{providerName:p.value})),1),n("p",dt,l(s(o)("auth.oauthFlow.profileDetailsDescription",{providerName:p.value})),1)]),E.value?(v(),_("label",vt,[R(n("input",{"onUpdate:modelValue":t[0]||(t[0]=a=>H.value=a),type:"checkbox",class:"mt-1 h-4 w-4"},null,512),[[xe,H.value]]),n("span",ht,[n("span",_t,l(s(o)("auth.oauthFlow.useDisplayName")),1),n("span",pt,l(E.value),1)])])):D("",!0),P.value?(v(),_("label",gt,[R(n("input",{"onUpdate:modelValue":t[1]||(t[1]=a=>K.value=a),type:"checkbox",class:"mt-1 h-4 w-4"},null,512),[[xe,K.value]]),n("img",{src:P.value,alt:s(o)("auth.oauthFlow.avatarAlt",{providerName:p.value}),class:"h-10 w-10 rounded-full border border-gray-200 object-cover dark:border-dark-600"},null,8,ft),n("span",mt,[n("span",bt,l(s(o)("auth.oauthFlow.useAvatar")),1),n("span",kt,l(P.value),1)])])):D("",!0)])])):D("",!0),y.value?(v(),_(I,{key:1},[n("p",yt,l(s(o)("auth.oidc.invitationRequired",{providerName:p.value})),1),n("div",null,[R(n("input",{"onUpdate:modelValue":t[2]||(t[2]=a=>S.value=a),type:"text",class:"input w-full",placeholder:s(o)("auth.invitationCodePlaceholder"),disabled:i.value,onKeyup:J(me,["enter"])},null,40,wt),[[$,S.value]])]),n("button",{class:"btn btn-primary w-full",disabled:i.value||!S.value.trim(),onClick:me},l(i.value?s(o)("auth.oidc.completing"):s(o)("auth.oidc.completeRegistration")),9,xt)],64)):w.value?(v(),_(I,{key:2},[n("p",At,l(s(o)("auth.oauthFlow.reviewProfileBeforeContinue",{providerName:p.value})),1),n("button",{class:"btn btn-primary w-full",disabled:i.value,onClick:Ve},l(i.value?s(o)("common.processing"):s(o)("auth.continue")),9,Ct)],64)):ce.value?(v(),_("div",Ft,[n("div",St,[n("div",Tt,[n("p",Pt,l(s(o)("auth.oauthFlow.chooseHowToContinue")),1),n("p",Nt,l(x.value?s(o)("auth.oauthFlow.suggestedEmail",{email:x.value}):s(o)("auth.oauthFlow.chooseAccountActionHint")),1)]),n("div",qt,[n("button",{class:"btn btn-secondary w-full",disabled:i.value,onClick:t[3]||(t[3]=a=>ne())},l(s(o)("auth.oauthFlow.bindExistingAccount")),9,Dt),n("button",{class:"btn btn-primary w-full",disabled:i.value,onClick:ge}
2,l(s(o)("auth.oauthFlow.createNewAccount")),9,Rt)])])])):ue.value?(v(),_(I,{key:4},[n("p",Lt,l(s(o)("auth.oauthFlow.createAccountHint")),1),we(et,{"test-id-prefix":"oidc","initial-email":x.value,"is-submitting":i.value,"error-message":m.value,onSubmit:Me,onSwitchToBind:ne},null,8,["initial-email","is-submitting","error-message"])],64)):de.value?(v(),_(I,{key:5},[n("p",Bt,l(s(o)("auth.oauthFlow.bindLoginHint",{providerName:p.value})),1),n("div",Et,[R(n("input",{"onUpdate:modelValue":t[4]||(t[4]=a=>f.value=a),"data-testid":"oidc-bind-login-email",type:"email",class:"input w-full",placeholder:s(o)("auth.emailPlaceholder"),disabled:i.value,onKeyup:J(se,["enter"])},null,40,Ot),[[$,f.value]]),R(n("input",{"onUpdate:modelValue":t[5]||(t[5]=a=>T.value=a),"data-testid":"oidc-bind-login-password",type:"password",class:"input w-full",placeholder:s(o)("auth.passwordPlaceholder"),disabled:i.value,onKeyup:J(se,["enter"])},null,40,Vt),[[$,T.value]]),n("button",{"data-testid":"oidc-bind-login-submit",class:"btn btn-primary w-full",disabled:i.value||!f.value.trim()||!T.value,onClick:se},l(i.value?s(o)("common.processing"):s(o)("auth.oauthFlow.logInAndBind")),9,Mt),N.value?(v(),_("button",{key:0,class:"btn btn-secondary w-full",disabled:i.value,onClick:ge},l(s(o)("auth.oauthFlow.useDifferentEmail")),9,It)):D("",!0)])],64)):W.value?(v(),_(I,{key:6},[n("p",Ut,l(s(o)("auth.oauthFlow.totpHint",{providerName:p.value,account:ae.value||s(o)("auth.oauthFlow.yourAccount")})),1),n("div",zt,[R(n("input",{"onUpdate:modelValue":t[6]||(t[6]=a=>q.value=a),"data-testid":"oidc-bind-login-totp",type:"text",inputmode:"numeric",maxlength:"6",class:"input w-full",placeholder:"123456",disabled:i.value,onKeyup:J(be,["enter"])},null,40,Ht),[[$,q.value]]),n("button",{"data-testid":"oidc-bind-login-totp-submit",class:"btn btn-primary w-full",disabled:i.value||q.value.trim().length!==6,onClick:be},l(i.value?s(o)("common.processing"):s(o)("auth.oauthFlow.verifyAndContinue")),9,Kt)])],64)):D("",!0)])):D("",!0)]),_:1})])]),_:1}))}}),na=Qe(Wt,[["__scopeId","data-v-5265e524"]]);export{na 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.