"use strict";(self.webpackChunkdotcms_ui=self.webpackChunkdotcms_ui||[]).push([[4488],{84488:(f,c,t)=>{t.r(c),t.d(c,{ResetPasswordModule:()=>T});var n=t(36895),m=t(87904),o=t(24006),p=t(72986),d=t(22868),h=t(2094),v=t(95190),w=t(42816),s=t(86353),u=t(51740),g=t(35593),M=t(94632),P=t(43740);function C(a,i){if(1&a){const e=s.EpF();s.TgZ(0,"div",1)(1,"h3",2),s._uU(2),s.qZA(),s._UZ(3,"p",3),s.TgZ(4,"form",4)(5,"div",5)(6,"label",6),s._uU(7),s.qZA(),s._UZ(8,"input",7)(9,"dot-field-validation-message",8),s.qZA(),s.TgZ(10,"div",5)(11,"label",9),s._uU(12),s.qZA(),s.TgZ(13,"input",10),s.NdJ("keypress",function(){s.CHM(e);const l=s.oxw();return s.KtG(l.cleanMessage())}),s.qZA(),s._UZ(14,"dot-field-validation-message",8),s.qZA(),s.TgZ(15,"div",11)(16,"button",12),s.NdJ("click",function(){s.CHM(e);const l=s.oxw();return s.KtG(l.submit())}),s.qZA()()()()}if(2&a){const e=i.ngIf,r=s.oxw();s.xp6(2),s.Oqu(e.i18nMessagesMap["reset-password"]),s.xp6(1),s.Q6J("innerHTML",r.message,s.oJD),s.xp6(1),s.Q6J("formGroup",r.resetPasswordForm),s.xp6(3),s.Oqu(e.i18nMessagesMap["enter-password"]),s.xp6(2),s.Q6J("field",r.resetPasswordForm.get("password"))("message",e.i18nMessagesMap["error.form.mandatory"].replace("{0}",e.i18nMessagesMap["enter-password"])),s.xp6(3),s.Oqu(e.i18nMessagesMap["re-enter-password"]),s.xp6(2),s.Q6J("field",r.resetPasswordForm.get("confirmPassword"))("message",e.i18nMessagesMap["error.form.mandatory"].replace("{0}",e.i18nMessagesMap["re-enter-password"])),s.xp6(2),s.Q6J("disabled",!r.resetPasswordForm.valid)("label",e.i18nMessagesMap["change-password"])}}let x=(()=>{class a{constructor(e,r,l,Z,F,J){this.fb=e,this.loginService=r,this.dotLoginPageStateService=l,this.dotRouterService=Z,this.route=F,this.cd=J,this.message="",this.passwordDontMatchMessage=""}ngAfterViewChecked(){this.cd.detectChanges()}ngOnInit(){this.loginInfo$=this.dotLoginPageStateService.get().pipe((0,p.q)(1),(0,d.b)(e=>{this.passwordDontMatchMessage=e.i18nMessagesMap["reset-password-confirmation-do-not-match"]})),this.resetPasswordForm=this.fb.group({password:["",[o.kI.required]],confirmPassword:["",[o.kI.required]]})}cleanConfirmPassword(){this.cleanMessage(),this.resetPasswordForm.get("confirmPassword").setValue("")}cleanMessage(){this.message=""}submit(){this.resetPasswordForm.valid&&this.resetPasswordForm.get("password").value===this.resetPasswordForm.get("confirmPassword").value?(this.cleanMessage(),this.loginService.changePassword(this.resetPasswordForm.get("password").value,this.route.snapshot.paramMap.get("token")).pipe((0,p.q)(1)).subscribe(()=>{this.dotRouterService.goToLogin({queryParams:{changedPassword:!0}})},e=>{this.message=e.error?.errors[0]?.message})):this.message=this.passwordDontMatchMessage}}return a.\u0275fac=function(e){return new(e||a)(s.Y36(o.QS),s.Y36(v.r6),s.Y36(h.O),s.Y36(w.W),s.Y36(m.gz),s.Y36(s.sBO))},a.\u0275cmp=s.Xpm({type:a,selectors:[["dot-reset-password-component"]],features:[s._Bn([])],decls:2,vars:3,consts:[["class","reset-password__container",4,"ngIf"],[1,"reset-password__container"],["data-testId","header"],["data-testid","errorMessage",1,"error-message","p-invalid",3,"innerHTML"],[1,"p-fluid",3,"formGroup"],[1,"field","form__group--validation"],["data-testId","enterLabel"],["autocomplete","new-password","dotAutofocus","","formControlName","password","pInputText","","type","password"],[3,"field","message"],["data-testId","confirmLabel"],["autocomplete","new-password","formControlName","confirmPassword","pInputText","","type","password",3,"keypress"],[1,"field"],["data-testId","submitButton","pButton","","type","submit",3,"disabled","label","click"]],template:function(e,r){1&e&&(s.YNc(0,C,17,11,"div",0),s.ALo(1,"async")),2&e&&s.Q6J("ngIf",s.lcZ(1,1,r.loginInfo$))},dependencies:[n.O5,o._Y,o.Fj,o.JJ,o.JL,u.o,g.Hq,o.sg,o.u,M.g,P.h,n.Ov],styles:["[_nghost-%COMP%]{max-width:360px;width:80%}h3[_ngcontent-%COMP%]{margin:0}"]}),a})();var y=t(44189),I=t(95978);const A=[{component:x,path:""}];let T=(()=>{class a{}return a.\u0275fac=function(e){return new(e||a)},a.\u0275mod=s.oAB({type:a}),a.\u0275inj=s.cJS({imports:[n.ez,o.u5,u.j,g.hJ,o.UX,y.v,I.x,m.Bz.forChild(A)]}),a})()},43740:(f,c,t)=>{t.d(c,{h:()=>m});var n=t(86353);let m=(()=>{class o{constructor(d){this.el=d}ngOnInit(){this.el.nativeElement.disabled||setTimeout(()=>{this.el.nativeElement.focus()},100)}}return o.\u0275fac=function(d){return new(d||o)(n.Y36(n.SBq))},o.\u0275dir=n.lG2({type:o,selectors:[["","dotAutofocus",""]]}),o})()}}]);