@valtimo/account 4.15.2-next-main.8

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.
@@ -0,0 +1,335 @@
1
+ import { Component, NgModule } from '@angular/core';
2
+ import { FormControl, Validators, FormBuilder, FormsModule, ReactiveFormsModule } from '@angular/forms';
3
+ import { AlertService, WidgetModule, ListModule, FieldAutoFocusModule, UploaderModule, AlertModule } from '@valtimo/components';
4
+ import * as momentImported from 'moment';
5
+ import { RouterModule } from '@angular/router';
6
+ import { CommonModule } from '@angular/common';
7
+ import { AuthGuardService } from '@valtimo/security';
8
+ import { ROLE_USER } from '@valtimo/contract';
9
+
10
+ /*
11
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
12
+ *
13
+ * Licensed under EUPL, Version 1.2 (the "License");
14
+ * you may not use this file except in compliance with the License.
15
+ * You may obtain a copy of the License at
16
+ *
17
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
18
+ *
19
+ * Unless required by applicable law or agreed to in writing, software
20
+ * distributed under the License is distributed on an "AS IS" basis,
21
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
+ * See the License for the specific language governing permissions and
23
+ * limitations under the License.
24
+ */
25
+ const moment = momentImported;
26
+ moment.locale(localStorage.getItem('langKey'));
27
+ class ProfileComponent {
28
+ constructor(formBuilder, alertService
29
+ // private userProviderService: UserProviderService
30
+ ) {
31
+ this.formBuilder = formBuilder;
32
+ this.alertService = alertService;
33
+ this.resourceIds = [];
34
+ }
35
+ ngOnInit() {
36
+ this.reset();
37
+ }
38
+ ngOnDestroy() {
39
+ location.reload();
40
+ }
41
+ get formControls() {
42
+ return this.form.controls;
43
+ }
44
+ initData() {
45
+ /* this.userProviderService.getUserIdentity().subscribe(value => {
46
+ this.profile = value;
47
+ this.setValues();
48
+ });*/
49
+ }
50
+ setValues() {
51
+ if (this.profile) {
52
+ // set humanize dates
53
+ this.profile.humanize_dates = {
54
+ created_at: moment(this.profile.created_at).fromNow(),
55
+ updated_at: moment(this.profile.updated_at).fromNow(),
56
+ last_password_reset: moment(this.profile.last_password_reset).fromNow()
57
+ };
58
+ // set form values
59
+ this.form.controls.firstName.setValue(this.profile.user_metadata.firstname);
60
+ this.form.controls.lastName.setValue(this.profile.user_metadata.lastname);
61
+ this.form.controls.langKey.setValue(this.profile.user_metadata.langKey);
62
+ }
63
+ }
64
+ createFormGroup() {
65
+ return this.formBuilder.group({
66
+ firstName: new FormControl('', Validators.required),
67
+ lastName: new FormControl('', Validators.required),
68
+ langKey: new FormControl('', Validators.required)
69
+ });
70
+ }
71
+ onFileUpload(resources) {
72
+ this.resourceIds = resources.map(resource => resource.id);
73
+ }
74
+ onSubmit() {
75
+ this.form.value.email = this.profile.email;
76
+ // TODO Updating profile ?? allowed when using keycloak
77
+ /* this.userService.updateProfile(this.form.value).subscribe(() => {
78
+ this.alertService.success('Profile has been updated');
79
+ });*/
80
+ }
81
+ reset() {
82
+ this.form = this.createFormGroup();
83
+ this.initData();
84
+ }
85
+ }
86
+ ProfileComponent.decorators = [
87
+ { type: Component, args: [{
88
+ selector: 'valtimo-profile',
89
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div class=\"main-content\">\n <div class=\"container-fluid\">\n <div class=\"col-12 px-0 mb-5\">\n <valtimo-widget *ngIf=\"profile\">\n <div>\n <div class=\"card-body\">\n <div class=\"row py-5\">\n <div class=\"col-12\">\n <div class=\"row mb-3\">\n <div class=\"col-12 col-sm-3 text-sm-right\"><strong>Nickname</strong></div>\n <div class=\"col-12 col-sm-8 col-lg-6\">{{ profile.nickname }}</div>\n </div>\n\n <div class=\"row mb-3\">\n <div class=\"col-12 col-sm-3 text-sm-right\"><strong>Email</strong></div>\n <div class=\"col-12 col-sm-8 col-lg-6\">{{ profile.email }}</div>\n </div>\n\n <div class=\"row mb-3\">\n <div class=\"col-12 col-sm-3 text-sm-right\"><strong>Authorities</strong></div>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <span class=\"badge badge-pill badge-success mb-1 mr-1\"\n *ngFor=\"let role of profile.roles\">{{ role }}</span>\n </div>\n </div>\n\n <div class=\"row mb-3\">\n <div class=\"col-12 col-sm-3 text-sm-right\"><strong>Account status</strong></div>\n <div class=\"col-12 col-sm-8 col-lg-6\" [ngClass]=\"{ 'text-danger': profile.blocked }\">{{ profile.blocked ? 'Blocked' : 'Activated' }}</div>\n </div>\n\n <div class=\"row mb-3\">\n <div class=\"col-12 col-sm-3 text-sm-right\"><strong>Account created</strong></div>\n <div class=\"col-12 col-sm-8 col-lg-6\">{{ profile.humanize_dates.created_at }}</div>\n </div>\n\n <div class=\"row\">\n <div class=\"col-12 col-sm-3 text-sm-right\"><strong>Last updated</strong></div>\n <div class=\"col-12 col-sm-8 col-lg-6\">{{ profile.humanize_dates.updated_at }}</div>\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"card-body-contrast p-5\">\n <form [formGroup]=\"form\" (ngSubmit)=\"onSubmit()\">\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"firstName\">First name</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <input valtimoFieldAutoFocus type=\"text\" id=\"firstName\" formControlName=\"firstName\" class=\"form-control\" placeholder=\"Your first name\"\n [ngClass]=\"{'is-valid': formControls.firstName.touched && formControls.firstName.valid, 'is-invalid': formControls.firstName.touched && formControls.firstName.errors}\"\n required />\n <div *ngIf=\"formControls.firstName.touched && formControls.firstName.errors\" class=\"invalid-feedback\">\n <div *ngIf=\"formControls.firstName.errors.required\">Your first name is required</div>\n </div>\n </div>\n </div>\n\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"lastName\">Last name</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <input type=\"text\" id=\"lastName\" formControlName=\"lastName\" class=\"form-control\" placeholder=\"Your last name\"\n [ngClass]=\"{'is-valid': formControls.lastName.touched && formControls.lastName.valid, 'is-invalid': formControls.lastName.touched && formControls.lastName.errors}\"\n required/>\n <div *ngIf=\"formControls.lastName.touched && formControls.lastName.errors\" class=\"invalid-feedback\">\n <div *ngIf=\"formControls.lastName.errors.required\">Your last name is required</div>\n </div>\n </div>\n </div>\n\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"langKey\">Language</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <select id=\"langKey\" formControlName=\"langKey\" class=\"form-control\"\n [ngClass]=\"{'is-valid': formControls.langKey.touched && formControls.langKey.valid, 'is-invalid': formControls.langKey.touched && formControls.langKey.errors}\"\n required>\n <option value=\"nl\">Nederlands</option>\n <option value=\"en\">English</option>\n </select>\n <div *ngIf=\"formControls.langKey.touched && formControls.langKey.errors\" class=\"invalid-feedback\">\n <div *ngIf=\"formControls.langKey.errors.required\">Your language is required</div>\n </div>\n </div>\n </div>\n\n <div class=\"row pt-3 mt-1\">\n <div class=\"col-12\">\n <div class=\"text-right\">\n <button class=\"btn btn-space btn-secondary\" type=\"button\" (click)=\"reset()\">Reset</button>\n <button class=\"btn btn-space btn-primary\" type=\"submit\" [disabled]=\"form.invalid\">Submit</button>\n </div>\n </div>\n </div>\n </form>\n </div>\n </div>\n </valtimo-widget>\n </div>\n </div>\n</div>\n",
90
+ styles: [""]
91
+ },] }
92
+ ];
93
+ ProfileComponent.ctorParameters = () => [
94
+ { type: FormBuilder },
95
+ { type: AlertService }
96
+ ];
97
+
98
+ /*
99
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
100
+ *
101
+ * Licensed under EUPL, Version 1.2 (the "License");
102
+ * you may not use this file except in compliance with the License.
103
+ * You may obtain a copy of the License at
104
+ *
105
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
106
+ *
107
+ * Unless required by applicable law or agreed to in writing, software
108
+ * distributed under the License is distributed on an "AS IS" basis,
109
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
110
+ * See the License for the specific language governing permissions and
111
+ * limitations under the License.
112
+ */
113
+ const moment$1 = momentImported;
114
+ moment$1.locale(localStorage.getItem('langKey'));
115
+ class PasswordComponent {
116
+ constructor(formBuilder, alertService) {
117
+ this.formBuilder = formBuilder;
118
+ this.alertService = alertService;
119
+ }
120
+ ngOnInit() {
121
+ this.reset();
122
+ }
123
+ ngOnDestroy() {
124
+ location.reload();
125
+ }
126
+ get formControls() {
127
+ return this.form.controls;
128
+ }
129
+ initData() {
130
+ /* this.userService.getUserIdentity().subscribe(value => {
131
+ this.profile = value;
132
+ this.setValues();
133
+ });*/
134
+ }
135
+ setValues() {
136
+ if (this.profile) {
137
+ // humanize dates
138
+ this.profile.humanize_dates = {
139
+ created_at: moment$1(this.profile.created_at).fromNow(),
140
+ updated_at: moment$1(this.profile.updated_at).fromNow(),
141
+ last_password_reset: moment$1(this.profile.last_password_reset).fromNow()
142
+ };
143
+ }
144
+ }
145
+ createFormGroup() {
146
+ return this.formBuilder.group({
147
+ password: new FormControl('', [Validators.required,
148
+ Validators.pattern('(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[$@$!%*?&]).{4,}'),
149
+ Validators.maxLength(50)]),
150
+ confirmPassword: new FormControl('', [Validators.required,
151
+ Validators.minLength(4),
152
+ Validators.maxLength(50)])
153
+ }, {
154
+ validator: this.mustMatch('password', 'confirmPassword')
155
+ });
156
+ }
157
+ mustMatch(controlName, matchingControlName) {
158
+ return (formGroup) => {
159
+ const control = formGroup.controls[controlName];
160
+ const matchingControl = formGroup.controls[matchingControlName];
161
+ if (matchingControl.errors && !matchingControl.errors.mustMatch) {
162
+ return;
163
+ }
164
+ if (control.value !== matchingControl.value) {
165
+ matchingControl.setErrors({ mustMatch: true });
166
+ }
167
+ else {
168
+ matchingControl.setErrors(null);
169
+ }
170
+ };
171
+ }
172
+ onSubmit() {
173
+ /* this.userService.changePassword(this.form.value.password).subscribe(() => {
174
+ this.alertService.success('Password has been changed');
175
+ }, result => {
176
+ this.errorMsg = result.error.detail.split(': ', 2)[1];
177
+ this.reset();
178
+ });*/
179
+ }
180
+ reset() {
181
+ this.form = this.createFormGroup();
182
+ this.initData();
183
+ }
184
+ }
185
+ PasswordComponent.decorators = [
186
+ { type: Component, args: [{
187
+ selector: 'valtimo-password',
188
+ template: "<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div class=\"main-content\">\n <div class=\"container-fluid\">\n <div class=\"col-12 px-0 mb-5\">\n <valtimo-widget *ngIf=\"profile\">\n <div>\n <div class=\"card-body\">\n <div class=\"row py-5\">\n <div class=\"col-12\">\n <div class=\"row\">\n <div class=\"col-12 col-sm-3 text-sm-right\"><strong>Last password changed</strong></div>\n <div class=\"col-12 col-sm-8 col-lg-6\">{{ profile.humanize_dates.last_password_reset }}</div>\n </div>\n </div>\n </div>\n </div>\n <div *ngIf=\"errorMsg\"\n class=\"bg-danger text-white mb-0 p-3 text-center\">\n {{ errorMsg }}\n </div>\n <div class=\"card-body-contrast p-5\">\n <form [formGroup]=\"form\" (ngSubmit)=\"onSubmit()\">\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"password\">New password</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <input valtimoFieldAutoFocus type=\"password\" id=\"password\" minlength=\"4\" maxlength=\"50\" formControlName=\"password\" class=\"form-control\" placeholder=\"Your new password\"\n [ngClass]=\"{'is-valid': formControls.password.touched && formControls.password.valid\n , 'is-invalid': formControls.password.touched && formControls.password.errors}\" required/>\n <div *ngIf=\"formControls.password.touched && formControls.password.errors\" class=\"invalid-feedback\">\n <div *ngIf=\"formControls.password.errors.required\">Your password is required</div>\n <div *ngIf=\"formControls.password.errors.pattern\">It expects at least 1 lowercase letter, 1 uppercase letter, 1 digit and 1 special characters. The length should be greater than 4 characters. The sequence of the characters is not important.</div>\n </div>\n </div>\n </div>\n\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"confirmPassword\">New password confirmation</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <input type=\"password\" id=\"confirmPassword\" minlength=\"4\" maxlength=\"50\" formControlName=\"confirmPassword\" class=\"form-control\" placeholder=\"Your new password confirmation\"\n [ngClass]=\"{'is-valid': formControls.confirmPassword.touched && formControls.confirmPassword.valid\n , 'is-invalid': formControls.confirmPassword.touched && formControls.confirmPassword.errors}\" required/>\n <div *ngIf=\"formControls.confirmPassword.touched && formControls.confirmPassword.errors\" class=\"invalid-feedback\">\n <div *ngIf=\"formControls.confirmPassword.errors.required\">Your new password confirmation is required</div>\n <div *ngIf=\"formControls.confirmPassword.errors.minlength\">Your new password confirmation is required to be at least 4 characters</div>\n <div *ngIf=\"formControls.confirmPassword.errors.mustMatch\">Your password and confirmation password must match</div>\n </div>\n </div>\n </div>\n\n <div class=\"row pt-3 mt-1\">\n <div class=\"col-12\">\n <div class=\"text-right\">\n <button class=\"btn btn-space btn-secondary\" type=\"button\" (click)=\"reset()\">Reset</button>\n <button class=\"btn btn-space btn-primary\" type=\"submit\" [disabled]=\"form.invalid\">Submit</button>\n </div>\n </div>\n </div>\n </form>\n </div>\n </div>\n </valtimo-widget>\n </div>\n </div>\n</div>\n",
189
+ styles: [""]
190
+ },] }
191
+ ];
192
+ PasswordComponent.ctorParameters = () => [
193
+ { type: FormBuilder },
194
+ { type: AlertService }
195
+ ];
196
+
197
+ /*
198
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
199
+ *
200
+ * Licensed under EUPL, Version 1.2 (the "License");
201
+ * you may not use this file except in compliance with the License.
202
+ * You may obtain a copy of the License at
203
+ *
204
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
205
+ *
206
+ * Unless required by applicable law or agreed to in writing, software
207
+ * distributed under the License is distributed on an "AS IS" basis,
208
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
209
+ * See the License for the specific language governing permissions and
210
+ * limitations under the License.
211
+ */
212
+ const ɵ0 = { title: 'Profile', roles: [ROLE_USER] }, ɵ1 = { title: 'Password', roles: [ROLE_USER] };
213
+ const routes = [
214
+ {
215
+ path: 'profile',
216
+ component: ProfileComponent,
217
+ canActivate: [AuthGuardService],
218
+ data: ɵ0
219
+ },
220
+ {
221
+ path: 'password',
222
+ component: PasswordComponent,
223
+ canActivate: [AuthGuardService],
224
+ data: ɵ1
225
+ }
226
+ ];
227
+ class AccountRoutingModule {
228
+ }
229
+ AccountRoutingModule.decorators = [
230
+ { type: NgModule, args: [{
231
+ declarations: [],
232
+ imports: [
233
+ CommonModule,
234
+ RouterModule.forChild(routes)
235
+ ],
236
+ exports: [RouterModule]
237
+ },] }
238
+ ];
239
+
240
+ /*
241
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
242
+ *
243
+ * Licensed under EUPL, Version 1.2 (the "License");
244
+ * you may not use this file except in compliance with the License.
245
+ * You may obtain a copy of the License at
246
+ *
247
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
248
+ *
249
+ * Unless required by applicable law or agreed to in writing, software
250
+ * distributed under the License is distributed on an "AS IS" basis,
251
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
252
+ * See the License for the specific language governing permissions and
253
+ * limitations under the License.
254
+ */
255
+ class AccountModule {
256
+ }
257
+ AccountModule.decorators = [
258
+ { type: NgModule, args: [{
259
+ declarations: [ProfileComponent, PasswordComponent],
260
+ imports: [
261
+ CommonModule,
262
+ AccountRoutingModule,
263
+ WidgetModule,
264
+ ListModule,
265
+ FieldAutoFocusModule,
266
+ FormsModule,
267
+ ReactiveFormsModule,
268
+ UploaderModule,
269
+ AlertModule
270
+ ],
271
+ exports: [ProfileComponent, PasswordComponent],
272
+ providers: []
273
+ },] }
274
+ ];
275
+
276
+ /*
277
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
278
+ *
279
+ * Licensed under EUPL, Version 1.2 (the "License");
280
+ * you may not use this file except in compliance with the License.
281
+ * You may obtain a copy of the License at
282
+ *
283
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
284
+ *
285
+ * Unless required by applicable law or agreed to in writing, software
286
+ * distributed under the License is distributed on an "AS IS" basis,
287
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
288
+ * See the License for the specific language governing permissions and
289
+ * limitations under the License.
290
+ */
291
+ function accountInitializer(translate, logger) {
292
+ return () => {
293
+ return new Promise((resolve, reject) => {
294
+ try {
295
+ logger.debug('Account initializer');
296
+ translate.addLangs(['en', 'nl']);
297
+ let langKey = localStorage.getItem('langKey');
298
+ if (langKey === null) {
299
+ langKey = 'nl';
300
+ localStorage.setItem('langKey', 'nl');
301
+ }
302
+ logger.debug('Using langKey', langKey);
303
+ translate.use(langKey);
304
+ resolve();
305
+ }
306
+ catch (error) {
307
+ logger.debug('Account initializer error', error);
308
+ reject(error);
309
+ }
310
+ });
311
+ };
312
+ }
313
+
314
+ /*
315
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
316
+ *
317
+ * Licensed under EUPL, Version 1.2 (the "License");
318
+ * you may not use this file except in compliance with the License.
319
+ * You may obtain a copy of the License at
320
+ *
321
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
322
+ *
323
+ * Unless required by applicable law or agreed to in writing, software
324
+ * distributed under the License is distributed on an "AS IS" basis,
325
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
326
+ * See the License for the specific language governing permissions and
327
+ * limitations under the License.
328
+ */
329
+
330
+ /**
331
+ * Generated bundle index. Do not edit.
332
+ */
333
+
334
+ export { AccountModule, PasswordComponent, ProfileComponent, accountInitializer, AccountRoutingModule as ɵa };
335
+ //# sourceMappingURL=valtimo-account.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"valtimo-account.js","sources":["../../../../projects/valtimo/account/src/lib/profile/profile.component.ts","../../../../projects/valtimo/account/src/lib/password/password.component.ts","../../../../projects/valtimo/account/src/lib/account-routing.module.ts","../../../../projects/valtimo/account/src/lib/account.module.ts","../../../../projects/valtimo/account/src/lib/account.init.ts","../../../../projects/valtimo/account/src/public_api.ts","../../../../projects/valtimo/account/src/valtimo-account.ts"],"sourcesContent":["/*\n * Copyright 2015-2020 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Component, OnDestroy, OnInit} from '@angular/core';\nimport {FormBuilder, FormControl, FormGroup, Validators} from '@angular/forms';\nimport {AlertService} from '@valtimo/components';\nimport * as momentImported from 'moment';\n\nconst moment = momentImported;\nmoment.locale(localStorage.getItem('langKey'));\n\n@Component({\n selector: 'valtimo-profile',\n templateUrl: './profile.component.html',\n styleUrls: ['./profile.component.css']\n})\nexport class ProfileComponent implements OnInit, OnDestroy {\n\n public profile: any;\n public form: FormGroup;\n public resourceIds: Array<any> = [];\n\n constructor(\n private formBuilder: FormBuilder,\n private alertService: AlertService\n // private userProviderService: UserProviderService\n ) { }\n\n ngOnInit() {\n this.reset();\n }\n\n ngOnDestroy() {\n location.reload();\n }\n\n get formControls() {\n return this.form.controls;\n }\n\n private initData() {\n /* this.userProviderService.getUserIdentity().subscribe(value => {\n this.profile = value;\n this.setValues();\n });*/\n }\n\n private setValues() {\n if (this.profile) {\n // set humanize dates\n this.profile.humanize_dates = {\n created_at: moment(this.profile.created_at).fromNow(),\n updated_at: moment(this.profile.updated_at).fromNow(),\n last_password_reset: moment(this.profile.last_password_reset).fromNow()\n };\n // set form values\n this.form.controls.firstName.setValue(this.profile.user_metadata.firstname);\n this.form.controls.lastName.setValue(this.profile.user_metadata.lastname);\n this.form.controls.langKey.setValue(this.profile.user_metadata.langKey);\n }\n }\n\n private createFormGroup() {\n return this.formBuilder.group({\n firstName: new FormControl('', Validators.required),\n lastName: new FormControl('', Validators.required),\n langKey: new FormControl('', Validators.required)\n });\n }\n\n public onFileUpload(resources) {\n this.resourceIds = resources.map(resource => resource.id);\n }\n\n public onSubmit() {\n this.form.value.email = this.profile.email;\n // TODO Updating profile ?? allowed when using keycloak\n /* this.userService.updateProfile(this.form.value).subscribe(() => {\n this.alertService.success('Profile has been updated');\n });*/\n }\n\n public reset() {\n this.form = this.createFormGroup();\n this.initData();\n }\n\n}\n","/*\n * Copyright 2015-2020 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Component, OnDestroy, OnInit} from '@angular/core';\nimport {FormBuilder, FormControl, FormGroup, Validators} from '@angular/forms';\nimport {AlertService} from '@valtimo/components';\nimport * as momentImported from 'moment';\n\nconst moment = momentImported;\nmoment.locale(localStorage.getItem('langKey'));\n\n@Component({\n selector: 'valtimo-password',\n templateUrl: './password.component.html',\n styleUrls: ['./password.component.css']\n})\nexport class PasswordComponent implements OnInit, OnDestroy {\n\n public profile: any;\n public errorMsg: string;\n public form: FormGroup;\n\n constructor(\n private formBuilder: FormBuilder,\n private alertService: AlertService\n ) {\n }\n\n ngOnInit() {\n this.reset();\n }\n\n ngOnDestroy() {\n location.reload();\n }\n\n get formControls() {\n return this.form.controls;\n }\n\n private initData() {\n /* this.userService.getUserIdentity().subscribe(value => {\n this.profile = value;\n this.setValues();\n });*/\n }\n\n private setValues() {\n if (this.profile) {\n // humanize dates\n this.profile.humanize_dates = {\n created_at: moment(this.profile.created_at).fromNow(),\n updated_at: moment(this.profile.updated_at).fromNow(),\n last_password_reset: moment(this.profile.last_password_reset).fromNow()\n };\n }\n }\n\n private createFormGroup() {\n return this.formBuilder.group({\n password: new FormControl('', [Validators.required\n , Validators.pattern('(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[$@$!%*?&]).{4,}')\n , Validators.maxLength(50)]),\n confirmPassword: new FormControl('', [Validators.required\n , Validators.minLength(4)\n , Validators.maxLength(50)])\n }, {\n validator: this.mustMatch('password', 'confirmPassword')\n });\n }\n\n public mustMatch(controlName: string, matchingControlName: string) {\n return (formGroup: FormGroup) => {\n const control = formGroup.controls[controlName];\n const matchingControl = formGroup.controls[matchingControlName];\n if (matchingControl.errors && !matchingControl.errors.mustMatch) {\n return;\n }\n if (control.value !== matchingControl.value) {\n matchingControl.setErrors({mustMatch: true});\n } else {\n matchingControl.setErrors(null);\n }\n };\n }\n\n public onSubmit() {\n /* this.userService.changePassword(this.form.value.password).subscribe(() => {\n this.alertService.success('Password has been changed');\n }, result => {\n this.errorMsg = result.error.detail.split(': ', 2)[1];\n this.reset();\n });*/\n }\n\n public reset() {\n this.form = this.createFormGroup();\n this.initData();\n }\n\n}\n","/*\n * Copyright 2015-2020 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {NgModule} from '@angular/core';\nimport {RouterModule, Routes} from '@angular/router';\nimport {CommonModule} from '@angular/common';\nimport {AuthGuardService} from '@valtimo/security';\nimport {ProfileComponent} from './profile/profile.component';\nimport {PasswordComponent} from './password/password.component';\nimport {ROLE_USER} from '@valtimo/contract';\n\nconst routes: Routes = [\n {\n path: 'profile',\n component: ProfileComponent,\n canActivate: [AuthGuardService],\n data: {title: 'Profile', roles: [ROLE_USER]}\n },\n {\n path: 'password',\n component: PasswordComponent,\n canActivate: [AuthGuardService],\n data: {title: 'Password', roles: [ROLE_USER]}\n }\n];\n\n@NgModule({\n declarations: [],\n imports: [\n CommonModule,\n RouterModule.forChild(routes)\n ],\n exports: [RouterModule]\n})\nexport class AccountRoutingModule {\n}\n","/*\n * Copyright 2015-2020 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {NgModule} from '@angular/core';\nimport {AccountRoutingModule} from './account-routing.module';\nimport {CommonModule} from '@angular/common';\nimport {FormsModule, ReactiveFormsModule} from '@angular/forms';\nimport {AlertModule, FieldAutoFocusModule, ListModule, UploaderModule, WidgetModule} from '@valtimo/components';\nimport {ProfileComponent} from './profile/profile.component';\nimport {PasswordComponent} from './password/password.component';\n\n@NgModule({\n declarations: [ProfileComponent, PasswordComponent],\n imports: [\n CommonModule,\n AccountRoutingModule,\n WidgetModule,\n ListModule,\n FieldAutoFocusModule,\n FormsModule,\n ReactiveFormsModule,\n UploaderModule,\n AlertModule\n ],\n exports: [ProfileComponent, PasswordComponent],\n providers: []\n})\nexport class AccountModule {\n}\n","/*\n * Copyright 2015-2020 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {NGXLogger} from 'ngx-logger';\nimport {TranslateService} from '@ngx-translate/core';\n\nexport function accountInitializer(\n translate: TranslateService,\n logger: NGXLogger\n): () => Promise<any> {\n return (): Promise<any> => {\n return new Promise((resolve, reject) => {\n try {\n logger.debug('Account initializer');\n translate.addLangs(['en', 'nl']);\n let langKey = localStorage.getItem('langKey');\n if (langKey === null) {\n langKey = 'nl';\n localStorage.setItem('langKey', 'nl');\n }\n logger.debug('Using langKey', langKey);\n translate.use(langKey);\n resolve();\n } catch (error) {\n logger.debug('Account initializer error', error);\n reject(error);\n }\n });\n };\n}\n\n\n","/*\n * Copyright 2015-2020 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Public API Surface of account\n */\n\nexport * from './lib/profile/profile.component';\nexport * from './lib/password/password.component';\nexport * from './lib/account.module';\nexport * from './lib/account.init';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n\nexport {AccountRoutingModule as ɵa} from './lib/account-routing.module';"],"names":["moment"],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;;AAqBA,MAAM,MAAM,GAAG,cAAc,CAAC;AAC9B,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;MAOlC,gBAAgB;IAM3B,YACU,WAAwB,EACxB,YAA0B;;;QAD1B,gBAAW,GAAX,WAAW,CAAa;QACxB,iBAAY,GAAZ,YAAY,CAAc;QAJ7B,gBAAW,GAAe,EAAE,CAAC;KAM/B;IAEL,QAAQ;QACN,IAAI,CAAC,KAAK,EAAE,CAAC;KACd;IAED,WAAW;QACT,QAAQ,CAAC,MAAM,EAAE,CAAC;KACnB;IAED,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;KAC3B;IAEO,QAAQ;;;;;KAKf;IAEO,SAAS;QACf,IAAI,IAAI,CAAC,OAAO,EAAE;;YAEhB,IAAI,CAAC,OAAO,CAAC,cAAc,GAAG;gBAC5B,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE;gBACrD,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE;gBACrD,mBAAmB,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAA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AAK,EAAE;gBACd,MAAM,CAAC,KAAK,CAAC,2BAA2B,EAAE,KAAK,CAAC,CAAC;gBACjD,MAAM,CAAC,KAAK,CAAC,CAAC;aACf;SACF,CAAC,CAAC;KACJ,CAAC;AACJ;;AC1CA;;;;;;;;;;;;;;;;ACAA;;;;;;"}
@@ -0,0 +1,2 @@
1
+ export declare class AccountRoutingModule {
2
+ }
@@ -0,0 +1,3 @@
1
+ import { NGXLogger } from 'ngx-logger';
2
+ import { TranslateService } from '@ngx-translate/core';
3
+ export declare function accountInitializer(translate: TranslateService, logger: NGXLogger): () => Promise<any>;
@@ -0,0 +1,2 @@
1
+ export declare class AccountModule {
2
+ }
@@ -0,0 +1,22 @@
1
+ import { OnDestroy, OnInit } from '@angular/core';
2
+ import { FormBuilder, FormGroup } from '@angular/forms';
3
+ import { AlertService } from '@valtimo/components';
4
+ export declare class PasswordComponent implements OnInit, OnDestroy {
5
+ private formBuilder;
6
+ private alertService;
7
+ profile: any;
8
+ errorMsg: string;
9
+ form: FormGroup;
10
+ constructor(formBuilder: FormBuilder, alertService: AlertService);
11
+ ngOnInit(): void;
12
+ ngOnDestroy(): void;
13
+ get formControls(): {
14
+ [key: string]: import("@angular/forms").AbstractControl;
15
+ };
16
+ private initData;
17
+ private setValues;
18
+ private createFormGroup;
19
+ mustMatch(controlName: string, matchingControlName: string): (formGroup: FormGroup) => void;
20
+ onSubmit(): void;
21
+ reset(): void;
22
+ }
@@ -0,0 +1,22 @@
1
+ import { OnDestroy, OnInit } from '@angular/core';
2
+ import { FormBuilder, FormGroup } from '@angular/forms';
3
+ import { AlertService } from '@valtimo/components';
4
+ export declare class ProfileComponent implements OnInit, OnDestroy {
5
+ private formBuilder;
6
+ private alertService;
7
+ profile: any;
8
+ form: FormGroup;
9
+ resourceIds: Array<any>;
10
+ constructor(formBuilder: FormBuilder, alertService: AlertService);
11
+ ngOnInit(): void;
12
+ ngOnDestroy(): void;
13
+ get formControls(): {
14
+ [key: string]: import("@angular/forms").AbstractControl;
15
+ };
16
+ private initData;
17
+ private setValues;
18
+ private createFormGroup;
19
+ onFileUpload(resources: any): void;
20
+ onSubmit(): void;
21
+ reset(): void;
22
+ }
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@valtimo/account",
3
+ "version": "4.15.2-next-main.8",
4
+ "publishConfig": {
5
+ "registry": "http://repo.ritense.com/repository/npm-ritense-private/"
6
+ },
7
+ "peerDependencies": {
8
+ "moment": "2.24.0",
9
+ "@angular/common": "^10.0.11",
10
+ "@angular/core": "^10.0.11"
11
+ },
12
+ "dependencies": {
13
+ "tslib": "^2.0.0"
14
+ },
15
+ "main": "bundles/valtimo-account.umd.js",
16
+ "module": "fesm2015/valtimo-account.js",
17
+ "es2015": "fesm2015/valtimo-account.js",
18
+ "esm2015": "esm2015/valtimo-account.js",
19
+ "fesm2015": "fesm2015/valtimo-account.js",
20
+ "typings": "valtimo-account.d.ts",
21
+ "metadata": "valtimo-account.metadata.json",
22
+ "sideEffects": false
23
+ }
@@ -0,0 +1,4 @@
1
+ export * from './lib/profile/profile.component';
2
+ export * from './lib/password/password.component';
3
+ export * from './lib/account.module';
4
+ export * from './lib/account.init';
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ export * from './public_api';
5
+ export { AccountRoutingModule as ɵa } from './lib/account-routing.module';
@@ -0,0 +1 @@
1
+ {"__symbolic":"module","version":4,"metadata":{"ProfileComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":24,"character":1},"arguments":[{"selector":"valtimo-profile","template":"<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div class=\"main-content\">\n <div class=\"container-fluid\">\n <div class=\"col-12 px-0 mb-5\">\n <valtimo-widget *ngIf=\"profile\">\n <div>\n <div class=\"card-body\">\n <div class=\"row py-5\">\n <div class=\"col-12\">\n <div class=\"row mb-3\">\n <div class=\"col-12 col-sm-3 text-sm-right\"><strong>Nickname</strong></div>\n <div class=\"col-12 col-sm-8 col-lg-6\">{{ profile.nickname }}</div>\n </div>\n\n <div class=\"row mb-3\">\n <div class=\"col-12 col-sm-3 text-sm-right\"><strong>Email</strong></div>\n <div class=\"col-12 col-sm-8 col-lg-6\">{{ profile.email }}</div>\n </div>\n\n <div class=\"row mb-3\">\n <div class=\"col-12 col-sm-3 text-sm-right\"><strong>Authorities</strong></div>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <span class=\"badge badge-pill badge-success mb-1 mr-1\"\n *ngFor=\"let role of profile.roles\">{{ role }}</span>\n </div>\n </div>\n\n <div class=\"row mb-3\">\n <div class=\"col-12 col-sm-3 text-sm-right\"><strong>Account status</strong></div>\n <div class=\"col-12 col-sm-8 col-lg-6\" [ngClass]=\"{ 'text-danger': profile.blocked }\">{{ profile.blocked ? 'Blocked' : 'Activated' }}</div>\n </div>\n\n <div class=\"row mb-3\">\n <div class=\"col-12 col-sm-3 text-sm-right\"><strong>Account created</strong></div>\n <div class=\"col-12 col-sm-8 col-lg-6\">{{ profile.humanize_dates.created_at }}</div>\n </div>\n\n <div class=\"row\">\n <div class=\"col-12 col-sm-3 text-sm-right\"><strong>Last updated</strong></div>\n <div class=\"col-12 col-sm-8 col-lg-6\">{{ profile.humanize_dates.updated_at }}</div>\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"card-body-contrast p-5\">\n <form [formGroup]=\"form\" (ngSubmit)=\"onSubmit()\">\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"firstName\">First name</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <input valtimoFieldAutoFocus type=\"text\" id=\"firstName\" formControlName=\"firstName\" class=\"form-control\" placeholder=\"Your first name\"\n [ngClass]=\"{'is-valid': formControls.firstName.touched && formControls.firstName.valid, 'is-invalid': formControls.firstName.touched && formControls.firstName.errors}\"\n required />\n <div *ngIf=\"formControls.firstName.touched && formControls.firstName.errors\" class=\"invalid-feedback\">\n <div *ngIf=\"formControls.firstName.errors.required\">Your first name is required</div>\n </div>\n </div>\n </div>\n\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"lastName\">Last name</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <input type=\"text\" id=\"lastName\" formControlName=\"lastName\" class=\"form-control\" placeholder=\"Your last name\"\n [ngClass]=\"{'is-valid': formControls.lastName.touched && formControls.lastName.valid, 'is-invalid': formControls.lastName.touched && formControls.lastName.errors}\"\n required/>\n <div *ngIf=\"formControls.lastName.touched && formControls.lastName.errors\" class=\"invalid-feedback\">\n <div *ngIf=\"formControls.lastName.errors.required\">Your last name is required</div>\n </div>\n </div>\n </div>\n\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"langKey\">Language</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <select id=\"langKey\" formControlName=\"langKey\" class=\"form-control\"\n [ngClass]=\"{'is-valid': formControls.langKey.touched && formControls.langKey.valid, 'is-invalid': formControls.langKey.touched && formControls.langKey.errors}\"\n required>\n <option value=\"nl\">Nederlands</option>\n <option value=\"en\">English</option>\n </select>\n <div *ngIf=\"formControls.langKey.touched && formControls.langKey.errors\" class=\"invalid-feedback\">\n <div *ngIf=\"formControls.langKey.errors.required\">Your language is required</div>\n </div>\n </div>\n </div>\n\n <div class=\"row pt-3 mt-1\">\n <div class=\"col-12\">\n <div class=\"text-right\">\n <button class=\"btn btn-space btn-secondary\" type=\"button\" (click)=\"reset()\">Reset</button>\n <button class=\"btn btn-space btn-primary\" type=\"submit\" [disabled]=\"form.invalid\">Submit</button>\n </div>\n </div>\n </div>\n </form>\n </div>\n </div>\n </valtimo-widget>\n </div>\n </div>\n</div>\n","styles":[""]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/forms","name":"FormBuilder","line":36,"character":25},{"__symbolic":"reference","module":"@valtimo/components","name":"AlertService","line":37,"character":26}]}],"ngOnInit":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"initData":[{"__symbolic":"method"}],"setValues":[{"__symbolic":"method"}],"createFormGroup":[{"__symbolic":"method"}],"onFileUpload":[{"__symbolic":"method"}],"onSubmit":[{"__symbolic":"method"}],"reset":[{"__symbolic":"method"}]}},"PasswordComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":24,"character":1},"arguments":[{"selector":"valtimo-password","template":"<!--\n ~ Copyright 2015-2020 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div class=\"main-content\">\n <div class=\"container-fluid\">\n <div class=\"col-12 px-0 mb-5\">\n <valtimo-widget *ngIf=\"profile\">\n <div>\n <div class=\"card-body\">\n <div class=\"row py-5\">\n <div class=\"col-12\">\n <div class=\"row\">\n <div class=\"col-12 col-sm-3 text-sm-right\"><strong>Last password changed</strong></div>\n <div class=\"col-12 col-sm-8 col-lg-6\">{{ profile.humanize_dates.last_password_reset }}</div>\n </div>\n </div>\n </div>\n </div>\n <div *ngIf=\"errorMsg\"\n class=\"bg-danger text-white mb-0 p-3 text-center\">\n {{ errorMsg }}\n </div>\n <div class=\"card-body-contrast p-5\">\n <form [formGroup]=\"form\" (ngSubmit)=\"onSubmit()\">\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"password\">New password</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <input valtimoFieldAutoFocus type=\"password\" id=\"password\" minlength=\"4\" maxlength=\"50\" formControlName=\"password\" class=\"form-control\" placeholder=\"Your new password\"\n [ngClass]=\"{'is-valid': formControls.password.touched && formControls.password.valid\n , 'is-invalid': formControls.password.touched && formControls.password.errors}\" required/>\n <div *ngIf=\"formControls.password.touched && formControls.password.errors\" class=\"invalid-feedback\">\n <div *ngIf=\"formControls.password.errors.required\">Your password is required</div>\n <div *ngIf=\"formControls.password.errors.pattern\">It expects at least 1 lowercase letter, 1 uppercase letter, 1 digit and 1 special characters. The length should be greater than 4 characters. The sequence of the characters is not important.</div>\n </div>\n </div>\n </div>\n\n <div class=\"form-group row\">\n <label class=\"col-12 col-sm-3 col-form-label text-sm-right\" for=\"confirmPassword\">New password confirmation</label>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <input type=\"password\" id=\"confirmPassword\" minlength=\"4\" maxlength=\"50\" formControlName=\"confirmPassword\" class=\"form-control\" placeholder=\"Your new password confirmation\"\n [ngClass]=\"{'is-valid': formControls.confirmPassword.touched && formControls.confirmPassword.valid\n , 'is-invalid': formControls.confirmPassword.touched && formControls.confirmPassword.errors}\" required/>\n <div *ngIf=\"formControls.confirmPassword.touched && formControls.confirmPassword.errors\" class=\"invalid-feedback\">\n <div *ngIf=\"formControls.confirmPassword.errors.required\">Your new password confirmation is required</div>\n <div *ngIf=\"formControls.confirmPassword.errors.minlength\">Your new password confirmation is required to be at least 4 characters</div>\n <div *ngIf=\"formControls.confirmPassword.errors.mustMatch\">Your password and confirmation password must match</div>\n </div>\n </div>\n </div>\n\n <div class=\"row pt-3 mt-1\">\n <div class=\"col-12\">\n <div class=\"text-right\">\n <button class=\"btn btn-space btn-secondary\" type=\"button\" (click)=\"reset()\">Reset</button>\n <button class=\"btn btn-space btn-primary\" type=\"submit\" [disabled]=\"form.invalid\">Submit</button>\n </div>\n </div>\n </div>\n </form>\n </div>\n </div>\n </valtimo-widget>\n </div>\n </div>\n</div>\n","styles":[""]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/forms","name":"FormBuilder","line":36,"character":25},{"__symbolic":"reference","module":"@valtimo/components","name":"AlertService","line":37,"character":26}]}],"ngOnInit":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"initData":[{"__symbolic":"method"}],"setValues":[{"__symbolic":"method"}],"createFormGroup":[{"__symbolic":"method"}],"mustMatch":[{"__symbolic":"method"}],"onSubmit":[{"__symbolic":"method"}],"reset":[{"__symbolic":"method"}]}},"AccountModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":24,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"ProfileComponent"},{"__symbolic":"reference","name":"PasswordComponent"}],"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":27,"character":4},{"__symbolic":"reference","name":"ɵa"},{"__symbolic":"reference","module":"@valtimo/components","name":"WidgetModule","line":29,"character":4},{"__symbolic":"reference","module":"@valtimo/components","name":"ListModule","line":30,"character":4},{"__symbolic":"reference","module":"@valtimo/components","name":"FieldAutoFocusModule","line":31,"character":4},{"__symbolic":"reference","module":"@angular/forms","name":"FormsModule","line":32,"character":4},{"__symbolic":"reference","module":"@angular/forms","name":"ReactiveFormsModule","line":33,"character":4},{"__symbolic":"reference","module":"@valtimo/components","name":"UploaderModule","line":34,"character":4},{"__symbolic":"reference","module":"@valtimo/components","name":"AlertModule","line":35,"character":4}],"exports":[{"__symbolic":"reference","name":"ProfileComponent"},{"__symbolic":"reference","name":"PasswordComponent"}],"providers":[]}]}],"members":{}},"accountInitializer":{"__symbolic":"function","parameters":["translate","logger"],"value":{"__symbolic":"error","message":"Lambda not supported","line":23,"character":9,"module":"./lib/account.init"}},"ɵa":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":39,"character":1},"arguments":[{"declarations":[],"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":42,"character":4},{"__symbolic":"call","expression":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/router","name":"RouterModule","line":43,"character":4},"member":"forChild"},"arguments":[[{"path":"profile","component":{"__symbolic":"reference","name":"ProfileComponent"},"canActivate":[{"__symbolic":"reference","module":"@valtimo/security","name":"AuthGuardService","line":28,"character":18}],"data":{"title":"Profile","roles":[{"__symbolic":"reference","module":"@valtimo/contract","name":"ROLE_USER","line":29,"character":37}]}},{"path":"password","component":{"__symbolic":"reference","name":"PasswordComponent"},"canActivate":[{"__symbolic":"reference","module":"@valtimo/security","name":"AuthGuardService","line":34,"character":18}],"data":{"title":"Password","roles":[{"__symbolic":"reference","module":"@valtimo/contract","name":"ROLE_USER","line":35,"character":38}]}}]]}],"exports":[{"__symbolic":"reference","module":"@angular/router","name":"RouterModule","line":45,"character":12}]}]}],"members":{}}},"origins":{"ProfileComponent":"./lib/profile/profile.component","PasswordComponent":"./lib/password/password.component","AccountModule":"./lib/account.module","accountInitializer":"./lib/account.init","ɵa":"./lib/account-routing.module"},"importAs":"@valtimo/account"}