import{Eo as kb,Fa as eo,Fo as l$,Gr as Va,Is as rh,Lr as Uj,Oi as Zt,Oo as kj,Wa as g,Za as gx,ec as th,er as Qc,it as FB,mo as iu,nc as tx,nt as Et,ta as bi,vc as wp}from"./chunk-B_pj7Jpm.js";import"./chunk-CgIzqGPc.js";import{A as qn,F as ye,I as yn,_ as Zn,p as Vn,s as Jn,t as $n,u as Qn}from"./chunk-BPHMC4rz.js";import{t as S}from"./chunk-BmH4cOwr.js";import{r as E}from"./chunk-Ly3dbMT12.js";import{t as oe}from"./chunk-r0Xv-ufY2.js";import{t as r}from"./chunk-BWkkRYL92.js";var X={VALIDATORS:[ye.required],MESSAGES:{required:"Bekreftelse av passordet er nødvendig."}};var se=[{path:``,component:class l extends r{formReactiveService=g(S);userService=g(Qc);serverService=g(Zt);notifier=g(bi);router=g(Et);route=g(eo);userId;verificationString;ngOnInit(){let{minLength:e,maxLength:r}=this.serverService.getHTMLConfig().fieldsConstraints.users.password;this.buildForm({password:E(e,r),"password-confirm":X}),this.userId=this.route.snapshot.queryParams.userId,this.verificationString=this.route.snapshot.queryParams.verificationString,(!this.userId||!this.verificationString)&&(this.notifier.error("Kunne ikke finne bruker-ID eller bekreftelsesstreng."),this.router.navigate([`/`]))}resetPassword(){this.userService.resetPassword(this.userId,this.verificationString,this.form.value.password).subscribe({next:()=>{this.notifier.success("Passordet ditt har blitt tilbakestilt!"),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=iu(l)))(o||l)}})();static ɵcmp=Va({type:l,selectors:[[`ng-component`]],features:[tx],decls:13,vars:4,consts:()=>{let e;e="Passord";let r;r="Bekreftet passord";let o;o="Tilbakestill passordet mitt";let p;p="Tilbakestill passordet mitt";let f;f="Passord";let u;return u="Bekreft passord",[p,f,u,[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&&(wp(0,`div`,3)(1,`h1`,4),l$(2,0),kb(),wp(3,`form`,5),rh(`ngSubmit`,function(){return o.resetPassword()}),wp(4,`div`,6)(5,`label`,7),l$(6,1),kb(),th(7,`my-input-text`,8),kj(),kb(),wp(8,`div`,6)(9,`label`,9),l$(10,2),kb(),th(11,`my-input-text`,10),kj(),kb(),th(12,`input`,11),kb()()),r&2&&(FB(3),gx(`formGroup`,o.form),FB(4),gx(`formError`,o.formErrors.password),Uj(),FB(4),gx(`formError`,o.formErrors[`password-confirm`]),Uj(),FB(),gx(`disabled`,!o.form.valid||!o.isConfirmedPasswordValid()))},dependencies:[Jn,Zn,qn,$n,Qn,Vn,yn,oe],styles:[`my-input-text[_ngcontent-%COMP%]{max-width:340px;display:block}`],changeDetection:1})},data:{meta:{title:"Tilbakestill passord"}}}];export{se as default};
//# debugId=e69f88b1-6c16-598b-9263-2ab9cb8664df
//# sourceMappingURL=chunk-CXv8hP5l2.js.map