import{a as G}from"./chunk-HLDKWU5C.js";import{b as L}from"./chunk-XMLLNCME.js";import{h as b}from"./chunk-RNXVWLJ2.js";import{b as h}from"./chunk-Q6JB2APP.js";import"./chunk-NXALGPN2.js";import{C as $,D,d as A,g as O,h as M,o as N,r as w,u as v}from"./chunk-3V3ZIFZ3.js";import{Aa as _,Cd as C,Ka as P,Oa as c,Sh as I,aa as i,eb as a,fb as S,gb as s,hb as d,li as W,pa as u,qh as y,vb as m,yd as g,zb as T}from"./chunk-AVPM423Z.js";import{i as p}from"./chunk-W5TMGCPH.js";var F={VALIDATORS:[A.required],MESSAGES:{required:"\u8BF7\u518D\u6B21\u8F93\u5165\u5BC6\u7801\u3002"}};var X=(()=>{let t=class t extends G{formReactiveService=i(h);userService=i(W);serverService=i(I);notifier=i(y);router=i(C);route=i(g);userId;verificationString;ngOnInit(){let{minLength:e,maxLength:r}=this.serverService.getHTMLConfig().fieldsConstraints.users.password;this.buildForm({password:b(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("\u65E0\u6CD5\u627E\u5230\u7528\u6237 ID \u6216\u9A8C\u8BC1\u4EE3\u7801\u3002"),this.router.navigate(["/"]));}resetPassword(){this.userService.resetPassword(this.userId,this.verificationString,this.form.value.password).subscribe({next:()=>{this.notifier.success("\u5BC6\u7801\u91CD\u7F6E\u6210\u529F\uFF01"),this.router.navigate(["/login"]);},error:e=>this.notifier.handleError(e)});}isConfirmedPasswordValid(){let e=this.form.value;return e.password===e["password-confirm"];}};p(t,"\u0275fac",(()=>{let e;return function(o){return(e||(e=u(t)))(o||t);};})()),p(t,"\u0275cmp",P({type:t,selectors:[["ng-component"]],features:[c],decls:13,vars:4,consts:()=>{let e;e="\u5BC6\u7801";let r;r="\u5DF2\u786E\u8BA4\u5BC6\u7801";let o;o="\u91CD\u7F6E\u5BC6\u7801";let E;E="\u91CD\u7F6E\u5BC6\u7801";let R;R="\u5BC6\u7801";let f;return f="\u786E\u8BA4\u5BC6\u7801",[E,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&&(S(0,"div",3)(1,"h1",4),m(2,0),s(),S(3,"form",5),T("ngSubmit",function(){return o.resetPassword();}),S(4,"div",6)(5,"label",7),m(6,1),s(),d(7,"my-input-text",8),s(),S(8,"div",6)(9,"label",9),m(10,2),s(),d(11,"my-input-text",10),s(),d(12,"input",11),s()()),r&2&&(_(3),a("formGroup",o.form),_(4),a("formError",o.formErrors.password),_(4),a("formError",o.formErrors["password-confirm"]),_(),a("disabled",!o.form.valid||!o.isConfirmedPasswordValid()));},dependencies:[$,N,O,M,D,w,v,L],styles:[`my-input-text[_ngcontent-%COMP%]{max-width:340px;display:block}
/*# sourceMappingURL=reset-password.component-ZMNUSJ3U.css.map */`]}));let l=t;return l;})();var te=[{path:"",component:X,data:{meta:{title:"\u91CD\u7F6E\u5BC6\u7801"}}}];export{te as default};/**i18n:ceac57349051bcddcb40dd2878e0abcb86556d5ceb9d6109d22ac3f1ae3cc7b1*///# sourceMappingURL=chunk-575422ZN.js.map