import{r}from'./chunk-DZVj2nmI.js';import{g,D as w,P as Pc,$ as $t,a as rc,b2 as mt,aO as Vr,bR as ye,b9 as m,bF as Uu,b as Pa,J as Jn,V as Zn,q as qn,a0 as $n,Q as Qn,a1 as Vn,a2 as yn,cu as He,cf as C0,s as sp,v as vV,d as lb,e as Fp,f as Pp,m as zH,W as WB,a3 as H0,y as qH}from'./main-DEZ5cZzu.js';var F={VALIDATORS:[ye.required],MESSAGES:{required:"Potwierdzenie has\u0142a jest wymagane."}};var X=(()=>{class s extends r{formReactiveService=g(w);userService=g(Pc);serverService=g($t);notifier=g(rc);router=g(mt);route=g(Vr);userId;verificationString;ngOnInit(){let{minLength:e,maxLength:r}=this.serverService.getHTMLConfig().fieldsConstraints.users.password;this.buildForm({password:m(e,r),"password-confirm":F}),this.userId=this.route.snapshot.queryParams.userId,this.verificationString=this.route.snapshot.queryParams.verificationString,(!this.userId||!this.verificationString)&&(this.notifier.error("Nie mo\u017Cna znale\u017A\u0107 ID u\u017Cytkownika lub kodu weryfikuj\u0105cego."),this.router.navigate(["/"]));}resetPassword(){this.userService.resetPassword(this.userId,this.verificationString,this.form.value.password).subscribe({next:()=>{this.notifier.success("Pomy\u015Blnie zresetowano has\u0142o!"),this.router.navigate(["/login"]);},error:e=>this.notifier.handleError(e)});}isConfirmedPasswordValid(){let e=this.form.value;return e.password===e["password-confirm"];}static ɵfac=(()=>{let e;return function(o){return(e||(e=Uu(s)))(o||s);};})();static ɵcmp=Pa({type:s,selectors:[["ng-component"]],features:[C0],decls:13,vars:4,consts:()=>{let e;e="Has\u0142o";let r;r="Potwierdzone has\u0142o";let o;o="Resetuj moje has\u0142o";let l;l="Resetuj moje has\u0142o";let R;R="Has\u0142o";let f;return f="Potwierd\u017A has\u0142o",[l,R,f,[1,"margin-content"],[1,"title-page"],[3,"ngSubmit","formGroup"],[1,"form-group"],["for","password"],["formControlName","password","inputId","password","placeholder",e,"autocomplete","new-password",3,"formError"],["for","password-confirm"],["formControlName","password-confirm","inputId","password-confirm","placeholder",r,"autocomplete","new-password",3,"formError"],["type","submit","value",o,1,"peertube-button","primary-button",3,"disabled"]];},template:function(r,o){r&1&&(sp(0,"div",3)(1,"h1",4),vV(2,0),lb(),sp(3,"form",5),Fp("ngSubmit",function(){return o.resetPassword();}),sp(4,"div",6)(5,"label",7),vV(6,1),lb(),Pp(7,"my-input-text",8),zH(),lb(),sp(8,"div",6)(9,"label",9),vV(10,2),lb(),Pp(11,"my-input-text",10),zH(),lb(),Pp(12,"input",11),lb()()),r&2&&(WB(3),H0("formGroup",o.form),WB(4),H0("formError",o.formErrors.password),qH(),WB(4),H0("formError",o.formErrors["password-confirm"]),qH(),WB(),H0("disabled",!o.form.valid||!o.isConfirmedPasswordValid()));},dependencies:[Jn,Zn,qn,$n,Qn,Vn,yn,He],styles:["my-input-text[_ngcontent-%COMP%]{max-width:340px;display:block}"],changeDetection:1});}return s;})();var te=[{path:"",component:X,data:{meta:{title:"Zresetuj has\u0142o"}}}];/**i18n:c8855ca17fb20171aa9dd43d012e42547cb1f0cfd9c21d4dc05679bbbdf5ccb8*/export{te as default};//# sourceMappingURL=chunk-C6PVFXmb.js.map