@rxap/ngx-material-authentication 16.0.1-dev.0
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/CHANGELOG.md +8 -0
- package/LICENSE +621 -0
- package/LICENSE.md +621 -0
- package/README.md +21 -0
- package/esm2022/index.mjs +22 -0
- package/esm2022/lib/authentication-container/authentication-container.component.mjs +14 -0
- package/esm2022/lib/fade-animation.mjs +14 -0
- package/esm2022/lib/loading/loading.component.mjs +39 -0
- package/esm2022/lib/login/login.component.mjs +113 -0
- package/esm2022/lib/login/login.form.mjs +113 -0
- package/esm2022/lib/login/request-reset-password.method.mjs +14 -0
- package/esm2022/lib/login/sign-in-with-email-and-password.method.mjs +14 -0
- package/esm2022/lib/reset-password/reset-password.component.mjs +60 -0
- package/esm2022/lib/reset-password/reset-password.form.mjs +121 -0
- package/esm2022/lib/reset-password/set-new-password-with-reset-token.method.mjs +14 -0
- package/esm2022/lib/routes.mjs +36 -0
- package/esm2022/rxap-ngx-material-authentication.mjs +5 -0
- package/fesm2022/rxap-ngx-material-authentication.mjs +498 -0
- package/fesm2022/rxap-ngx-material-authentication.mjs.map +1 -0
- package/index.d.ts +11 -0
- package/lib/authentication-container/authentication-container.component.d.ts +5 -0
- package/lib/fade-animation.d.ts +1 -0
- package/lib/loading/loading.component.d.ts +15 -0
- package/lib/login/login.component.d.ts +14 -0
- package/lib/login/login.form.d.ts +43 -0
- package/lib/login/request-reset-password.method.d.ts +10 -0
- package/lib/login/sign-in-with-email-and-password.method.d.ts +12 -0
- package/lib/reset-password/reset-password.component.d.ts +5 -0
- package/lib/reset-password/reset-password.form.d.ts +35 -0
- package/lib/reset-password/set-new-password-with-reset-token.method.d.ts +11 -0
- package/lib/routes.d.ts +2 -0
- package/package.json +66 -0
- package/theme.css +1 -0
|
@@ -0,0 +1,498 @@
|
|
|
1
|
+
import { NgIf, AsyncPipe } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { Injectable, Inject, INJECTOR, Component, ChangeDetectionStrategy, inject } from '@angular/core';
|
|
4
|
+
import * as i1 from '@angular/forms';
|
|
5
|
+
import { Validators, ReactiveFormsModule } from '@angular/forms';
|
|
6
|
+
import * as i5 from '@angular/material/button';
|
|
7
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
8
|
+
import { ErrorStateMatcher, ShowOnDirtyErrorStateMatcher } from '@angular/material/core';
|
|
9
|
+
import * as i3$1 from '@angular/material/form-field';
|
|
10
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
11
|
+
import * as i2$1 from '@angular/material/icon';
|
|
12
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
13
|
+
import * as i4 from '@angular/material/input';
|
|
14
|
+
import { MatInputModule } from '@angular/material/input';
|
|
15
|
+
import * as i6 from '@angular/material/progress-bar';
|
|
16
|
+
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
|
17
|
+
import * as i3 from '@angular/material/snack-bar';
|
|
18
|
+
import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
|
|
19
|
+
import { UseFormControl, RxapFormControl, ControlValidator, ControlSetValue, RxapForm, RXAP_FORM_DEFINITION_BUILDER, RxapFormBuilder, RXAP_FORM_DEFINITION, RXAP_FORM_SUBMIT_METHOD, FormDirective, FormControlMarkDirtyDirective, FormSubmitFailedDirective, FormSubmittingDirective, RXAP_FORM_SUBMIT_SUCCESSFUL_METHOD } from '@rxap/forms';
|
|
20
|
+
import { ControlErrorDirective } from '@rxap/material-form-system';
|
|
21
|
+
import { trigger, state, style, transition, animate } from '@angular/animations';
|
|
22
|
+
import { __decorate, __metadata } from 'tslib';
|
|
23
|
+
import * as i2 from '@angular/router';
|
|
24
|
+
import { ActivatedRoute, Router, RouterOutlet } from '@angular/router';
|
|
25
|
+
import { firstValueFrom } from 'rxjs';
|
|
26
|
+
import { take, map, switchMap, tap, filter } from 'rxjs/operators';
|
|
27
|
+
import * as i6$1 from '@angular/material/checkbox';
|
|
28
|
+
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
29
|
+
import * as i8 from '@angular/material/progress-spinner';
|
|
30
|
+
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
31
|
+
import * as i7 from '@angular/material/tooltip';
|
|
32
|
+
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
33
|
+
import * as i10 from '@rxap/authentication';
|
|
34
|
+
import { RxapAuthenticationService, RxapAuthenticationGuard } from '@rxap/authentication';
|
|
35
|
+
import { ToggleSubject } from '@rxap/rxjs';
|
|
36
|
+
import * as i1$1 from '@rxap/config';
|
|
37
|
+
import { ConfigService } from '@rxap/config';
|
|
38
|
+
|
|
39
|
+
// the fade-in/fade-out animation.
|
|
40
|
+
const fadeAnimation = trigger('fadeAnimation', [
|
|
41
|
+
// the "in" style determines the "resting" state of the element when it is visible.
|
|
42
|
+
state('in', style({ opacity: 1 })),
|
|
43
|
+
// fade in when created. this could also be written as transition('void => *')
|
|
44
|
+
transition(':enter', [
|
|
45
|
+
style({ opacity: 0 }),
|
|
46
|
+
animate(300),
|
|
47
|
+
]),
|
|
48
|
+
// fade out when destroyed. this could also be written as transition('void => *')
|
|
49
|
+
transition(':leave', animate(300, style({ opacity: 0 }))),
|
|
50
|
+
]);
|
|
51
|
+
|
|
52
|
+
class SetNewPasswordWithResetTokenMethod {
|
|
53
|
+
call(parameters) {
|
|
54
|
+
throw new Error('Method not implemented.');
|
|
55
|
+
}
|
|
56
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: SetNewPasswordWithResetTokenMethod, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
57
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: SetNewPasswordWithResetTokenMethod, providedIn: 'root' }); }
|
|
58
|
+
}
|
|
59
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: SetNewPasswordWithResetTokenMethod, decorators: [{
|
|
60
|
+
type: Injectable,
|
|
61
|
+
args: [{ providedIn: 'root' }]
|
|
62
|
+
}] });
|
|
63
|
+
|
|
64
|
+
const RXAP_RESET_PASSWORD_FORM = 'rxap-reset-password';
|
|
65
|
+
class ResetPasswordFormSubmitMethod {
|
|
66
|
+
constructor(route, setNewPasswordWithResetTokenMethod, snackBar, router) {
|
|
67
|
+
this.route = route;
|
|
68
|
+
this.setNewPasswordWithResetTokenMethod = setNewPasswordWithResetTokenMethod;
|
|
69
|
+
this.snackBar = snackBar;
|
|
70
|
+
this.router = router;
|
|
71
|
+
}
|
|
72
|
+
call(value) {
|
|
73
|
+
return firstValueFrom(this.route.params
|
|
74
|
+
.pipe(take(1), map((params) => params['token']), switchMap((token) => this.setNewPasswordWithResetTokenMethod.call({
|
|
75
|
+
password: value.password,
|
|
76
|
+
token,
|
|
77
|
+
})), tap({
|
|
78
|
+
error: () => {
|
|
79
|
+
this.snackBar.open('Password reset failed.', undefined, {
|
|
80
|
+
duration: 3500,
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
next: () => {
|
|
84
|
+
this.snackBar.open('Password reset was successful.', undefined, {
|
|
85
|
+
duration: 3500,
|
|
86
|
+
});
|
|
87
|
+
return this.router.navigate(['/']);
|
|
88
|
+
},
|
|
89
|
+
}), map(() => true)));
|
|
90
|
+
}
|
|
91
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ResetPasswordFormSubmitMethod, deps: [{ token: ActivatedRoute }, { token: SetNewPasswordWithResetTokenMethod }, { token: MatSnackBar }, { token: Router }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
92
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ResetPasswordFormSubmitMethod }); }
|
|
93
|
+
}
|
|
94
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ResetPasswordFormSubmitMethod, decorators: [{
|
|
95
|
+
type: Injectable
|
|
96
|
+
}], ctorParameters: function () { return [{ type: i2.ActivatedRoute, decorators: [{
|
|
97
|
+
type: Inject,
|
|
98
|
+
args: [ActivatedRoute]
|
|
99
|
+
}] }, { type: SetNewPasswordWithResetTokenMethod }, { type: i3.MatSnackBar, decorators: [{
|
|
100
|
+
type: Inject,
|
|
101
|
+
args: [MatSnackBar]
|
|
102
|
+
}] }, { type: i2.Router, decorators: [{
|
|
103
|
+
type: Inject,
|
|
104
|
+
args: [Router]
|
|
105
|
+
}] }]; } });
|
|
106
|
+
let ResetPasswordForm = class ResetPasswordForm {
|
|
107
|
+
passwordEqual(control) {
|
|
108
|
+
if (this.password.value === null || control.value === null) {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
if (this.password.value !== control.value) {
|
|
112
|
+
return { equal: 'passwords are not equal' };
|
|
113
|
+
}
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
resetRepeat() {
|
|
117
|
+
this.passwordRepeat.reset();
|
|
118
|
+
}
|
|
119
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ResetPasswordForm, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
120
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ResetPasswordForm }); }
|
|
121
|
+
};
|
|
122
|
+
__decorate([
|
|
123
|
+
UseFormControl({
|
|
124
|
+
validators: [Validators.required],
|
|
125
|
+
}),
|
|
126
|
+
__metadata("design:type", RxapFormControl)
|
|
127
|
+
], ResetPasswordForm.prototype, "password", void 0);
|
|
128
|
+
__decorate([
|
|
129
|
+
UseFormControl({
|
|
130
|
+
validators: [Validators.required],
|
|
131
|
+
}),
|
|
132
|
+
__metadata("design:type", RxapFormControl)
|
|
133
|
+
], ResetPasswordForm.prototype, "passwordRepeat", void 0);
|
|
134
|
+
__decorate([
|
|
135
|
+
ControlValidator('passwordRepeat'),
|
|
136
|
+
__metadata("design:type", Function),
|
|
137
|
+
__metadata("design:paramtypes", [RxapFormControl]),
|
|
138
|
+
__metadata("design:returntype", void 0)
|
|
139
|
+
], ResetPasswordForm.prototype, "passwordEqual", null);
|
|
140
|
+
__decorate([
|
|
141
|
+
ControlSetValue('password'),
|
|
142
|
+
__metadata("design:type", Function),
|
|
143
|
+
__metadata("design:paramtypes", []),
|
|
144
|
+
__metadata("design:returntype", void 0)
|
|
145
|
+
], ResetPasswordForm.prototype, "resetRepeat", null);
|
|
146
|
+
ResetPasswordForm = __decorate([
|
|
147
|
+
RxapForm({
|
|
148
|
+
id: RXAP_RESET_PASSWORD_FORM,
|
|
149
|
+
})
|
|
150
|
+
], ResetPasswordForm);
|
|
151
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ResetPasswordForm, decorators: [{
|
|
152
|
+
type: Injectable
|
|
153
|
+
}], propDecorators: { password: [], passwordRepeat: [], passwordEqual: [], resetRepeat: [] } });
|
|
154
|
+
const ResetPasswordFormProviders = [
|
|
155
|
+
ResetPasswordForm,
|
|
156
|
+
{
|
|
157
|
+
provide: RXAP_FORM_DEFINITION_BUILDER,
|
|
158
|
+
useFactory: (injector) => new RxapFormBuilder(ResetPasswordForm, injector),
|
|
159
|
+
deps: [INJECTOR],
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
provide: RXAP_FORM_DEFINITION,
|
|
163
|
+
useFactory: (builder) => builder.build(),
|
|
164
|
+
deps: [RXAP_FORM_DEFINITION_BUILDER],
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
provide: RXAP_FORM_SUBMIT_METHOD,
|
|
168
|
+
useClass: ResetPasswordFormSubmitMethod,
|
|
169
|
+
},
|
|
170
|
+
];
|
|
171
|
+
|
|
172
|
+
class ResetPasswordComponent {
|
|
173
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ResetPasswordComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
174
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.4", type: ResetPasswordComponent, isStandalone: true, selector: "rxap-reset-password", providers: [
|
|
175
|
+
ResetPasswordFormProviders,
|
|
176
|
+
{
|
|
177
|
+
provide: ErrorStateMatcher,
|
|
178
|
+
useClass: ShowOnDirtyErrorStateMatcher,
|
|
179
|
+
},
|
|
180
|
+
], ngImport: i0, template: "<form #form=\"rxapForm\" [@fadeAnimation]=\"'in'\"\n class=\"inner mat-elevation-z5 flex flex-col items-center justify-center gap-4\"\n novalidate\n rxapForm>\n\n <div class=\"header grow-0 flex flex-col items-center justify-center\">\n\n <mat-icon class=\"avatar-icon grow-0\" color=\"primary\">vpn_key</mat-icon>\n\n </div>\n\n <div class=\"content flex flex-col gap-4\">\n\n <div class=\"flex flex-col\">\n\n <mat-form-field class=\"password-input\">\n <mat-icon inline matPrefix>vpn_key</mat-icon>\n <mat-label i18n>New password</mat-label>\n <input #passwordInput\n formControlName=\"password\"\n i18n-placeholder\n matInput\n placeholder=\"Enter your new password\"\n type=\"password\">\n <mat-error *rxapControlError=\"let error key 'required'\">\n Password is <strong>required</strong>\n </mat-error>\n <button (click)=\"passwordInput.type = 'text'\" *ngIf=\"passwordInput.type === 'password'\" mat-icon-button\n matSuffix tabIndex=\"-1\"\n type=\"button\">\n <mat-icon>visibility</mat-icon>\n </button>\n <button (click)=\"passwordInput.type = 'password'\" *ngIf=\"passwordInput.type === 'text'\" mat-icon-button\n matSuffix tabIndex=\"-1\"\n type=\"button\">\n <mat-icon>visibility_off</mat-icon>\n </button>\n </mat-form-field>\n\n <mat-form-field class=\"password-input\">\n <mat-icon inline matPrefix>vpn_key</mat-icon>\n <mat-label i18n>Repeat password</mat-label>\n <input #passwordRepeatInput\n formControlName=\"passwordRepeat\"\n i18n-placeholder\n matInput\n placeholder=\"Enter your new password again\"\n type=\"password\">\n <mat-error *rxapControlError=\"let error key 'required'\">\n Password is <strong>required</strong>\n </mat-error>\n <mat-error *rxapControlError=\"let error key 'equal'\">\n Entered password are <strong>not equal</strong>\n </mat-error>\n <button (click)=\"passwordRepeatInput.type = 'text'\"\n *ngIf=\"passwordRepeatInput.type === 'password'\"\n mat-icon-button\n matSuffix\n tabIndex=\"-1\"\n type=\"button\">\n <mat-icon>visibility</mat-icon>\n </button>\n <button (click)=\"passwordRepeatInput.type = 'password'\"\n *ngIf=\"passwordRepeatInput.type === 'text'\"\n mat-icon-button\n matSuffix\n tabIndex=\"-1\"\n type=\"button\">\n <mat-icon>visibility_off</mat-icon>\n </button>\n </mat-form-field>\n\n </div>\n\n <div class=\"grow-0 flex flex-row justify-center items-center\">\n\n <div class=\"grow-0\">\n <button color=\"primary\" mat-raised-button rxapFormControlMarkDirty type=\"submit\">\n <ng-container i18n>Reset password</ng-container>\n </button>\n </div>\n\n </div>\n\n </div>\n\n <div *rxapFormSubmitFailed=\"let error\" class=\"flex flex-row items-center justify-center\">\n <mat-error>{{ error.message }}</mat-error>\n </div>\n\n <mat-progress-bar *rxapFormSubmitting class=\"loading-bar\" mode=\"indeterminate\"></mat-progress-bar>\n\n</form>\n", styles: [".inner{padding:48px;position:relative;margin:16px 0;background-color:var(--background-color)}.inner ::ng-deep .mat-mdc-form-field-icon-prefix,.inner ::ng-deep .mat-mdc-form-field-icon-suffix{color:var(--hint-text-color, gray)}.inner .header .avatar-icon{width:100px;height:100px;font-size:100px}.inner .content{width:304px;max-width:calc(100vw - 112px)}.inner .content .password-input{width:100%}.inner .content .password-input .prefix-icon{width:24px;height:24px;display:flex;justify-content:center;align-items:center}.inner .content .password-input ::ng-deep .mat-form-field-prefix{align-self:flex-end;margin:4px}.inner .content [type=submit]{width:256px;text-transform:uppercase}.inner .loading-bar{position:absolute;inset:auto 0 0}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: FormDirective, selector: "form[rxapForm]:not([formGroup]):not([ngForm]),rxap-form,form[rxapForm]", inputs: ["initial", "rxapForm", "submitMethod"], outputs: ["ngSubmit", "rxapSubmit", "invalidSubmit", "submitSuccessful"], exportAs: ["rxapForm"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i3$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i3$1.MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "directive", type: i3$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i5.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i5.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: FormControlMarkDirtyDirective, selector: "[rxapFormControlMarkDirty]" }, { kind: "directive", type: FormSubmitFailedDirective, selector: "[rxapFormSubmitFailed]" }, { kind: "directive", type: FormSubmittingDirective, selector: "[rxapFormSubmitting]" }, { kind: "ngmodule", type: MatProgressBarModule }, { kind: "component", type: i6.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "ngmodule", type: MatSnackBarModule }, { kind: "directive", type: ControlErrorDirective, selector: "[rxapControlError]", inputs: ["rxapControlErrorKey"] }], animations: [
|
|
181
|
+
fadeAnimation,
|
|
182
|
+
], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
183
|
+
}
|
|
184
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: ResetPasswordComponent, decorators: [{
|
|
185
|
+
type: Component,
|
|
186
|
+
args: [{ selector: 'rxap-reset-password', changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
187
|
+
ResetPasswordFormProviders,
|
|
188
|
+
{
|
|
189
|
+
provide: ErrorStateMatcher,
|
|
190
|
+
useClass: ShowOnDirtyErrorStateMatcher,
|
|
191
|
+
},
|
|
192
|
+
], animations: [
|
|
193
|
+
fadeAnimation,
|
|
194
|
+
], standalone: true, imports: [
|
|
195
|
+
ReactiveFormsModule,
|
|
196
|
+
FormDirective,
|
|
197
|
+
MatIconModule,
|
|
198
|
+
MatFormFieldModule,
|
|
199
|
+
MatInputModule,
|
|
200
|
+
NgIf,
|
|
201
|
+
MatButtonModule,
|
|
202
|
+
FormControlMarkDirtyDirective,
|
|
203
|
+
FormSubmitFailedDirective,
|
|
204
|
+
FormSubmittingDirective,
|
|
205
|
+
MatProgressBarModule,
|
|
206
|
+
MatSnackBarModule,
|
|
207
|
+
ControlErrorDirective,
|
|
208
|
+
], template: "<form #form=\"rxapForm\" [@fadeAnimation]=\"'in'\"\n class=\"inner mat-elevation-z5 flex flex-col items-center justify-center gap-4\"\n novalidate\n rxapForm>\n\n <div class=\"header grow-0 flex flex-col items-center justify-center\">\n\n <mat-icon class=\"avatar-icon grow-0\" color=\"primary\">vpn_key</mat-icon>\n\n </div>\n\n <div class=\"content flex flex-col gap-4\">\n\n <div class=\"flex flex-col\">\n\n <mat-form-field class=\"password-input\">\n <mat-icon inline matPrefix>vpn_key</mat-icon>\n <mat-label i18n>New password</mat-label>\n <input #passwordInput\n formControlName=\"password\"\n i18n-placeholder\n matInput\n placeholder=\"Enter your new password\"\n type=\"password\">\n <mat-error *rxapControlError=\"let error key 'required'\">\n Password is <strong>required</strong>\n </mat-error>\n <button (click)=\"passwordInput.type = 'text'\" *ngIf=\"passwordInput.type === 'password'\" mat-icon-button\n matSuffix tabIndex=\"-1\"\n type=\"button\">\n <mat-icon>visibility</mat-icon>\n </button>\n <button (click)=\"passwordInput.type = 'password'\" *ngIf=\"passwordInput.type === 'text'\" mat-icon-button\n matSuffix tabIndex=\"-1\"\n type=\"button\">\n <mat-icon>visibility_off</mat-icon>\n </button>\n </mat-form-field>\n\n <mat-form-field class=\"password-input\">\n <mat-icon inline matPrefix>vpn_key</mat-icon>\n <mat-label i18n>Repeat password</mat-label>\n <input #passwordRepeatInput\n formControlName=\"passwordRepeat\"\n i18n-placeholder\n matInput\n placeholder=\"Enter your new password again\"\n type=\"password\">\n <mat-error *rxapControlError=\"let error key 'required'\">\n Password is <strong>required</strong>\n </mat-error>\n <mat-error *rxapControlError=\"let error key 'equal'\">\n Entered password are <strong>not equal</strong>\n </mat-error>\n <button (click)=\"passwordRepeatInput.type = 'text'\"\n *ngIf=\"passwordRepeatInput.type === 'password'\"\n mat-icon-button\n matSuffix\n tabIndex=\"-1\"\n type=\"button\">\n <mat-icon>visibility</mat-icon>\n </button>\n <button (click)=\"passwordRepeatInput.type = 'password'\"\n *ngIf=\"passwordRepeatInput.type === 'text'\"\n mat-icon-button\n matSuffix\n tabIndex=\"-1\"\n type=\"button\">\n <mat-icon>visibility_off</mat-icon>\n </button>\n </mat-form-field>\n\n </div>\n\n <div class=\"grow-0 flex flex-row justify-center items-center\">\n\n <div class=\"grow-0\">\n <button color=\"primary\" mat-raised-button rxapFormControlMarkDirty type=\"submit\">\n <ng-container i18n>Reset password</ng-container>\n </button>\n </div>\n\n </div>\n\n </div>\n\n <div *rxapFormSubmitFailed=\"let error\" class=\"flex flex-row items-center justify-center\">\n <mat-error>{{ error.message }}</mat-error>\n </div>\n\n <mat-progress-bar *rxapFormSubmitting class=\"loading-bar\" mode=\"indeterminate\"></mat-progress-bar>\n\n</form>\n", styles: [".inner{padding:48px;position:relative;margin:16px 0;background-color:var(--background-color)}.inner ::ng-deep .mat-mdc-form-field-icon-prefix,.inner ::ng-deep .mat-mdc-form-field-icon-suffix{color:var(--hint-text-color, gray)}.inner .header .avatar-icon{width:100px;height:100px;font-size:100px}.inner .content{width:304px;max-width:calc(100vw - 112px)}.inner .content .password-input{width:100%}.inner .content .password-input .prefix-icon{width:24px;height:24px;display:flex;justify-content:center;align-items:center}.inner .content .password-input ::ng-deep .mat-form-field-prefix{align-self:flex-end;margin:4px}.inner .content [type=submit]{width:256px;text-transform:uppercase}.inner .loading-bar{position:absolute;inset:auto 0 0}\n"] }]
|
|
209
|
+
}] });
|
|
210
|
+
|
|
211
|
+
class SignInWithEmailAndPasswordMethod {
|
|
212
|
+
call(parameters) {
|
|
213
|
+
throw new Error('Method not implemented.');
|
|
214
|
+
}
|
|
215
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: SignInWithEmailAndPasswordMethod, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
216
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: SignInWithEmailAndPasswordMethod, providedIn: 'root' }); }
|
|
217
|
+
}
|
|
218
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: SignInWithEmailAndPasswordMethod, decorators: [{
|
|
219
|
+
type: Injectable,
|
|
220
|
+
args: [{ providedIn: 'root' }]
|
|
221
|
+
}] });
|
|
222
|
+
|
|
223
|
+
let LoginForm = class LoginForm {
|
|
224
|
+
constructor(config) {
|
|
225
|
+
this.config = config;
|
|
226
|
+
this.loading = true;
|
|
227
|
+
this.loginFailed = false;
|
|
228
|
+
}
|
|
229
|
+
rxapOnInit() {
|
|
230
|
+
const email = this.config.get('authentication.default.email');
|
|
231
|
+
if (email) {
|
|
232
|
+
this.email.setValue(email);
|
|
233
|
+
}
|
|
234
|
+
const password = this.config.get('authentication.default.password');
|
|
235
|
+
if (password) {
|
|
236
|
+
this.password.setValue(password);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: LoginForm, deps: [{ token: i1$1.ConfigService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
240
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: LoginForm }); }
|
|
241
|
+
};
|
|
242
|
+
__decorate([
|
|
243
|
+
UseFormControl({
|
|
244
|
+
validators: [Validators.required, Validators.email],
|
|
245
|
+
}),
|
|
246
|
+
__metadata("design:type", RxapFormControl)
|
|
247
|
+
], LoginForm.prototype, "email", void 0);
|
|
248
|
+
__decorate([
|
|
249
|
+
UseFormControl({
|
|
250
|
+
validators: [Validators.required],
|
|
251
|
+
}),
|
|
252
|
+
__metadata("design:type", RxapFormControl)
|
|
253
|
+
], LoginForm.prototype, "password", void 0);
|
|
254
|
+
__decorate([
|
|
255
|
+
UseFormControl({
|
|
256
|
+
state: true,
|
|
257
|
+
}),
|
|
258
|
+
__metadata("design:type", RxapFormControl)
|
|
259
|
+
], LoginForm.prototype, "remember", void 0);
|
|
260
|
+
LoginForm = __decorate([
|
|
261
|
+
RxapForm({
|
|
262
|
+
id: 'rxap-login',
|
|
263
|
+
}),
|
|
264
|
+
__metadata("design:paramtypes", [ConfigService])
|
|
265
|
+
], LoginForm);
|
|
266
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: LoginForm, decorators: [{
|
|
267
|
+
type: Injectable
|
|
268
|
+
}], ctorParameters: function () { return [{ type: i1$1.ConfigService }]; }, propDecorators: { email: [], password: [], remember: [] } });
|
|
269
|
+
class LoginFormSubmitMethod {
|
|
270
|
+
constructor(signInWithEmailAndPasswordMethod) {
|
|
271
|
+
this.signInWithEmailAndPasswordMethod = signInWithEmailAndPasswordMethod;
|
|
272
|
+
}
|
|
273
|
+
call(value) {
|
|
274
|
+
return this.signInWithEmailAndPasswordMethod.call({
|
|
275
|
+
email: value.email,
|
|
276
|
+
password: value.password,
|
|
277
|
+
remember: value.remember,
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: LoginFormSubmitMethod, deps: [{ token: SignInWithEmailAndPasswordMethod }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
281
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: LoginFormSubmitMethod }); }
|
|
282
|
+
}
|
|
283
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: LoginFormSubmitMethod, decorators: [{
|
|
284
|
+
type: Injectable
|
|
285
|
+
}], ctorParameters: function () { return [{ type: SignInWithEmailAndPasswordMethod }]; } });
|
|
286
|
+
class LoginFormSubmitSuccessful {
|
|
287
|
+
constructor(router) {
|
|
288
|
+
this.router = router;
|
|
289
|
+
}
|
|
290
|
+
call() {
|
|
291
|
+
console.debug('Login was successful. Navigate to application root');
|
|
292
|
+
return this.router.navigate(['/']);
|
|
293
|
+
}
|
|
294
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: LoginFormSubmitSuccessful, deps: [{ token: Router }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
295
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: LoginFormSubmitSuccessful }); }
|
|
296
|
+
}
|
|
297
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: LoginFormSubmitSuccessful, decorators: [{
|
|
298
|
+
type: Injectable
|
|
299
|
+
}], ctorParameters: function () { return [{ type: i2.Router, decorators: [{
|
|
300
|
+
type: Inject,
|
|
301
|
+
args: [Router]
|
|
302
|
+
}] }]; } });
|
|
303
|
+
const LoginFormProviders = [
|
|
304
|
+
LoginForm,
|
|
305
|
+
{
|
|
306
|
+
provide: RXAP_FORM_DEFINITION_BUILDER,
|
|
307
|
+
useFactory: (injector) => new RxapFormBuilder(LoginForm, injector),
|
|
308
|
+
deps: [INJECTOR],
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
provide: RXAP_FORM_DEFINITION,
|
|
312
|
+
useFactory: (builder) => builder.build(),
|
|
313
|
+
deps: [RXAP_FORM_DEFINITION_BUILDER],
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
provide: RXAP_FORM_SUBMIT_METHOD,
|
|
317
|
+
useClass: LoginFormSubmitMethod,
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
provide: RXAP_FORM_SUBMIT_SUCCESSFUL_METHOD,
|
|
321
|
+
useClass: LoginFormSubmitSuccessful,
|
|
322
|
+
},
|
|
323
|
+
];
|
|
324
|
+
|
|
325
|
+
class RequestResetPasswordMethod {
|
|
326
|
+
call(parameters) {
|
|
327
|
+
throw new Error('Method not implemented.');
|
|
328
|
+
}
|
|
329
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: RequestResetPasswordMethod, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
330
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: RequestResetPasswordMethod, providedIn: 'root' }); }
|
|
331
|
+
}
|
|
332
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: RequestResetPasswordMethod, decorators: [{
|
|
333
|
+
type: Injectable,
|
|
334
|
+
args: [{ providedIn: 'root' }]
|
|
335
|
+
}] });
|
|
336
|
+
|
|
337
|
+
class LoginComponent {
|
|
338
|
+
constructor(authentication, snackBar) {
|
|
339
|
+
this.authentication = authentication;
|
|
340
|
+
this.snackBar = snackBar;
|
|
341
|
+
this.requestingPasswordReset$ = new ToggleSubject();
|
|
342
|
+
this.requestPasswordResetMethod = inject(RequestResetPasswordMethod);
|
|
343
|
+
}
|
|
344
|
+
async requestPasswordReset(email) {
|
|
345
|
+
this.requestingPasswordReset$.enable();
|
|
346
|
+
try {
|
|
347
|
+
const result = await this.requestPasswordResetMethod.call({ email });
|
|
348
|
+
if (!result) {
|
|
349
|
+
this.snackBar.open('The password reset request result is falsy', undefined, {
|
|
350
|
+
duration: 5000,
|
|
351
|
+
panelClass: 'error',
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
else {
|
|
355
|
+
this.snackBar.open('The password reset request was successful', undefined, {
|
|
356
|
+
duration: 3000,
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
catch (e) {
|
|
361
|
+
this.snackBar.open(e.message, undefined, {
|
|
362
|
+
duration: 3000,
|
|
363
|
+
panelClass: 'error',
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
finally {
|
|
367
|
+
this.requestingPasswordReset$.disable();
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: LoginComponent, deps: [{ token: RxapAuthenticationService }, { token: MatSnackBar }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
371
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.4", type: LoginComponent, isStandalone: true, selector: "rxap-login", providers: [
|
|
372
|
+
LoginFormProviders,
|
|
373
|
+
{
|
|
374
|
+
provide: ErrorStateMatcher,
|
|
375
|
+
useClass: ShowOnDirtyErrorStateMatcher,
|
|
376
|
+
},
|
|
377
|
+
], ngImport: i0, template: "<form #form=\"rxapForm\" [@fadeAnimation]=\"'in'\"\n class=\"inner mat-elevation-z5 flex flex-col justify-center items-center gap-4\"\n novalidate\n rxapForm>\n\n <div class=\"header flex flex-col items-center justify-center grow-0\">\n\n <mat-icon class=\"avatar-icon grow-0\" color=\"primary\">account_circle</mat-icon>\n\n </div>\n\n <div class=\"content flex flex-col gap-8\">\n\n <div class=\"flex flex-col\">\n\n <mat-form-field class=\"email-input\">\n <mat-icon inline matPrefix>email</mat-icon>\n <mat-label i18n>Email</mat-label>\n <input formControlName=\"email\"\n i18n-placeholder\n matInput\n name=\"email\"\n placeholder=\"Enter your email address\"\n type=\"email\">\n <mat-error *rxapControlError=\"let error key 'required'\">\n Email is <strong>required</strong>\n </mat-error>\n <mat-error *rxapControlError=\"let error key 'email'\">\n Please enter a valid email address\n </mat-error>\n </mat-form-field>\n\n <mat-form-field class=\"password-input\">\n <mat-icon inline matPrefix>vpn_key</mat-icon>\n <mat-label i18n>Password</mat-label>\n <input #passwordInput\n formControlName=\"password\"\n i18n-placeholder\n matInput\n name=\"password\"\n placeholder=\"Enter your password\"\n type=\"password\">\n <mat-error *rxapControlError=\"let error key 'required'\">\n Password is <strong>required</strong>\n </mat-error>\n <button (click)=\"passwordInput.type = 'test'\" *ngIf=\"passwordInput.type === 'password'\" mat-icon-button\n matSuffix tabIndex=\"-1\"\n type=\"button\">\n <mat-icon>visibility</mat-icon>\n </button>\n <button (click)=\"passwordInput.type = 'password'\" *ngIf=\"passwordInput.type === 'text'\" mat-icon-button\n matSuffix tabIndex=\"-1\"\n type=\"button\">\n <mat-icon>visibility_off</mat-icon>\n </button>\n </mat-form-field>\n\n </div>\n\n <div class=\"sub-controls flex flex-row flex-wrap justify-between items-center gap-4\">\n\n <mat-checkbox class=\"remember-input grow-0\" formControlName=\"remember\">Remember me</mat-checkbox>\n\n <div [matTooltipDisabled]=\"form.control.controls['email'].valid\"\n class=\"grow-0\"\n matTooltip=\"Please enter a valid email address\"\n matTooltipPosition=\"above\">\n <button (click)=\"requestPasswordReset(form.value.email)\"\n [disabled]=\"!form.value.email || form.control.controls['email'].hasError('email')\"\n color=\"accent\"\n mat-button\n type=\"button\">\n <span class=\"flex flex-row justify-between items-center gap-2\">\n <mat-progress-spinner *ngIf=\"requestingPasswordReset$ | async\" [diameter]=\"15\"\n mode=\"indeterminate\"></mat-progress-spinner>\n <span class=\"grow-0\">Password forgotten</span>\n </span>\n </button>\n </div>\n\n </div>\n\n <div class=\"grow-0 flex flex-row justify-center items-center\">\n\n <div class=\"grow-0\">\n <button color=\"primary\" mat-raised-button rxapFormControlMarkDirty type=\"submit\">Login</button>\n </div>\n\n </div>\n\n </div>\n\n <div *rxapFormSubmitFailed=\"let error\" class=\"flex flex-row justify-center items-center\">\n <mat-error>{{ error.message }}</mat-error>\n </div>\n\n <mat-progress-bar *rxapFormSubmitting class=\"loading-bar\" mode=\"indeterminate\"></mat-progress-bar>\n\n</form>\n", styles: ["::ng-deep .mat-mdc-snack-bar-container.error{background-color:var(--warn-500);color:var(--foreground-color)}.inner{padding:48px;position:relative;margin:16px 0;background-color:var(--background-color)}.inner ::ng-deep .mat-mdc-form-field-icon-prefix,.inner ::ng-deep .mat-mdc-form-field-icon-suffix{color:var(--hint-text-color, gray)}.inner .header .avatar-icon{width:100px;height:100px;font-size:100px}.inner .content{width:304px;max-width:calc(100vw - 112px)}.inner .content .email-input,.inner .content .password-input{width:100%}.inner .content .email-input .prefix-icon,.inner .content .password-input .prefix-icon{width:24px;height:24px;display:flex;justify-content:center;align-items:center}.inner .content .email-input ::ng-deep .mat-form-field-prefix,.inner .content .password-input ::ng-deep .mat-form-field-prefix{align-self:flex-end;margin:4px}.inner .content [type=submit]{width:128px;text-transform:uppercase}.inner .sub-controls>*{margin-bottom:8px}.inner .loading-bar{position:absolute;inset:auto 0 0}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: FormDirective, selector: "form[rxapForm]:not([formGroup]):not([ngForm]),rxap-form,form[rxapForm]", inputs: ["initial", "rxapForm", "submitMethod"], outputs: ["ngSubmit", "rxapSubmit", "invalidSubmit", "submitSuccessful"], exportAs: ["rxapForm"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i3$1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3$1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3$1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i3$1.MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "directive", type: i3$1.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i5.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i5.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i6$1.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i7.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i8.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "directive", type: FormControlMarkDirtyDirective, selector: "[rxapFormControlMarkDirty]" }, { kind: "directive", type: FormSubmitFailedDirective, selector: "[rxapFormSubmitFailed]" }, { kind: "directive", type: FormSubmittingDirective, selector: "[rxapFormSubmitting]" }, { kind: "ngmodule", type: MatProgressBarModule }, { kind: "component", type: i6.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "ngmodule", type: MatSnackBarModule }, { kind: "directive", type: ControlErrorDirective, selector: "[rxapControlError]", inputs: ["rxapControlErrorKey"] }], animations: [
|
|
378
|
+
fadeAnimation,
|
|
379
|
+
], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
380
|
+
}
|
|
381
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: LoginComponent, decorators: [{
|
|
382
|
+
type: Component,
|
|
383
|
+
args: [{ selector: 'rxap-login', changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
384
|
+
LoginFormProviders,
|
|
385
|
+
{
|
|
386
|
+
provide: ErrorStateMatcher,
|
|
387
|
+
useClass: ShowOnDirtyErrorStateMatcher,
|
|
388
|
+
},
|
|
389
|
+
], animations: [
|
|
390
|
+
fadeAnimation,
|
|
391
|
+
], standalone: true, imports: [
|
|
392
|
+
ReactiveFormsModule,
|
|
393
|
+
FormDirective,
|
|
394
|
+
MatIconModule,
|
|
395
|
+
MatFormFieldModule,
|
|
396
|
+
MatInputModule,
|
|
397
|
+
NgIf,
|
|
398
|
+
MatButtonModule,
|
|
399
|
+
MatCheckboxModule,
|
|
400
|
+
MatTooltipModule,
|
|
401
|
+
MatProgressSpinnerModule,
|
|
402
|
+
FormControlMarkDirtyDirective,
|
|
403
|
+
FormSubmitFailedDirective,
|
|
404
|
+
FormSubmittingDirective,
|
|
405
|
+
MatProgressBarModule,
|
|
406
|
+
AsyncPipe,
|
|
407
|
+
MatSnackBarModule,
|
|
408
|
+
ControlErrorDirective,
|
|
409
|
+
], template: "<form #form=\"rxapForm\" [@fadeAnimation]=\"'in'\"\n class=\"inner mat-elevation-z5 flex flex-col justify-center items-center gap-4\"\n novalidate\n rxapForm>\n\n <div class=\"header flex flex-col items-center justify-center grow-0\">\n\n <mat-icon class=\"avatar-icon grow-0\" color=\"primary\">account_circle</mat-icon>\n\n </div>\n\n <div class=\"content flex flex-col gap-8\">\n\n <div class=\"flex flex-col\">\n\n <mat-form-field class=\"email-input\">\n <mat-icon inline matPrefix>email</mat-icon>\n <mat-label i18n>Email</mat-label>\n <input formControlName=\"email\"\n i18n-placeholder\n matInput\n name=\"email\"\n placeholder=\"Enter your email address\"\n type=\"email\">\n <mat-error *rxapControlError=\"let error key 'required'\">\n Email is <strong>required</strong>\n </mat-error>\n <mat-error *rxapControlError=\"let error key 'email'\">\n Please enter a valid email address\n </mat-error>\n </mat-form-field>\n\n <mat-form-field class=\"password-input\">\n <mat-icon inline matPrefix>vpn_key</mat-icon>\n <mat-label i18n>Password</mat-label>\n <input #passwordInput\n formControlName=\"password\"\n i18n-placeholder\n matInput\n name=\"password\"\n placeholder=\"Enter your password\"\n type=\"password\">\n <mat-error *rxapControlError=\"let error key 'required'\">\n Password is <strong>required</strong>\n </mat-error>\n <button (click)=\"passwordInput.type = 'test'\" *ngIf=\"passwordInput.type === 'password'\" mat-icon-button\n matSuffix tabIndex=\"-1\"\n type=\"button\">\n <mat-icon>visibility</mat-icon>\n </button>\n <button (click)=\"passwordInput.type = 'password'\" *ngIf=\"passwordInput.type === 'text'\" mat-icon-button\n matSuffix tabIndex=\"-1\"\n type=\"button\">\n <mat-icon>visibility_off</mat-icon>\n </button>\n </mat-form-field>\n\n </div>\n\n <div class=\"sub-controls flex flex-row flex-wrap justify-between items-center gap-4\">\n\n <mat-checkbox class=\"remember-input grow-0\" formControlName=\"remember\">Remember me</mat-checkbox>\n\n <div [matTooltipDisabled]=\"form.control.controls['email'].valid\"\n class=\"grow-0\"\n matTooltip=\"Please enter a valid email address\"\n matTooltipPosition=\"above\">\n <button (click)=\"requestPasswordReset(form.value.email)\"\n [disabled]=\"!form.value.email || form.control.controls['email'].hasError('email')\"\n color=\"accent\"\n mat-button\n type=\"button\">\n <span class=\"flex flex-row justify-between items-center gap-2\">\n <mat-progress-spinner *ngIf=\"requestingPasswordReset$ | async\" [diameter]=\"15\"\n mode=\"indeterminate\"></mat-progress-spinner>\n <span class=\"grow-0\">Password forgotten</span>\n </span>\n </button>\n </div>\n\n </div>\n\n <div class=\"grow-0 flex flex-row justify-center items-center\">\n\n <div class=\"grow-0\">\n <button color=\"primary\" mat-raised-button rxapFormControlMarkDirty type=\"submit\">Login</button>\n </div>\n\n </div>\n\n </div>\n\n <div *rxapFormSubmitFailed=\"let error\" class=\"flex flex-row justify-center items-center\">\n <mat-error>{{ error.message }}</mat-error>\n </div>\n\n <mat-progress-bar *rxapFormSubmitting class=\"loading-bar\" mode=\"indeterminate\"></mat-progress-bar>\n\n</form>\n", styles: ["::ng-deep .mat-mdc-snack-bar-container.error{background-color:var(--warn-500);color:var(--foreground-color)}.inner{padding:48px;position:relative;margin:16px 0;background-color:var(--background-color)}.inner ::ng-deep .mat-mdc-form-field-icon-prefix,.inner ::ng-deep .mat-mdc-form-field-icon-suffix{color:var(--hint-text-color, gray)}.inner .header .avatar-icon{width:100px;height:100px;font-size:100px}.inner .content{width:304px;max-width:calc(100vw - 112px)}.inner .content .email-input,.inner .content .password-input{width:100%}.inner .content .email-input .prefix-icon,.inner .content .password-input .prefix-icon{width:24px;height:24px;display:flex;justify-content:center;align-items:center}.inner .content .email-input ::ng-deep .mat-form-field-prefix,.inner .content .password-input ::ng-deep .mat-form-field-prefix{align-self:flex-end;margin:4px}.inner .content [type=submit]{width:128px;text-transform:uppercase}.inner .sub-controls>*{margin-bottom:8px}.inner .loading-bar{position:absolute;inset:auto 0 0}\n"] }]
|
|
410
|
+
}], ctorParameters: function () { return [{ type: i10.RxapAuthenticationService, decorators: [{
|
|
411
|
+
type: Inject,
|
|
412
|
+
args: [RxapAuthenticationService]
|
|
413
|
+
}] }, { type: i3.MatSnackBar, decorators: [{
|
|
414
|
+
type: Inject,
|
|
415
|
+
args: [MatSnackBar]
|
|
416
|
+
}] }]; } });
|
|
417
|
+
|
|
418
|
+
class LoadingComponent {
|
|
419
|
+
constructor(authentication, router) {
|
|
420
|
+
this.authentication = authentication;
|
|
421
|
+
this.router = router;
|
|
422
|
+
}
|
|
423
|
+
ngOnInit() {
|
|
424
|
+
// TODO : remove the concept of isAuthenticated$
|
|
425
|
+
if (this.authentication.isAuthenticated$) {
|
|
426
|
+
this.subscription = this.authentication.isAuthenticated$
|
|
427
|
+
.pipe(filter((isAuthenticated) => isAuthenticated !== null), tap(() => this.router.navigate(['/', 'authentication', 'login'])))
|
|
428
|
+
.subscribe();
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
ngOnDestroy() {
|
|
432
|
+
this.subscription?.unsubscribe();
|
|
433
|
+
}
|
|
434
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: LoadingComponent, deps: [{ token: RxapAuthenticationService }, { token: Router }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
435
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.4", type: LoadingComponent, isStandalone: true, selector: "rxap-auth-loading", ngImport: i0, template: "<mat-progress-bar class=\"loading-bar\" mode=\"indeterminate\"></mat-progress-bar>\n", styles: [".loading-bar{position:absolute;bottom:65vh;left:0;right:0;top:auto}\n"], dependencies: [{ kind: "ngmodule", type: MatProgressBarModule }, { kind: "component", type: i6.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
436
|
+
}
|
|
437
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: LoadingComponent, decorators: [{
|
|
438
|
+
type: Component,
|
|
439
|
+
args: [{ selector: 'rxap-auth-loading', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [MatProgressBarModule], template: "<mat-progress-bar class=\"loading-bar\" mode=\"indeterminate\"></mat-progress-bar>\n", styles: [".loading-bar{position:absolute;bottom:65vh;left:0;right:0;top:auto}\n"] }]
|
|
440
|
+
}], ctorParameters: function () { return [{ type: i10.RxapAuthenticationService, decorators: [{
|
|
441
|
+
type: Inject,
|
|
442
|
+
args: [RxapAuthenticationService]
|
|
443
|
+
}] }, { type: i2.Router, decorators: [{
|
|
444
|
+
type: Inject,
|
|
445
|
+
args: [Router]
|
|
446
|
+
}] }]; } });
|
|
447
|
+
|
|
448
|
+
class AuthenticationContainerComponent {
|
|
449
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: AuthenticationContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
450
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.4", type: AuthenticationContainerComponent, isStandalone: true, selector: "rxap-authentication-container", ngImport: i0, template: "<div class=\"content\">\n\n <div class=\"split mat-elevation-z3\"></div>\n\n <router-outlet></router-outlet>\n <ng-content></ng-content>\n\n</div>\n", styles: [".content{height:100vh;width:100vw;display:flex;align-items:center;justify-content:center;overflow-x:hidden}.content .split{position:absolute;top:0;left:0;right:0;bottom:65vh;z-index:-10;background-color:var(--accent-500, #3ee73e)}\n"], dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] }); }
|
|
451
|
+
}
|
|
452
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: AuthenticationContainerComponent, decorators: [{
|
|
453
|
+
type: Component,
|
|
454
|
+
args: [{ selector: 'rxap-authentication-container', standalone: true, imports: [
|
|
455
|
+
RouterOutlet,
|
|
456
|
+
], template: "<div class=\"content\">\n\n <div class=\"split mat-elevation-z3\"></div>\n\n <router-outlet></router-outlet>\n <ng-content></ng-content>\n\n</div>\n", styles: [".content{height:100vh;width:100vw;display:flex;align-items:center;justify-content:center;overflow-x:hidden}.content .split{position:absolute;top:0;left:0;right:0;bottom:65vh;z-index:-10;background-color:var(--accent-500, #3ee73e)}\n"] }]
|
|
457
|
+
}] });
|
|
458
|
+
|
|
459
|
+
const AUTHENTICATION_ROUTE = [
|
|
460
|
+
{
|
|
461
|
+
path: '',
|
|
462
|
+
component: AuthenticationContainerComponent,
|
|
463
|
+
children: [
|
|
464
|
+
{
|
|
465
|
+
canActivate: [RxapAuthenticationGuard],
|
|
466
|
+
path: 'login',
|
|
467
|
+
component: LoginComponent,
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
canActivate: [RxapAuthenticationGuard],
|
|
471
|
+
path: 'reset-password/:token',
|
|
472
|
+
component: ResetPasswordComponent,
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
path: 'loading',
|
|
476
|
+
component: LoadingComponent,
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
path: '**',
|
|
480
|
+
redirectTo: 'login',
|
|
481
|
+
},
|
|
482
|
+
],
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
path: '**',
|
|
486
|
+
redirectTo: '',
|
|
487
|
+
},
|
|
488
|
+
];
|
|
489
|
+
|
|
490
|
+
// region reset-password
|
|
491
|
+
// endregion
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* Generated bundle index. Do not edit.
|
|
495
|
+
*/
|
|
496
|
+
|
|
497
|
+
export { AUTHENTICATION_ROUTE, AuthenticationContainerComponent, LoadingComponent, LoginComponent, LoginForm, LoginFormProviders, LoginFormSubmitMethod, LoginFormSubmitSuccessful, RXAP_RESET_PASSWORD_FORM, RequestResetPasswordMethod, ResetPasswordComponent, ResetPasswordForm, ResetPasswordFormProviders, ResetPasswordFormSubmitMethod, SetNewPasswordWithResetTokenMethod, SignInWithEmailAndPasswordMethod, fadeAnimation };
|
|
498
|
+
//# sourceMappingURL=rxap-ngx-material-authentication.mjs.map
|