n8n-editor-ui
Version:
Workflow Editor UI for n8n
2 lines • 3.19 kB
JavaScript
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{};e.SENTRY_RELEASE={id:`n8n@2.16.1`}}catch{}})();try{(function(){var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`8bc64c0f-3c9e-46eb-992c-cb05c5a5601e`,e._sentryDebugIdIdentifier=`sentry-dbid-8bc64c0f-3c9e-46eb-992c-cb05c5a5601e`)})()}catch{}import{$ as e,Ft as t,N as n,T as r,X as i,w as a}from"./vue.runtime.esm-bundler-C3C09Zii.js";import{at as o}from"./core-Bz5WjPxS.js";import{lt as s}from"./src-XqE2yCpG.js";import{Pn as c,t as l}from"./users.store-xP93bV7X.js";import{Qo as u}from"./constants-DuQbSl-q.js";import{t as d}from"./AuthView-Cz7XUKDy.js";var f=n({__name:`ChangePasswordView`,setup(n){let f=l(),p=o(),m=c(),h=s(),g=t(``),_=t(!1),v=t(null),y=e=>typeof e==`string`?e===g.value?!1:{messageKey:`auth.changePassword.passwordsMustMatchError`}:!1,b=()=>!h.currentRoute.value.query.token||typeof h.currentRoute.value.query.token!=`string`?null:h.currentRoute.value.query.token,x=()=>h.currentRoute.value.query.mfaEnabled?h.currentRoute.value.query.mfaEnabled===`true`:null,S=async e=>{try{_.value=!0;let t=b();if(t){let n={token:t,password:g.value,...e.mfaCode&&{mfaCode:e.mfaCode}};await f.changePassword(n),m.showMessage({type:`success`,title:p.baseText(`auth.changePassword.passwordUpdated`),message:p.baseText(`auth.changePassword.passwordUpdatedMessage`)}),await h.push({name:u.SIGNIN})}else m.showError(Error(p.baseText(`auth.validation.missingParameters`)),p.baseText(`auth.changePassword.error`))}catch(e){m.showError(e,p.baseText(`auth.changePassword.error`))}_.value=!1},C=e=>{e.name===`password`&&typeof e.value==`string`&&(g.value=e.value)};return i(async()=>{let e={title:p.baseText(`auth.changePassword`),buttonText:p.baseText(`auth.changePassword`),redirectText:p.baseText(`auth.signin`),redirectLink:`/signin`,inputs:[{name:`password`,properties:{label:p.baseText(`auth.newPassword`),type:`password`,required:!0,validationRules:[{name:`DEFAULT_PASSWORD_RULES`}],infoText:p.baseText(`auth.defaultPasswordRequirements`),autocomplete:`new-password`,capitalize:!0}},{name:`password2`,properties:{label:p.baseText(`auth.changePassword.reenterNewPassword`),type:`password`,required:!0,validators:{TWO_PASSWORDS_MATCH:{validate:y}},validationRules:[{name:`TWO_PASSWORDS_MATCH`}],autocomplete:`new-password`,capitalize:!0}}]},t=b();x()&&e.inputs.push({name:`mfaCode`,initialValue:``,properties:{required:!0,label:p.baseText(`mfa.code.input.label`),placeholder:p.baseText(`mfa.code.input.placeholder`),maxlength:6,capitalize:!0,validateOnBlur:!0}}),v.value=e;try{if(!t)throw Error(p.baseText(`auth.changePassword.missingTokenError`));await f.validatePasswordToken({token:t})}catch(e){m.showError(e,p.baseText(`auth.changePassword.tokenValidationError`)),h.replace({name:u.SIGNIN})}}),(t,n)=>v.value?(e(),a(d,{key:0,form:v.value,"form-loading":_.value,onSubmit:S,onUpdate:C},null,8,[`form`,`form-loading`])):r(``,!0)}});export{f as default};
//# sourceMappingURL=ChangePasswordView-Dh3R39yB.js.map