Repository navigation
Expand file tree
/
Copy pathPasswordCard-BJBW_x-f.js
More file actions
3 lines (3 loc) · 3.94 KB
/
Copy pathPasswordCard-BJBW_x-f.js
File metadata and controls
3 lines (3 loc) · 3.94 KB
1
2
3
//# allFunctionsCalledOnLoad
import{a as e,m as t}from"./langPack-Cx34d7Qs.js";import{A as n,S as r,f as i,j as a}from"./solid-Beq2bZCx.js";import{t as o}from"./cancelEvent-Bs2qkQ0q.js";import{h as s,l as c}from"./web-BIda0ujS.js";import{n as l}from"./mediaSizes-o11ePi1Z.js";import{t as u}from"./buttonTsx-BWzWDe7L.js";import{t as d}from"./replaceContent-CdLa6W1X.js";import{_ as f,v as p}from"./index-kWWFxlHg.js";import{n as m}from"./wrapEmojiText-C7I3UKLK.js";import{t as h}from"./htmlToSpan-Dp04zOq5.js";import{c as g,n as _}from"./wrapDuration-CJ9Od1Ap.js";import{t as v}from"./mediaHeader-BscsyAc7.js";import{t as y}from"./anchorCallback-B1hVp5wq.js";import{r as b}from"./toast-Bejp1X_Q.js";import{t as x}from"./focusWhenSettled-Carhc-JZ.js";import{n as S,t as C}from"./mountAuthFlow-t7xWk1bL.js";import{n as w,t as T}from"./whenDetached-Bdu5PAXH.js";import{t as E}from"./AuthCard-DWj1gsA4.js";var D=s(`<svg xmlns=http://www.w3.org/2000/svg class=preloader-circular viewBox="25 25 50 50"><circle class=preloader-path cx=50 cy=50 r=20 fill=none stroke-miterlimit=10>`);function O(s){let{managers:O,navigate:k,toIm:A,isLeaving:j}=S(),M,N=document.createElement(`div`),P=l.isMobile?100:130,F,I,L=!1,R=!1,z=()=>R||j(),[B,V]=r(!1),[H,U]=r(`Login.Next`),W=new p({label:`LoginPassword`,name:`password`}),G=W.input,K=e(`ForgotPassword`,[y(()=>{L||(L=!0,O.passwordManager.requestRecovery().then(e=>{k({name:`emailRecover`,payload:{email_pattern:e.email_pattern}})}).catch(async e=>{z()||(e.type===`PASSWORD_RECOVERY_NA`?(await w({titleLangKey:`Login.ResetPassword.Title`,descriptionLangKey:`Login.ResetPassword.NoEmailText`,button:{langKey:`Login.ResetPassword.ResetAccount`,isDanger:!0}}),await w({titleLangKey:`Login.ResetAccount.Title`,descriptionLangKey:`Login.ResetAccount.Text`,button:{langKey:`Login.ResetPassword.ResetAccount`,isDanger:!0}}),await O.appAccountManager.deleteAccount(`Forgot password`).then(()=>{k({name:`signIn`})}).catch(e=>{if(e.type===`2FA_RECENT_CONFIRM`)w({titleLangKey:`Login.ResetAccountFail.Title`,descriptionLangKey:`Login.ResetAccountFail.TextCancelled`,button:{langKey:`OK`}});else if(e.type.startsWith(`2FA_CONFIRM_WAIT_`)){let t=+e.type.replace(`2FA_CONFIRM_WAIT_`,``);w({titleLangKey:`Login.ResetAccountFail.Title`,descriptionLangKey:`Login.ResetAccountFail.TextWait`,descriptionArgs:[_(g(t))],button:{langKey:`OK`}})}else console.error(e),b({langPackKey:`Error.AnError`})})):b({langPackKey:`Error.AnError`}))}).finally(()=>{L=!1}))})]);K.classList.add(C.forgotLink);function q(){if(!z())return F||(F=window.setInterval(q,1e4)),O.passwordManager.getState().then(e=>{if(I=e,I.hint){let e=h(m(I.hint));t(e),d(W.label,e)}else W.setLabel()})}function J(e){if(e&&o(e),!G.value.length){G.classList.add(`error`);return}V(!0),G.disabled=!0,U(`PleaseWait`);let t=G.value;W.setValueSilently(``+Math.random()),W.setValueSilently(t),O.passwordManager.check(t,I).then(e=>{switch(e._){case`auth.authorization`:F&&(clearInterval(F),F=void 0),A();break;default:V(!1),G.disabled=!1,U(e._)}}).catch(e=>{z()||(V(!1),G.disabled=!1,W.input.classList.add(`error`),e.type,U(`PASSWORD_HASH_INVALID`),G.select(),q())})}G.addEventListener(`keypress`,function(e){if(this.classList.remove(`error`),U(`Login.Next`),e.key===`Enter`)return J()});let Y;return a(()=>{O.appStateManager.pushToState(`authState`,{_:`authStatePassword`}),M=new f(W,P),N.append(M.container),M.load(),q(),Y=x(G)}),n(()=>{R=!0,Y?.(),F&&(clearInterval(F),F=void 0);let e=M;M=void 0,T(N.closest(`.`+C.card),()=>e?.remove())}),i(E,{get class(){return C.pagePassword},get header(){return i(v,{get children(){return[i(v.Sticker,{element:N,size:P}),i(v.Title,{tag:`h1`,get children(){return e(`Login.Password.Title`)}}),i(v.Subtitle,{get children(){return e(`Login.Password.Subtitle`)}})]}})},get children(){return[c(()=>W.container),K,i(u,{class:`btn-primary btn-color-primary`,get disabled(){return B()},onClick:J,get children(){return[c(()=>e(H())),c(()=>c(()=>!!B())()&&D())]}})]}})}export{O as default};
//# sourceMappingURL=PasswordCard-BJBW_x-f.js.map