"use strict";(self.webpackChunksample_angular_app=self.webpackChunksample_angular_app||[]).push([[65],{1065:(Z,m,n)=>{n.r(m),n.d(m,{ForgotPasswordModule:()=>P});var u=n(6814),a=n(6223),d=n(9778),e=n(5879),g=n(5148),c=n(5219);function p(r,s){1&r&&(e.TgZ(0,"div"),e._uU(1," Email is required. "),e.qZA())}function f(r,s){1&r&&(e.TgZ(0,"div"),e._uU(1," Please enter a valid email address. "),e.qZA())}function v(r,s){if(1&r&&(e.TgZ(0,"div",14),e.YNc(1,p,2,0,"div",15),e.YNc(2,f,2,0,"div",15),e.qZA()),2&r){const i=e.oxw();let t,o;e.xp6(1),e.Q6J("ngIf",null==(t=i.forgotPasswordForm.get("email"))||null==t.errors?null:t.errors.required),e.xp6(1),e.Q6J("ngIf",null==(o=i.forgotPasswordForm.get("email"))||null==o.errors?null:o.errors.email)}}const h=function(){return["/login"]},w=[{path:"",component:(()=>{var r;class s{constructor(t,o,l,y){this.formBuilder=t,this.router=o,this.authService=l,this.messageService=y,this.message=null,this.error=null}ngOnInit(){this.forgotPasswordForm=this.formBuilder.group({email:["",[a.kI.required,a.kI.email]]})}onSubmit(){this.forgotPasswordForm.valid?this.authService.forgotPassword({email:this.forgotPasswordForm.value.email}).subscribe({next:o=>{"Success"===o.status&&(this.messageService.add({severity:"success",summary:"Email Sent",detail:o.message||"A password reset link has been sent to your email."}),this.router.navigate(["/login"]))},error:o=>{this.messageService.add(400===o.status?{severity:"error",summary:"Error",detail:o.error.message||"Please check your input and try again."}:500===o.status?{severity:"error",summary:"Server Error",detail:"An unexpected error occurred. Please try again later."}:{severity:"error",summary:"Request Failed",detail:"An error occurred while processing your request. Please try again."})}}):this.messageService.add({severity:"error",summary:"Invalid Input",detail:"Please enter a valid email address."})}}return(r=s).\u0275fac=function(t){return new(t||r)(e.Y36(a.qu),e.Y36(d.F0),e.Y36(g.e),e.Y36(c.ez))},r.\u0275cmp=e.Xpm({type:r,selectors:[["app-forgot-password"]],decls:20,vars:5,consts:[[1,"container-fluid","d-flex","justify-content-center","align-items-center","vh-100"],[1,"row","bg-white","rounded","shadow",2,"width","65%","max-width","400px"],[1,"col-md-12","col-12","p-5"],["src","../../../assets/images/DhiVisa_Logo.png","alt","",1,"login-img","mb-4","mx-auto","d-block"],[1,"mb-4"],[3,"formGroup","ngSubmit"],[1,"mb-3"],["for","email"],[1,"input-group"],["id","email","formControlName","email","type","email",1,"form-control","custom-input-box","mt-1"],["class","text-danger small mt-1",4,"ngIf"],["type","submit",1,"btn","btn-primary","w-100",3,"disabled"],[1,"text-center","mt-4"],[1,"link-primary",3,"routerLink"],[1,"text-danger","small","mt-1"],[4,"ngIf"]],template:function(t,o){if(1&t&&(e.TgZ(0,"div",0)(1,"div",1)(2,"div",2),e._UZ(3,"img",3),e.TgZ(4,"h3",4),e._uU(5,"Forgot Password"),e.qZA(),e.TgZ(6,"form",5),e.NdJ("ngSubmit",function(){return o.onSubmit()}),e.TgZ(7,"div",6)(8,"label",7),e._uU(9,"Email"),e.qZA(),e.TgZ(10,"div",8),e._UZ(11,"input",9),e.qZA(),e.YNc(12,v,3,2,"div",10),e.qZA(),e.TgZ(13,"button",11),e._uU(14," Send Reset Link "),e.qZA(),e.TgZ(15,"div",12)(16,"span"),e._uU(17,"Remembered your password? "),e.TgZ(18,"a",13),e._uU(19,"Login here"),e.qZA()()()()()()()),2&t){let l;e.xp6(6),e.Q6J("formGroup",o.forgotPasswordForm),e.xp6(6),e.Q6J("ngIf",(null==(l=o.forgotPasswordForm.get("email"))?null:l.invalid)&&(null==(l=o.forgotPasswordForm.get("email"))?null:l.touched)),e.xp6(1),e.Q6J("disabled",o.forgotPasswordForm.invalid),e.xp6(5),e.Q6J("routerLink",e.DdM(4,h))}},dependencies:[u.O5,a._Y,a.Fj,a.JJ,a.JL,a.sg,a.u,d.rH]}),s})()}];let F=(()=>{var r;class s{}return(r=s).\u0275fac=function(t){return new(t||r)},r.\u0275mod=e.oAB({type:r}),r.\u0275inj=e.cJS({imports:[d.Bz.forChild(w),d.Bz]}),s})(),P=(()=>{var r;class s{}return(r=s).\u0275fac=function(t){return new(t||r)},r.\u0275mod=e.oAB({type:r}),r.\u0275inj=e.cJS({imports:[u.ez,a.UX,F]}),s})()}}]);