@flusys/ng-auth 9.1.0-rc.1 → 9.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/fesm2022/flusys-ng-auth-administration-page.component-DmN4KqiR.mjs +146 -0
- package/fesm2022/flusys-ng-auth-administration-page.component-DmN4KqiR.mjs.map +1 -0
- package/fesm2022/flusys-ng-auth-branch-form.component-Df_sMC2G.mjs +743 -0
- package/fesm2022/flusys-ng-auth-branch-form.component-Df_sMC2G.mjs.map +1 -0
- package/fesm2022/flusys-ng-auth-branch-list.component-CWat6QWN.mjs +775 -0
- package/fesm2022/flusys-ng-auth-branch-list.component-CWat6QWN.mjs.map +1 -0
- package/fesm2022/flusys-ng-auth-company-form.component-BvZ4Pn8j.mjs +198 -0
- package/fesm2022/flusys-ng-auth-company-form.component-BvZ4Pn8j.mjs.map +1 -0
- package/fesm2022/flusys-ng-auth-company-list.component-Corh9AIh.mjs +241 -0
- package/fesm2022/flusys-ng-auth-company-list.component-Corh9AIh.mjs.map +1 -0
- package/fesm2022/flusys-ng-auth-extension-order.util-2XWSLqii.mjs +6 -0
- package/fesm2022/flusys-ng-auth-extension-order.util-2XWSLqii.mjs.map +1 -0
- package/fesm2022/flusys-ng-auth-forgot-password-page.component-BRTVZPX6.mjs +384 -0
- package/fesm2022/flusys-ng-auth-forgot-password-page.component-BRTVZPX6.mjs.map +1 -0
- package/fesm2022/flusys-ng-auth-login-page.component-DQl52Qau.mjs +1074 -0
- package/fesm2022/flusys-ng-auth-login-page.component-DQl52Qau.mjs.map +1 -0
- package/fesm2022/flusys-ng-auth-profile-page.component-b-8rPEXQ.mjs +1792 -0
- package/fesm2022/flusys-ng-auth-profile-page.component-b-8rPEXQ.mjs.map +1 -0
- package/fesm2022/flusys-ng-auth-register-page.component-D99y1jiA.mjs +1513 -0
- package/fesm2022/flusys-ng-auth-register-page.component-D99y1jiA.mjs.map +1 -0
- package/fesm2022/flusys-ng-auth-reset-password-page.component-C0tN_AW1.mjs +538 -0
- package/fesm2022/flusys-ng-auth-reset-password-page.component-C0tN_AW1.mjs.map +1 -0
- package/fesm2022/flusys-ng-auth-social-callback-page.component-gTD7_LJY.mjs +217 -0
- package/fesm2022/flusys-ng-auth-social-callback-page.component-gTD7_LJY.mjs.map +1 -0
- package/fesm2022/flusys-ng-auth-social-config-page.component-DpGmcb9n.mjs +541 -0
- package/fesm2022/flusys-ng-auth-social-config-page.component-DpGmcb9n.mjs.map +1 -0
- package/fesm2022/flusys-ng-auth-user-form.component-CM9UYc0q.mjs +1171 -0
- package/fesm2022/flusys-ng-auth-user-form.component-CM9UYc0q.mjs.map +1 -0
- package/fesm2022/flusys-ng-auth-user-list.component-Bew7gz-H.mjs +1046 -0
- package/fesm2022/flusys-ng-auth-user-list.component-Bew7gz-H.mjs.map +1 -0
- package/fesm2022/flusys-ng-auth-verify-email-page.component-DB9iKvt3.mjs +545 -0
- package/fesm2022/flusys-ng-auth-verify-email-page.component-DB9iKvt3.mjs.map +1 -0
- package/fesm2022/flusys-ng-auth.mjs +3030 -10735
- package/fesm2022/flusys-ng-auth.mjs.map +1 -1
- package/package.json +5 -5
- package/types/flusys-ng-auth.d.ts +978 -1558
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
import { AuthApiService } from "./flusys-ng-auth.mjs";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { Component, DestroyRef, computed, inject, signal } from "@angular/core";
|
|
4
|
+
import { finalize, tap } from "rxjs";
|
|
5
|
+
import { RouterLink } from "@angular/router";
|
|
6
|
+
import { TranslatePipe, TranslateService } from "@flusys/ng-shared";
|
|
7
|
+
import { FButtonDirective, InputTextDirective, MessageService, UiIconComponent } from "@flusys/ng-ui";
|
|
8
|
+
import { AppFloatingConfigurator } from "@flusys/ng-layout";
|
|
9
|
+
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
|
10
|
+
import { FormField, email, form, required } from "@angular/forms/signals";
|
|
11
|
+
var ForgotPasswordPageComponent = class ForgotPasswordPageComponent {
|
|
12
|
+
destroyRef = inject(DestroyRef);
|
|
13
|
+
messageService = inject(MessageService);
|
|
14
|
+
authApi = inject(AuthApiService);
|
|
15
|
+
translateAdapter = inject(TranslateService, { optional: true });
|
|
16
|
+
translate(key, vars) {
|
|
17
|
+
return this.translateAdapter?.translate(key, vars) ?? key;
|
|
18
|
+
}
|
|
19
|
+
isLoading = signal(false, ...ngDevMode ? [{ debugName: "isLoading" }] : /* istanbul ignore next */ []);
|
|
20
|
+
emailSent = signal(false, ...ngDevMode ? [{ debugName: "emailSent" }] : /* istanbul ignore next */ []);
|
|
21
|
+
submittedEmail = signal("", ...ngDevMode ? [{ debugName: "submittedEmail" }] : /* istanbul ignore next */ []);
|
|
22
|
+
formModel = signal({ email: "" }, ...ngDevMode ? [{ debugName: "formModel" }] : /* istanbul ignore next */ []);
|
|
23
|
+
forgotForm = form(this.formModel, (f) => {
|
|
24
|
+
required(f.email, { message: this.translate("auth.validation.email.required") });
|
|
25
|
+
email(f.email, { message: this.translate("shared.invalid.email") });
|
|
26
|
+
});
|
|
27
|
+
isFormValid = computed(() => this.forgotForm().valid(), ...ngDevMode ? [{ debugName: "isFormValid" }] : /* istanbul ignore next */ []);
|
|
28
|
+
onSubmit(event) {
|
|
29
|
+
event.preventDefault();
|
|
30
|
+
if (!this.isFormValid()) {
|
|
31
|
+
this.messageService.add({
|
|
32
|
+
severity: "error",
|
|
33
|
+
summary: this.translate("shared.validation.error"),
|
|
34
|
+
detail: this.translate("shared.invalid.email")
|
|
35
|
+
});
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
this.isLoading.set(true);
|
|
39
|
+
const email = this.formModel().email;
|
|
40
|
+
this.authApi.forgotPassword(email).pipe(takeUntilDestroyed(this.destroyRef), tap({ next: () => this.showEmailSent(email) }), finalize(() => this.isLoading.set(false))).subscribe({ error: () => {} });
|
|
41
|
+
}
|
|
42
|
+
showEmailSent(email) {
|
|
43
|
+
this.submittedEmail.set(email);
|
|
44
|
+
this.emailSent.set(true);
|
|
45
|
+
}
|
|
46
|
+
resetForm() {
|
|
47
|
+
this.emailSent.set(false);
|
|
48
|
+
this.submittedEmail.set("");
|
|
49
|
+
this.formModel.set({ email: "" });
|
|
50
|
+
}
|
|
51
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
52
|
+
minVersion: "12.0.0",
|
|
53
|
+
version: "22.2.1",
|
|
54
|
+
ngImport: i0,
|
|
55
|
+
type: ForgotPasswordPageComponent,
|
|
56
|
+
deps: [],
|
|
57
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
58
|
+
});
|
|
59
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
60
|
+
minVersion: "17.0.0",
|
|
61
|
+
version: "22.2.1",
|
|
62
|
+
type: ForgotPasswordPageComponent,
|
|
63
|
+
isStandalone: true,
|
|
64
|
+
selector: "lib-forgot-password-page",
|
|
65
|
+
ngImport: i0,
|
|
66
|
+
template: `
|
|
67
|
+
<app-floating-configurator />
|
|
68
|
+
<div
|
|
69
|
+
class="bg-surface-ground flex items-center justify-center min-h-screen"
|
|
70
|
+
>
|
|
71
|
+
<div
|
|
72
|
+
class="flex flex-col items-center justify-center w-full max-w-[32rem] px-4"
|
|
73
|
+
>
|
|
74
|
+
<div
|
|
75
|
+
class="w-full"
|
|
76
|
+
style="border-radius: var(--f-content-border-radius); padding: 0.3rem; background: linear-gradient(180deg, var(--primary-color) 10%, rgba(33, 150, 243, 0) 30%)"
|
|
77
|
+
>
|
|
78
|
+
<div
|
|
79
|
+
class="w-full py-8 px-4 sm:py-12 sm:px-8 md:py-16 md:px-12"
|
|
80
|
+
style="border-radius: var(--f-content-border-radius); background: var(--f-content-background)"
|
|
81
|
+
>
|
|
82
|
+
@if (!emailSent()) {
|
|
83
|
+
<div class="text-center mb-8">
|
|
84
|
+
<div class="text-3xl font-medium mb-4 text-color">
|
|
85
|
+
{{ 'auth.forgot.password.title' | translate }}
|
|
86
|
+
</div>
|
|
87
|
+
<span class="text-muted-color font-medium">
|
|
88
|
+
{{ 'auth.forgot.password.subtitle' | translate }}
|
|
89
|
+
</span>
|
|
90
|
+
</div>
|
|
91
|
+
|
|
92
|
+
<form (submit)="onSubmit($event)">
|
|
93
|
+
<label
|
|
94
|
+
for="email"
|
|
95
|
+
class="block text-lg font-medium mb-2 text-color"
|
|
96
|
+
>
|
|
97
|
+
{{ 'auth.email.label' | translate }}
|
|
98
|
+
</label>
|
|
99
|
+
<input
|
|
100
|
+
fInputText
|
|
101
|
+
id="email"
|
|
102
|
+
type="email"
|
|
103
|
+
[placeholder]="'auth.email.placeholder' | translate"
|
|
104
|
+
class="w-full mb-6"
|
|
105
|
+
[formField]="forgotForm.email"
|
|
106
|
+
autocomplete="email"
|
|
107
|
+
/>
|
|
108
|
+
|
|
109
|
+
<button
|
|
110
|
+
fButton
|
|
111
|
+
class="w-full mb-4"
|
|
112
|
+
type="submit"
|
|
113
|
+
[disabled]="!isFormValid() || isLoading()"
|
|
114
|
+
>
|
|
115
|
+
@if (isLoading()) {
|
|
116
|
+
<ui-icon pButtonIcon name="spinner" [spin]="true"></ui-icon>
|
|
117
|
+
}
|
|
118
|
+
<span pButtonLabel>{{ 'auth.forgot.password.send.reset.link' | translate }}</span>
|
|
119
|
+
</button>
|
|
120
|
+
|
|
121
|
+
<div class="flex items-center justify-center gap-2">
|
|
122
|
+
<span class="font-medium">{{
|
|
123
|
+
'auth.forgot.password.remember.password' | translate
|
|
124
|
+
}}</span>
|
|
125
|
+
<a
|
|
126
|
+
routerLink="/auth/login"
|
|
127
|
+
class="font-semibold text-primary cursor-pointer"
|
|
128
|
+
>
|
|
129
|
+
{{ 'auth.login.sign.in' | translate }}
|
|
130
|
+
</a>
|
|
131
|
+
</div>
|
|
132
|
+
</form>
|
|
133
|
+
} @else {
|
|
134
|
+
<div class="text-center">
|
|
135
|
+
<div class="flex justify-center mb-6">
|
|
136
|
+
<ui-icon name="envelope" class="text-6xl text-primary"></ui-icon>
|
|
137
|
+
</div>
|
|
138
|
+
<div class="text-3xl font-medium mb-4 text-color">
|
|
139
|
+
{{ 'auth.forgot.password.check.email' | translate }}
|
|
140
|
+
</div>
|
|
141
|
+
<p class="text-muted-color font-medium mb-6">
|
|
142
|
+
{{
|
|
143
|
+
'auth.forgot.password.email.sent.to'
|
|
144
|
+
| translate: { email: submittedEmail() }
|
|
145
|
+
}}
|
|
146
|
+
</p>
|
|
147
|
+
<p class="text-sm text-muted-color mb-6">
|
|
148
|
+
{{ 'auth.forgot.password.didnt.receive' | translate }}
|
|
149
|
+
<span
|
|
150
|
+
class="text-primary cursor-pointer font-semibold"
|
|
151
|
+
(click)="resetForm()"
|
|
152
|
+
>
|
|
153
|
+
{{ 'auth.forgot.password.try.again' | translate }} </span
|
|
154
|
+
>.
|
|
155
|
+
</p>
|
|
156
|
+
<a
|
|
157
|
+
routerLink="/auth/login"
|
|
158
|
+
class="font-semibold text-primary cursor-pointer"
|
|
159
|
+
>
|
|
160
|
+
{{ 'auth.login.back.to.sign.in' | translate }}
|
|
161
|
+
</a>
|
|
162
|
+
</div>
|
|
163
|
+
}
|
|
164
|
+
</div>
|
|
165
|
+
</div>
|
|
166
|
+
</div>
|
|
167
|
+
</div>
|
|
168
|
+
`,
|
|
169
|
+
isInline: true,
|
|
170
|
+
dependencies: [
|
|
171
|
+
{
|
|
172
|
+
kind: "directive",
|
|
173
|
+
type: RouterLink,
|
|
174
|
+
selector: "[routerLink]",
|
|
175
|
+
inputs: [
|
|
176
|
+
"target",
|
|
177
|
+
"queryParams",
|
|
178
|
+
"fragment",
|
|
179
|
+
"queryParamsHandling",
|
|
180
|
+
"state",
|
|
181
|
+
"info",
|
|
182
|
+
"relativeTo",
|
|
183
|
+
"preserveFragment",
|
|
184
|
+
"skipLocationChange",
|
|
185
|
+
"replaceUrl",
|
|
186
|
+
"browserUrl",
|
|
187
|
+
"routerLink"
|
|
188
|
+
]
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
kind: "directive",
|
|
192
|
+
type: FButtonDirective,
|
|
193
|
+
selector: "[fButton]",
|
|
194
|
+
inputs: [
|
|
195
|
+
"severity",
|
|
196
|
+
"text",
|
|
197
|
+
"outlined",
|
|
198
|
+
"link",
|
|
199
|
+
"variant",
|
|
200
|
+
"rounded",
|
|
201
|
+
"raised",
|
|
202
|
+
"fluid",
|
|
203
|
+
"disabled",
|
|
204
|
+
"loading",
|
|
205
|
+
"loadingIcon",
|
|
206
|
+
"size",
|
|
207
|
+
"label",
|
|
208
|
+
"icon",
|
|
209
|
+
"iconPos",
|
|
210
|
+
"ariaLabel",
|
|
211
|
+
"plain"
|
|
212
|
+
]
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
kind: "directive",
|
|
216
|
+
type: InputTextDirective,
|
|
217
|
+
selector: "[fInputText]",
|
|
218
|
+
inputs: [
|
|
219
|
+
"invalid",
|
|
220
|
+
"touched",
|
|
221
|
+
"variant",
|
|
222
|
+
"size",
|
|
223
|
+
"fluid"
|
|
224
|
+
]
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
kind: "component",
|
|
228
|
+
type: UiIconComponent,
|
|
229
|
+
selector: "ui-icon",
|
|
230
|
+
inputs: [
|
|
231
|
+
"name",
|
|
232
|
+
"size",
|
|
233
|
+
"spin",
|
|
234
|
+
"fill",
|
|
235
|
+
"severity"
|
|
236
|
+
]
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
kind: "directive",
|
|
240
|
+
type: FormField,
|
|
241
|
+
selector: "[formField]",
|
|
242
|
+
inputs: ["formField"],
|
|
243
|
+
exportAs: ["formField"]
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
kind: "component",
|
|
247
|
+
type: AppFloatingConfigurator,
|
|
248
|
+
selector: "app-floating-configurator"
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
kind: "pipe",
|
|
252
|
+
type: TranslatePipe,
|
|
253
|
+
name: "translate"
|
|
254
|
+
}
|
|
255
|
+
]
|
|
256
|
+
});
|
|
257
|
+
};
|
|
258
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
259
|
+
minVersion: "12.0.0",
|
|
260
|
+
version: "22.2.1",
|
|
261
|
+
ngImport: i0,
|
|
262
|
+
type: ForgotPasswordPageComponent,
|
|
263
|
+
decorators: [{
|
|
264
|
+
type: Component,
|
|
265
|
+
args: [{
|
|
266
|
+
selector: "lib-forgot-password-page",
|
|
267
|
+
imports: [
|
|
268
|
+
RouterLink,
|
|
269
|
+
FButtonDirective,
|
|
270
|
+
InputTextDirective,
|
|
271
|
+
UiIconComponent,
|
|
272
|
+
FormField,
|
|
273
|
+
AppFloatingConfigurator,
|
|
274
|
+
TranslatePipe
|
|
275
|
+
],
|
|
276
|
+
template: `
|
|
277
|
+
<app-floating-configurator />
|
|
278
|
+
<div
|
|
279
|
+
class="bg-surface-ground flex items-center justify-center min-h-screen"
|
|
280
|
+
>
|
|
281
|
+
<div
|
|
282
|
+
class="flex flex-col items-center justify-center w-full max-w-[32rem] px-4"
|
|
283
|
+
>
|
|
284
|
+
<div
|
|
285
|
+
class="w-full"
|
|
286
|
+
style="border-radius: var(--f-content-border-radius); padding: 0.3rem; background: linear-gradient(180deg, var(--primary-color) 10%, rgba(33, 150, 243, 0) 30%)"
|
|
287
|
+
>
|
|
288
|
+
<div
|
|
289
|
+
class="w-full py-8 px-4 sm:py-12 sm:px-8 md:py-16 md:px-12"
|
|
290
|
+
style="border-radius: var(--f-content-border-radius); background: var(--f-content-background)"
|
|
291
|
+
>
|
|
292
|
+
@if (!emailSent()) {
|
|
293
|
+
<div class="text-center mb-8">
|
|
294
|
+
<div class="text-3xl font-medium mb-4 text-color">
|
|
295
|
+
{{ 'auth.forgot.password.title' | translate }}
|
|
296
|
+
</div>
|
|
297
|
+
<span class="text-muted-color font-medium">
|
|
298
|
+
{{ 'auth.forgot.password.subtitle' | translate }}
|
|
299
|
+
</span>
|
|
300
|
+
</div>
|
|
301
|
+
|
|
302
|
+
<form (submit)="onSubmit($event)">
|
|
303
|
+
<label
|
|
304
|
+
for="email"
|
|
305
|
+
class="block text-lg font-medium mb-2 text-color"
|
|
306
|
+
>
|
|
307
|
+
{{ 'auth.email.label' | translate }}
|
|
308
|
+
</label>
|
|
309
|
+
<input
|
|
310
|
+
fInputText
|
|
311
|
+
id="email"
|
|
312
|
+
type="email"
|
|
313
|
+
[placeholder]="'auth.email.placeholder' | translate"
|
|
314
|
+
class="w-full mb-6"
|
|
315
|
+
[formField]="forgotForm.email"
|
|
316
|
+
autocomplete="email"
|
|
317
|
+
/>
|
|
318
|
+
|
|
319
|
+
<button
|
|
320
|
+
fButton
|
|
321
|
+
class="w-full mb-4"
|
|
322
|
+
type="submit"
|
|
323
|
+
[disabled]="!isFormValid() || isLoading()"
|
|
324
|
+
>
|
|
325
|
+
@if (isLoading()) {
|
|
326
|
+
<ui-icon pButtonIcon name="spinner" [spin]="true"></ui-icon>
|
|
327
|
+
}
|
|
328
|
+
<span pButtonLabel>{{ 'auth.forgot.password.send.reset.link' | translate }}</span>
|
|
329
|
+
</button>
|
|
330
|
+
|
|
331
|
+
<div class="flex items-center justify-center gap-2">
|
|
332
|
+
<span class="font-medium">{{
|
|
333
|
+
'auth.forgot.password.remember.password' | translate
|
|
334
|
+
}}</span>
|
|
335
|
+
<a
|
|
336
|
+
routerLink="/auth/login"
|
|
337
|
+
class="font-semibold text-primary cursor-pointer"
|
|
338
|
+
>
|
|
339
|
+
{{ 'auth.login.sign.in' | translate }}
|
|
340
|
+
</a>
|
|
341
|
+
</div>
|
|
342
|
+
</form>
|
|
343
|
+
} @else {
|
|
344
|
+
<div class="text-center">
|
|
345
|
+
<div class="flex justify-center mb-6">
|
|
346
|
+
<ui-icon name="envelope" class="text-6xl text-primary"></ui-icon>
|
|
347
|
+
</div>
|
|
348
|
+
<div class="text-3xl font-medium mb-4 text-color">
|
|
349
|
+
{{ 'auth.forgot.password.check.email' | translate }}
|
|
350
|
+
</div>
|
|
351
|
+
<p class="text-muted-color font-medium mb-6">
|
|
352
|
+
{{
|
|
353
|
+
'auth.forgot.password.email.sent.to'
|
|
354
|
+
| translate: { email: submittedEmail() }
|
|
355
|
+
}}
|
|
356
|
+
</p>
|
|
357
|
+
<p class="text-sm text-muted-color mb-6">
|
|
358
|
+
{{ 'auth.forgot.password.didnt.receive' | translate }}
|
|
359
|
+
<span
|
|
360
|
+
class="text-primary cursor-pointer font-semibold"
|
|
361
|
+
(click)="resetForm()"
|
|
362
|
+
>
|
|
363
|
+
{{ 'auth.forgot.password.try.again' | translate }} </span
|
|
364
|
+
>.
|
|
365
|
+
</p>
|
|
366
|
+
<a
|
|
367
|
+
routerLink="/auth/login"
|
|
368
|
+
class="font-semibold text-primary cursor-pointer"
|
|
369
|
+
>
|
|
370
|
+
{{ 'auth.login.back.to.sign.in' | translate }}
|
|
371
|
+
</a>
|
|
372
|
+
</div>
|
|
373
|
+
}
|
|
374
|
+
</div>
|
|
375
|
+
</div>
|
|
376
|
+
</div>
|
|
377
|
+
</div>
|
|
378
|
+
`
|
|
379
|
+
}]
|
|
380
|
+
}]
|
|
381
|
+
});
|
|
382
|
+
export { ForgotPasswordPageComponent };
|
|
383
|
+
|
|
384
|
+
//# sourceMappingURL=flusys-ng-auth-forgot-password-page.component-BRTVZPX6.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flusys-ng-auth-forgot-password-page.component-BRTVZPX6.mjs","names":[],"sources":["../../../projects/ng-auth/pages/forgot-password/forgot-password-page.component.ts"],"sourcesContent":["import { Component, computed, DestroyRef, inject, signal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport {\n email as emailValidator,\n form,\n FormField,\n required,\n} from '@angular/forms/signals';\nimport { RouterLink } from '@angular/router';\nimport { AppFloatingConfigurator } from '@flusys/ng-layout';\nimport { FButtonDirective, InputTextDirective, MessageService, UiIconComponent } from '@flusys/ng-ui';\nimport {\n TranslatePipe,\n TranslateService,\n} from '@flusys/ng-shared';\nimport { finalize, tap } from 'rxjs';\nimport { AuthApiService } from '../../services/auth-api.service';\n\ninterface IForgotPasswordFormModel {\n email: string;\n}\n\n@Component({\n selector: 'lib-forgot-password-page',\n imports: [\n RouterLink,\n FButtonDirective,\n InputTextDirective,\n UiIconComponent,\n FormField,\n AppFloatingConfigurator,\n TranslatePipe,\n ],\n template: `\n <app-floating-configurator />\n <div\n class=\"bg-surface-ground flex items-center justify-center min-h-screen\"\n >\n <div\n class=\"flex flex-col items-center justify-center w-full max-w-[32rem] px-4\"\n >\n <div\n class=\"w-full\"\n style=\"border-radius: var(--f-content-border-radius); padding: 0.3rem; background: linear-gradient(180deg, var(--primary-color) 10%, rgba(33, 150, 243, 0) 30%)\"\n >\n <div\n class=\"w-full py-8 px-4 sm:py-12 sm:px-8 md:py-16 md:px-12\"\n style=\"border-radius: var(--f-content-border-radius); background: var(--f-content-background)\"\n >\n @if (!emailSent()) {\n <div class=\"text-center mb-8\">\n <div class=\"text-3xl font-medium mb-4 text-color\">\n {{ 'auth.forgot.password.title' | translate }}\n </div>\n <span class=\"text-muted-color font-medium\">\n {{ 'auth.forgot.password.subtitle' | translate }}\n </span>\n </div>\n\n <form (submit)=\"onSubmit($event)\">\n <label\n for=\"email\"\n class=\"block text-lg font-medium mb-2 text-color\"\n >\n {{ 'auth.email.label' | translate }}\n </label>\n <input\n fInputText\n id=\"email\"\n type=\"email\"\n [placeholder]=\"'auth.email.placeholder' | translate\"\n class=\"w-full mb-6\"\n [formField]=\"forgotForm.email\"\n autocomplete=\"email\"\n />\n\n <button\n fButton\n class=\"w-full mb-4\"\n type=\"submit\"\n [disabled]=\"!isFormValid() || isLoading()\"\n >\n @if (isLoading()) {\n <ui-icon pButtonIcon name=\"spinner\" [spin]=\"true\"></ui-icon>\n }\n <span pButtonLabel>{{ 'auth.forgot.password.send.reset.link' | translate }}</span>\n </button>\n\n <div class=\"flex items-center justify-center gap-2\">\n <span class=\"font-medium\">{{\n 'auth.forgot.password.remember.password' | translate\n }}</span>\n <a\n routerLink=\"/auth/login\"\n class=\"font-semibold text-primary cursor-pointer\"\n >\n {{ 'auth.login.sign.in' | translate }}\n </a>\n </div>\n </form>\n } @else {\n <div class=\"text-center\">\n <div class=\"flex justify-center mb-6\">\n <ui-icon name=\"envelope\" class=\"text-6xl text-primary\"></ui-icon>\n </div>\n <div class=\"text-3xl font-medium mb-4 text-color\">\n {{ 'auth.forgot.password.check.email' | translate }}\n </div>\n <p class=\"text-muted-color font-medium mb-6\">\n {{\n 'auth.forgot.password.email.sent.to'\n | translate: { email: submittedEmail() }\n }}\n </p>\n <p class=\"text-sm text-muted-color mb-6\">\n {{ 'auth.forgot.password.didnt.receive' | translate }}\n <span\n class=\"text-primary cursor-pointer font-semibold\"\n (click)=\"resetForm()\"\n >\n {{ 'auth.forgot.password.try.again' | translate }} </span\n >.\n </p>\n <a\n routerLink=\"/auth/login\"\n class=\"font-semibold text-primary cursor-pointer\"\n >\n {{ 'auth.login.back.to.sign.in' | translate }}\n </a>\n </div>\n }\n </div>\n </div>\n </div>\n </div>\n `,\n})\nexport class ForgotPasswordPageComponent {\n private readonly destroyRef = inject(DestroyRef);\n private readonly messageService = inject(MessageService);\n private readonly authApi = inject(AuthApiService);\n private readonly translateAdapter = inject(TranslateService, {\n optional: true,\n });\n\n private translate(key: string, vars?: Record<string, string>): string {\n return this.translateAdapter?.translate(key, vars) ?? key;\n }\n\n readonly isLoading = signal(false);\n readonly emailSent = signal(false);\n readonly submittedEmail = signal('');\n readonly formModel = signal<IForgotPasswordFormModel>({ email: '' });\n readonly forgotForm = form(this.formModel, (f) => {\n required(f.email, {\n message: this.translate('auth.validation.email.required'),\n });\n emailValidator(f.email, {\n message: this.translate('shared.invalid.email'),\n });\n });\n readonly isFormValid = computed(() => this.forgotForm().valid());\n\n onSubmit(event: Event): void {\n event.preventDefault();\n\n if (!this.isFormValid()) {\n this.messageService.add({\n severity: 'error',\n summary: this.translate('shared.validation.error'),\n detail: this.translate('shared.invalid.email'),\n });\n return;\n }\n\n this.isLoading.set(true);\n const email = this.formModel().email;\n\n // Always show success (security: don't reveal if email exists)\n this.authApi\n .forgotPassword(email)\n .pipe(\n takeUntilDestroyed(this.destroyRef),\n tap({\n next: () => this.showEmailSent(email),\n }),\n finalize(() => this.isLoading.set(false)),\n )\n .subscribe({ error: () => {} });\n }\n\n private showEmailSent(email: string): void {\n this.submittedEmail.set(email);\n this.emailSent.set(true);\n }\n\n resetForm(): void {\n this.emailSent.set(false);\n this.submittedEmail.set('');\n this.formModel.set({ email: '' });\n }\n}\n"],"mappings":";;;;;;;;;;AAyIA,IAAa,8BAAb,MAAa,4BAA2B;CACrB,aAAa,OAAO,UAAU;CAC9B,iBAAiB,OAAO,cAAc;CACtC,UAAU,OAAO,cAAc;CAC/B,mBAAmB,OAAO,kBAAkB,EAC3D,UAAU,KACX,CAAA;CAEO,UAAU,KAAa,MAA6B;EAC1D,OAAO,KAAK,kBAAkB,UAAU,KAAK,IAAI,KAAK;CACxD;CAES,YAAY,OAAO,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CACzB,YAAY,OAAO,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CACzB,iBAAiB,OAAO,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,iBAAA,CAAA,+BAAA,CAAA,CAAA;CAC3B,YAAY,OAAiC,EAAE,OAAO,GAAE,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAC3D,aAAa,KAAK,KAAK,YAAY,MAAK;EAC/C,SAAS,EAAE,OAAO,EAChB,SAAS,KAAK,UAAU,gCAAgC,EACzD,CAAA;EACD,MAAe,EAAE,OAAO,EACtB,SAAS,KAAK,UAAU,sBAAsB,EAC/C,CAAA;CACH,CAAC;CACQ,cAAc,eAAe,KAAK,WAAU,CAAE,CAAC,MAAK,GAAG,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