@valtimo/account 4.23.0 → 5.2.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.
Files changed (40) hide show
  1. package/esm2020/lib/account-routing.module.mjs +52 -0
  2. package/esm2020/lib/account.init.mjs +36 -0
  3. package/esm2020/lib/account.module.mjs +83 -0
  4. package/esm2020/lib/password/password.component.mjs +104 -0
  5. package/esm2020/lib/profile/profile.component.mjs +89 -0
  6. package/esm2020/public_api.mjs +23 -0
  7. package/esm2020/valtimo-account.mjs +5 -0
  8. package/fesm2015/valtimo-account.mjs +367 -0
  9. package/fesm2015/valtimo-account.mjs.map +1 -0
  10. package/fesm2020/valtimo-account.mjs +367 -0
  11. package/fesm2020/valtimo-account.mjs.map +1 -0
  12. package/lib/account-routing.module.d.ts +7 -0
  13. package/lib/account-routing.module.d.ts.map +1 -0
  14. package/lib/account.init.d.ts +1 -0
  15. package/lib/account.init.d.ts.map +1 -0
  16. package/lib/account.module.d.ts +12 -0
  17. package/lib/account.module.d.ts.map +1 -0
  18. package/lib/password/password.component.d.ts +4 -0
  19. package/lib/password/password.component.d.ts.map +1 -0
  20. package/lib/profile/profile.component.d.ts +4 -0
  21. package/lib/profile/profile.component.d.ts.map +1 -0
  22. package/package.json +23 -11
  23. package/public_api.d.ts +1 -0
  24. package/public_api.d.ts.map +1 -0
  25. package/valtimo-account.d.ts +2 -1
  26. package/valtimo-account.d.ts.map +1 -0
  27. package/bundles/valtimo-account.umd.js +0 -366
  28. package/bundles/valtimo-account.umd.js.map +0 -1
  29. package/bundles/valtimo-account.umd.min.js +0 -2
  30. package/bundles/valtimo-account.umd.min.js.map +0 -1
  31. package/esm2015/lib/account-routing.module.js +0 -48
  32. package/esm2015/lib/account.init.js +0 -38
  33. package/esm2015/lib/account.module.js +0 -55
  34. package/esm2015/lib/password/password.component.js +0 -107
  35. package/esm2015/lib/profile/profile.component.js +0 -93
  36. package/esm2015/public_api.js +0 -23
  37. package/esm2015/valtimo-account.js +0 -6
  38. package/fesm2015/valtimo-account.js +0 -346
  39. package/fesm2015/valtimo-account.js.map +0 -1
  40. package/valtimo-account.metadata.json +0 -1
package/package.json CHANGED
@@ -1,21 +1,33 @@
1
1
  {
2
2
  "name": "@valtimo/account",
3
3
  "license": "EUPL-1.2",
4
- "version": "4.23.0",
4
+ "version": "5.2.0",
5
5
  "peerDependencies": {
6
- "moment": "2.24.0",
7
- "@angular/common": "^10.0.11",
8
- "@angular/core": "^10.0.11"
6
+ "moment": "2.29.1",
7
+ "@angular/common": "^13.2.3",
8
+ "@angular/core": "^13.2.3"
9
9
  },
10
10
  "dependencies": {
11
11
  "tslib": "^2.0.0"
12
12
  },
13
- "main": "bundles/valtimo-account.umd.js",
14
- "module": "fesm2015/valtimo-account.js",
15
- "es2015": "fesm2015/valtimo-account.js",
16
- "esm2015": "esm2015/valtimo-account.js",
17
- "fesm2015": "fesm2015/valtimo-account.js",
13
+ "module": "fesm2015/valtimo-account.mjs",
14
+ "es2020": "fesm2020/valtimo-account.mjs",
15
+ "esm2020": "esm2020/valtimo-account.mjs",
16
+ "fesm2020": "fesm2020/valtimo-account.mjs",
17
+ "fesm2015": "fesm2015/valtimo-account.mjs",
18
18
  "typings": "valtimo-account.d.ts",
19
- "metadata": "valtimo-account.metadata.json",
19
+ "exports": {
20
+ "./package.json": {
21
+ "default": "./package.json"
22
+ },
23
+ ".": {
24
+ "types": "./valtimo-account.d.ts",
25
+ "esm2020": "./esm2020/valtimo-account.mjs",
26
+ "es2020": "./fesm2020/valtimo-account.mjs",
27
+ "es2015": "./fesm2015/valtimo-account.mjs",
28
+ "node": "./fesm2015/valtimo-account.mjs",
29
+ "default": "./fesm2020/valtimo-account.mjs"
30
+ }
31
+ },
20
32
  "sideEffects": false
21
- }
33
+ }
package/public_api.d.ts CHANGED
@@ -2,3 +2,4 @@ export * from './lib/profile/profile.component';
2
2
  export * from './lib/password/password.component';
3
3
  export * from './lib/account.module';
4
4
  export * from './lib/account.init';
5
+ //# sourceMappingURL=public_api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public_api.d.ts","sourceRoot":"","sources":["../../../projects/valtimo/account/src/public_api.ts"],"names":[],"mappings":"AAoBA,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC"}
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * Generated bundle index. Do not edit.
3
3
  */
4
+ /// <amd-module name="@valtimo/account" />
4
5
  export * from './public_api';
5
- export { AccountRoutingModule as ɵa } from './lib/account-routing.module';
6
+ //# sourceMappingURL=valtimo-account.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"valtimo-account.d.ts","sourceRoot":"","sources":["../../../projects/valtimo/account/src/valtimo-account.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,cAAc,cAAc,CAAC"}
@@ -1,366 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/forms'), require('@valtimo/components'), require('moment'), require('@ngx-translate/core'), require('@angular/router'), require('@angular/common'), require('@valtimo/security'), require('@valtimo/config'), require('@angular/common/http')) :
3
- typeof define === 'function' && define.amd ? define('@valtimo/account', ['exports', '@angular/core', '@angular/forms', '@valtimo/components', 'moment', '@ngx-translate/core', '@angular/router', '@angular/common', '@valtimo/security', '@valtimo/config', '@angular/common/http'], factory) :
4
- (global = global || self, factory((global.valtimo = global.valtimo || {}, global.valtimo.account = {}), global.ng.core, global.ng.forms, global.components, global.moment, global.core$1, global.ng.router, global.ng.common, global.security, global.config, global.ng.common.http));
5
- }(this, (function (exports, core, forms, components, momentImported, core$1, router, common, security, config, http) { 'use strict';
6
-
7
- /*
8
- * Copyright 2015-2020 Ritense BV, the Netherlands.
9
- *
10
- * Licensed under EUPL, Version 1.2 (the "License");
11
- * you may not use this file except in compliance with the License.
12
- * You may obtain a copy of the License at
13
- *
14
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
15
- *
16
- * Unless required by applicable law or agreed to in writing, software
17
- * distributed under the License is distributed on an "AS IS" basis,
18
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
- * See the License for the specific language governing permissions and
20
- * limitations under the License.
21
- */
22
- var moment = momentImported;
23
- moment.locale(localStorage.getItem('langKey'));
24
- var ProfileComponent = /** @class */ (function () {
25
- function ProfileComponent(formBuilder, alertService, translate) {
26
- this.formBuilder = formBuilder;
27
- this.alertService = alertService;
28
- this.translate = translate;
29
- this.resourceIds = [];
30
- }
31
- ProfileComponent.prototype.ngOnInit = function () {
32
- this.reset();
33
- };
34
- ProfileComponent.prototype.ngOnDestroy = function () {
35
- location.reload();
36
- };
37
- Object.defineProperty(ProfileComponent.prototype, "formControls", {
38
- get: function () {
39
- return this.form.controls;
40
- },
41
- enumerable: false,
42
- configurable: true
43
- });
44
- ProfileComponent.prototype.initData = function () {
45
- /* this.userProviderService.getUserIdentity().subscribe(value => {
46
- this.profile = value;
47
- this.setValues();
48
- });*/
49
- };
50
- ProfileComponent.prototype.setValues = function () {
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
- ProfileComponent.prototype.createFormGroup = function () {
65
- return this.formBuilder.group({
66
- firstName: new forms.FormControl('', forms.Validators.required),
67
- lastName: new forms.FormControl('', forms.Validators.required),
68
- langKey: new forms.FormControl('', forms.Validators.required),
69
- });
70
- };
71
- ProfileComponent.prototype.onFileUpload = function (resources) {
72
- this.resourceIds = resources.map(function (resource) { return resource.id; });
73
- };
74
- ProfileComponent.prototype.onSubmit = function () {
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
- ProfileComponent.prototype.reset = function () {
82
- this.form = this.createFormGroup();
83
- this.initData();
84
- };
85
- return ProfileComponent;
86
- }());
87
- ProfileComponent.decorators = [
88
- { type: core.Component, args: [{
89
- selector: 'valtimo-profile',
90
- 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\n class=\"badge badge-pill badge-success mb-1 mr-1\"\n *ngFor=\"let role of profile.roles\"\n >{{ role }}</span\n >\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\n class=\"col-12 col-sm-8 col-lg-6\"\n [ngClass]=\"{'text-danger': profile.blocked}\"\n >\n {{ profile.blocked ? 'Blocked' : 'Activated' }}\n </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\">\n {{ profile.humanize_dates.created_at }}\n </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\">\n {{ profile.humanize_dates.updated_at }}\n </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\"\n >First name</label\n >\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <input\n valtimoFieldAutoFocus\n type=\"text\"\n id=\"firstName\"\n formControlName=\"firstName\"\n class=\"form-control\"\n placeholder=\"Your first name\"\n [ngClass]=\"{\n 'is-valid': formControls.firstName.touched && formControls.firstName.valid,\n 'is-invalid': formControls.firstName.touched && formControls.firstName.errors\n }\"\n required\n />\n <div\n *ngIf=\"formControls.firstName.touched && formControls.firstName.errors\"\n class=\"invalid-feedback\"\n >\n <div *ngIf=\"formControls.firstName.errors.required\">\n Your first name is required\n </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\"\n >Last name</label\n >\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <input\n type=\"text\"\n id=\"lastName\"\n formControlName=\"lastName\"\n class=\"form-control\"\n placeholder=\"Your last name\"\n [ngClass]=\"{\n 'is-valid': formControls.lastName.touched && formControls.lastName.valid,\n 'is-invalid': formControls.lastName.touched && formControls.lastName.errors\n }\"\n required\n />\n <div\n *ngIf=\"formControls.lastName.touched && formControls.lastName.errors\"\n class=\"invalid-feedback\"\n >\n <div *ngIf=\"formControls.lastName.errors.required\">\n Your last name is required\n </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\"\n >Language</label\n >\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <select\n id=\"langKey\"\n formControlName=\"langKey\"\n class=\"form-control\"\n [ngClass]=\"{\n 'is-valid': formControls.langKey.touched && formControls.langKey.valid,\n 'is-invalid': formControls.langKey.touched && formControls.langKey.errors\n }\"\n required\n >\n <option\n *ngFor=\"let lang of translate.getLangs()\"\n [value]=\"lang\"\n [selected]=\"lang === translate.currentLang\"\n >\n {{ 'settings.language.options.' + lang | translate }}\n </option>\n </select>\n <div\n *ngIf=\"formControls.langKey.touched && formControls.langKey.errors\"\n class=\"invalid-feedback\"\n >\n <div *ngIf=\"formControls.langKey.errors.required\">\n Your language is required\n </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()\">\n Reset\n </button>\n <button\n class=\"btn btn-space btn-primary\"\n type=\"submit\"\n [disabled]=\"form.invalid\"\n >\n Submit\n </button>\n </div>\n </div>\n </div>\n </form>\n </div>\n </div>\n </valtimo-widget>\n </div>\n </div>\n</div>\n",
91
- styles: [""]
92
- },] }
93
- ];
94
- ProfileComponent.ctorParameters = function () { return [
95
- { type: forms.FormBuilder },
96
- { type: components.AlertService },
97
- { type: core$1.TranslateService }
98
- ]; };
99
-
100
- /*
101
- * Copyright 2015-2020 Ritense BV, the Netherlands.
102
- *
103
- * Licensed under EUPL, Version 1.2 (the "License");
104
- * you may not use this file except in compliance with the License.
105
- * You may obtain a copy of the License at
106
- *
107
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
108
- *
109
- * Unless required by applicable law or agreed to in writing, software
110
- * distributed under the License is distributed on an "AS IS" basis,
111
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
112
- * See the License for the specific language governing permissions and
113
- * limitations under the License.
114
- */
115
- var moment$1 = momentImported;
116
- moment$1.locale(localStorage.getItem('langKey'));
117
- var PasswordComponent = /** @class */ (function () {
118
- function PasswordComponent(formBuilder, alertService) {
119
- this.formBuilder = formBuilder;
120
- this.alertService = alertService;
121
- }
122
- PasswordComponent.prototype.ngOnInit = function () {
123
- this.reset();
124
- };
125
- PasswordComponent.prototype.ngOnDestroy = function () {
126
- location.reload();
127
- };
128
- Object.defineProperty(PasswordComponent.prototype, "formControls", {
129
- get: function () {
130
- return this.form.controls;
131
- },
132
- enumerable: false,
133
- configurable: true
134
- });
135
- PasswordComponent.prototype.initData = function () {
136
- /* this.userService.getUserIdentity().subscribe(value => {
137
- this.profile = value;
138
- this.setValues();
139
- });*/
140
- };
141
- PasswordComponent.prototype.setValues = function () {
142
- if (this.profile) {
143
- // humanize dates
144
- this.profile.humanize_dates = {
145
- created_at: moment$1(this.profile.created_at).fromNow(),
146
- updated_at: moment$1(this.profile.updated_at).fromNow(),
147
- last_password_reset: moment$1(this.profile.last_password_reset).fromNow(),
148
- };
149
- }
150
- };
151
- PasswordComponent.prototype.createFormGroup = function () {
152
- return this.formBuilder.group({
153
- password: new forms.FormControl('', [
154
- forms.Validators.required,
155
- forms.Validators.pattern('(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[$@$!%*?&]).{4,}'),
156
- forms.Validators.maxLength(50),
157
- ]),
158
- confirmPassword: new forms.FormControl('', [
159
- forms.Validators.required,
160
- forms.Validators.minLength(4),
161
- forms.Validators.maxLength(50),
162
- ]),
163
- }, {
164
- validator: this.mustMatch('password', 'confirmPassword'),
165
- });
166
- };
167
- PasswordComponent.prototype.mustMatch = function (controlName, matchingControlName) {
168
- return function (formGroup) {
169
- var control = formGroup.controls[controlName];
170
- var matchingControl = formGroup.controls[matchingControlName];
171
- if (matchingControl.errors && !matchingControl.errors.mustMatch) {
172
- return;
173
- }
174
- if (control.value !== matchingControl.value) {
175
- matchingControl.setErrors({ mustMatch: true });
176
- }
177
- else {
178
- matchingControl.setErrors(null);
179
- }
180
- };
181
- };
182
- PasswordComponent.prototype.onSubmit = function () {
183
- /* this.userService.changePassword(this.form.value.password).subscribe(() => {
184
- this.alertService.success('Password has been changed');
185
- }, result => {
186
- this.errorMsg = result.error.detail.split(': ', 2)[1];
187
- this.reset();
188
- });*/
189
- };
190
- PasswordComponent.prototype.reset = function () {
191
- this.form = this.createFormGroup();
192
- this.initData();
193
- };
194
- return PasswordComponent;
195
- }());
196
- PasswordComponent.decorators = [
197
- { type: core.Component, args: [{
198
- selector: 'valtimo-password',
199
- 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\">\n <strong>Last password changed</strong>\n </div>\n <div class=\"col-12 col-sm-8 col-lg-6\">\n {{ profile.humanize_dates.last_password_reset }}\n </div>\n </div>\n </div>\n </div>\n </div>\n <div *ngIf=\"errorMsg\" 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\"\n >New password</label\n >\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <input\n valtimoFieldAutoFocus\n type=\"password\"\n id=\"password\"\n minlength=\"4\"\n maxlength=\"50\"\n formControlName=\"password\"\n class=\"form-control\"\n placeholder=\"Your new password\"\n [ngClass]=\"{\n 'is-valid': formControls.password.touched && formControls.password.valid,\n 'is-invalid': formControls.password.touched && formControls.password.errors\n }\"\n required\n />\n <div\n *ngIf=\"formControls.password.touched && formControls.password.errors\"\n class=\"invalid-feedback\"\n >\n <div *ngIf=\"formControls.password.errors.required\">\n Your password is required\n </div>\n <div *ngIf=\"formControls.password.errors.pattern\">\n It expects at least 1 lowercase letter, 1 uppercase letter, 1 digit and 1\n special characters. The length should be greater than 4 characters. The\n sequence of the characters is not important.\n </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\"\n >New password confirmation</label\n >\n <div class=\"col-12 col-sm-8 col-lg-6\">\n <input\n type=\"password\"\n id=\"confirmPassword\"\n minlength=\"4\"\n maxlength=\"50\"\n formControlName=\"confirmPassword\"\n class=\"form-control\"\n placeholder=\"Your new password confirmation\"\n [ngClass]=\"{\n 'is-valid':\n formControls.confirmPassword.touched && formControls.confirmPassword.valid,\n 'is-invalid':\n formControls.confirmPassword.touched && formControls.confirmPassword.errors\n }\"\n required\n />\n <div\n *ngIf=\"\n formControls.confirmPassword.touched && formControls.confirmPassword.errors\n \"\n class=\"invalid-feedback\"\n >\n <div *ngIf=\"formControls.confirmPassword.errors.required\">\n Your new password confirmation is required\n </div>\n <div *ngIf=\"formControls.confirmPassword.errors.minlength\">\n Your new password confirmation is required to be at least 4 characters\n </div>\n <div *ngIf=\"formControls.confirmPassword.errors.mustMatch\">\n Your password and confirmation password must match\n </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()\">\n Reset\n </button>\n <button\n class=\"btn btn-space btn-primary\"\n type=\"submit\"\n [disabled]=\"form.invalid\"\n >\n Submit\n </button>\n </div>\n </div>\n </div>\n </form>\n </div>\n </div>\n </valtimo-widget>\n </div>\n </div>\n</div>\n",
200
- styles: [""]
201
- },] }
202
- ];
203
- PasswordComponent.ctorParameters = function () { return [
204
- { type: forms.FormBuilder },
205
- { type: components.AlertService }
206
- ]; };
207
-
208
- /*
209
- * Copyright 2015-2020 Ritense BV, the Netherlands.
210
- *
211
- * Licensed under EUPL, Version 1.2 (the "License");
212
- * you may not use this file except in compliance with the License.
213
- * You may obtain a copy of the License at
214
- *
215
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
216
- *
217
- * Unless required by applicable law or agreed to in writing, software
218
- * distributed under the License is distributed on an "AS IS" basis,
219
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
220
- * See the License for the specific language governing permissions and
221
- * limitations under the License.
222
- */
223
- var ɵ0 = { title: 'Profile', roles: [config.ROLE_USER] }, ɵ1 = { title: 'Password', roles: [config.ROLE_USER] };
224
- var routes = [
225
- {
226
- path: 'profile',
227
- component: ProfileComponent,
228
- canActivate: [security.AuthGuardService],
229
- data: ɵ0,
230
- },
231
- {
232
- path: 'password',
233
- component: PasswordComponent,
234
- canActivate: [security.AuthGuardService],
235
- data: ɵ1,
236
- },
237
- ];
238
- var AccountRoutingModule = /** @class */ (function () {
239
- function AccountRoutingModule() {
240
- }
241
- return AccountRoutingModule;
242
- }());
243
- AccountRoutingModule.decorators = [
244
- { type: core.NgModule, args: [{
245
- declarations: [],
246
- imports: [common.CommonModule, router.RouterModule.forChild(routes)],
247
- exports: [router.RouterModule],
248
- },] }
249
- ];
250
-
251
- /*
252
- * Copyright 2015-2020 Ritense BV, the Netherlands.
253
- *
254
- * Licensed under EUPL, Version 1.2 (the "License");
255
- * you may not use this file except in compliance with the License.
256
- * You may obtain a copy of the License at
257
- *
258
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
259
- *
260
- * Unless required by applicable law or agreed to in writing, software
261
- * distributed under the License is distributed on an "AS IS" basis,
262
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
263
- * See the License for the specific language governing permissions and
264
- * limitations under the License.
265
- */
266
- var ɵ0$1 = config.HttpLoaderFactory;
267
- var AccountModule = /** @class */ (function () {
268
- function AccountModule() {
269
- }
270
- return AccountModule;
271
- }());
272
- AccountModule.decorators = [
273
- { type: core.NgModule, args: [{
274
- declarations: [ProfileComponent, PasswordComponent],
275
- imports: [
276
- common.CommonModule,
277
- AccountRoutingModule,
278
- components.WidgetModule,
279
- components.ListModule,
280
- components.FieldAutoFocusModule,
281
- forms.FormsModule,
282
- core$1.TranslateModule.forRoot({
283
- loader: {
284
- provide: core$1.TranslateLoader,
285
- useFactory: ɵ0$1,
286
- deps: [http.HttpClient],
287
- },
288
- }),
289
- forms.ReactiveFormsModule,
290
- components.UploaderModule,
291
- components.AlertModule,
292
- ],
293
- exports: [ProfileComponent, PasswordComponent],
294
- providers: [],
295
- },] }
296
- ];
297
-
298
- /*
299
- * Copyright 2015-2020 Ritense BV, the Netherlands.
300
- *
301
- * Licensed under EUPL, Version 1.2 (the "License");
302
- * you may not use this file except in compliance with the License.
303
- * You may obtain a copy of the License at
304
- *
305
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
306
- *
307
- * Unless required by applicable law or agreed to in writing, software
308
- * distributed under the License is distributed on an "AS IS" basis,
309
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
310
- * See the License for the specific language governing permissions and
311
- * limitations under the License.
312
- */
313
- function accountInitializer(translate, logger) {
314
- return function () {
315
- return new Promise(function (resolve, reject) {
316
- try {
317
- logger.debug('Account initializer');
318
- translate.addLangs(['en', 'nl', 'de']);
319
- var langKey = localStorage.getItem('langKey');
320
- if (langKey === null) {
321
- langKey = 'nl';
322
- localStorage.setItem('langKey', 'nl');
323
- }
324
- logger.debug('Using langKey', langKey);
325
- translate.use(langKey);
326
- resolve();
327
- }
328
- catch (error) {
329
- logger.debug('Account initializer error', error);
330
- reject(error);
331
- }
332
- });
333
- };
334
- }
335
-
336
- /*
337
- * Copyright 2015-2020 Ritense BV, the Netherlands.
338
- *
339
- * Licensed under EUPL, Version 1.2 (the "License");
340
- * you may not use this file except in compliance with the License.
341
- * You may obtain a copy of the License at
342
- *
343
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
344
- *
345
- * Unless required by applicable law or agreed to in writing, software
346
- * distributed under the License is distributed on an "AS IS" basis,
347
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
348
- * See the License for the specific language governing permissions and
349
- * limitations under the License.
350
- */
351
-
352
- /**
353
- * Generated bundle index. Do not edit.
354
- */
355
-
356
- exports.AccountModule = AccountModule;
357
- exports.PasswordComponent = PasswordComponent;
358
- exports.ProfileComponent = ProfileComponent;
359
- exports.accountInitializer = accountInitializer;
360
- exports.ɵ0 = ɵ0$1;
361
- exports.ɵa = AccountRoutingModule;
362
-
363
- Object.defineProperty(exports, '__esModule', { value: true });
364
-
365
- })));
366
- //# sourceMappingURL=valtimo-account.umd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"valtimo-account.umd.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';\nimport {TranslateService} from '@ngx-translate/core';\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 public profile: any;\n public form: FormGroup;\n public resourceIds: Array<any> = [];\n\n constructor(\n private formBuilder: FormBuilder,\n private alertService: AlertService,\n public translate: TranslateService\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 * 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 public profile: any;\n public errorMsg: string;\n public form: FormGroup;\n\n constructor(private formBuilder: FormBuilder, private alertService: AlertService) {}\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 {\n password: new FormControl('', [\n Validators.required,\n Validators.pattern('(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[$@$!%*?&]).{4,}'),\n Validators.maxLength(50),\n ]),\n confirmPassword: new FormControl('', [\n Validators.required,\n Validators.minLength(4),\n Validators.maxLength(50),\n ]),\n },\n {\n validator: this.mustMatch('password', 'confirmPassword'),\n }\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 * 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/config';\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: [CommonModule, RouterModule.forChild(routes)],\n exports: [RouterModule],\n})\nexport class AccountRoutingModule {}\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 {\n AlertModule,\n FieldAutoFocusModule,\n ListModule,\n UploaderModule,\n WidgetModule,\n} from '@valtimo/components';\nimport {ProfileComponent} from './profile/profile.component';\nimport {PasswordComponent} from './password/password.component';\nimport {TranslateLoader, TranslateModule} from '@ngx-translate/core';\nimport {HttpLoaderFactory} from '@valtimo/config';\nimport {HttpClient} from '@angular/common/http';\n\n@NgModule({\n declarations: [ProfileComponent, PasswordComponent],\n imports: [\n CommonModule,\n AccountRoutingModule,\n WidgetModule,\n ListModule,\n FieldAutoFocusModule,\n FormsModule,\n TranslateModule.forRoot({\n loader: {\n provide: TranslateLoader,\n useFactory: HttpLoaderFactory,\n deps: [HttpClient],\n },\n }),\n ReactiveFormsModule,\n UploaderModule,\n AlertModule,\n ],\n exports: [ProfileComponent, PasswordComponent],\n providers: [],\n})\nexport class AccountModule {}\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', 'de']);\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 * 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":["FormControl","Validators","Component","FormBuilder","AlertService","TranslateService","moment","ROLE_USER","AuthGuardService","NgModule","CommonModule","RouterModule","HttpLoaderFactory","WidgetModule","ListModule","FieldAutoFocusModule","FormsModule","TranslateModule","TranslateLoader","HttpClient","ReactiveF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,EAAE,OAAO,CAAC,CAAC;oBACvC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;oBACvB,OAAO,EAAE,CAAC;iBACX;gBAAC,OAAO,KAAK,EAAE;oBACd,MAAM,CAAC,KAAK,CAAC,2BAA2B,EAAE,KAAK,CAAC,CAAC;oBACjD,MAAM,CAAC,KAAK,CAAC,CAAC;iBACf;aACF,CAAC,CAAC;SACJ,CAAC;IACJ;;IC1CA;;;;;;;;;;;;;;;;ICAA;;;;;;;;;;;;;;;;;;;"}
@@ -1,2 +0,0 @@
1
- !function(o,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@angular/core"),require("@angular/forms"),require("@valtimo/components"),require("moment"),require("@ngx-translate/core"),require("@angular/router"),require("@angular/common"),require("@valtimo/security"),require("@valtimo/config"),require("@angular/common/http")):"function"==typeof define&&define.amd?define("@valtimo/account",["exports","@angular/core","@angular/forms","@valtimo/components","moment","@ngx-translate/core","@angular/router","@angular/common","@valtimo/security","@valtimo/config","@angular/common/http"],n):n(((o=o||self).valtimo=o.valtimo||{},o.valtimo.account={}),o.ng.core,o.ng.forms,o.components,o.moment,o.core$1,o.ng.router,o.ng.common,o.security,o.config,o.ng.common.http)}(this,(function(o,n,e,r,t,s,i,a,l,d,c){"use strict";var m=t;m.locale(localStorage.getItem("langKey"));var u=function(){function o(o,n,e){this.formBuilder=o,this.alertService=n,this.translate=e,this.resourceIds=[]}return o.prototype.ngOnInit=function(){this.reset()},o.prototype.ngOnDestroy=function(){location.reload()},Object.defineProperty(o.prototype,"formControls",{get:function(){return this.form.controls},enumerable:!1,configurable:!0}),o.prototype.initData=function(){},o.prototype.setValues=function(){this.profile&&(this.profile.humanize_dates={created_at:m(this.profile.created_at).fromNow(),updated_at:m(this.profile.updated_at).fromNow(),last_password_reset:m(this.profile.last_password_reset).fromNow()},this.form.controls.firstName.setValue(this.profile.user_metadata.firstname),this.form.controls.lastName.setValue(this.profile.user_metadata.lastname),this.form.controls.langKey.setValue(this.profile.user_metadata.langKey))},o.prototype.createFormGroup=function(){return this.formBuilder.group({firstName:new e.FormControl("",e.Validators.required),lastName:new e.FormControl("",e.Validators.required),langKey:new e.FormControl("",e.Validators.required)})},o.prototype.onFileUpload=function(o){this.resourceIds=o.map((function(o){return o.id}))},o.prototype.onSubmit=function(){this.form.value.email=this.profile.email},o.prototype.reset=function(){this.form=this.createFormGroup(),this.initData()},o}();u.decorators=[{type:n.Component,args:[{selector:"valtimo-profile",template:'\x3c!--\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 --\x3e\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\n class="badge badge-pill badge-success mb-1 mr-1"\n *ngFor="let role of profile.roles"\n >{{ role }}</span\n >\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\n class="col-12 col-sm-8 col-lg-6"\n [ngClass]="{\'text-danger\': profile.blocked}"\n >\n {{ profile.blocked ? \'Blocked\' : \'Activated\' }}\n </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">\n {{ profile.humanize_dates.created_at }}\n </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">\n {{ profile.humanize_dates.updated_at }}\n </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"\n >First name</label\n >\n <div class="col-12 col-sm-8 col-lg-6">\n <input\n valtimoFieldAutoFocus\n type="text"\n id="firstName"\n formControlName="firstName"\n class="form-control"\n placeholder="Your first name"\n [ngClass]="{\n \'is-valid\': formControls.firstName.touched && formControls.firstName.valid,\n \'is-invalid\': formControls.firstName.touched && formControls.firstName.errors\n }"\n required\n />\n <div\n *ngIf="formControls.firstName.touched && formControls.firstName.errors"\n class="invalid-feedback"\n >\n <div *ngIf="formControls.firstName.errors.required">\n Your first name is required\n </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"\n >Last name</label\n >\n <div class="col-12 col-sm-8 col-lg-6">\n <input\n type="text"\n id="lastName"\n formControlName="lastName"\n class="form-control"\n placeholder="Your last name"\n [ngClass]="{\n \'is-valid\': formControls.lastName.touched && formControls.lastName.valid,\n \'is-invalid\': formControls.lastName.touched && formControls.lastName.errors\n }"\n required\n />\n <div\n *ngIf="formControls.lastName.touched && formControls.lastName.errors"\n class="invalid-feedback"\n >\n <div *ngIf="formControls.lastName.errors.required">\n Your last name is required\n </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"\n >Language</label\n >\n <div class="col-12 col-sm-8 col-lg-6">\n <select\n id="langKey"\n formControlName="langKey"\n class="form-control"\n [ngClass]="{\n \'is-valid\': formControls.langKey.touched && formControls.langKey.valid,\n \'is-invalid\': formControls.langKey.touched && formControls.langKey.errors\n }"\n required\n >\n <option\n *ngFor="let lang of translate.getLangs()"\n [value]="lang"\n [selected]="lang === translate.currentLang"\n >\n {{ \'settings.language.options.\' + lang | translate }}\n </option>\n </select>\n <div\n *ngIf="formControls.langKey.touched && formControls.langKey.errors"\n class="invalid-feedback"\n >\n <div *ngIf="formControls.langKey.errors.required">\n Your language is required\n </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()">\n Reset\n </button>\n <button\n class="btn btn-space btn-primary"\n type="submit"\n [disabled]="form.invalid"\n >\n Submit\n </button>\n </div>\n </div>\n </div>\n </form>\n </div>\n </div>\n </valtimo-widget>\n </div>\n </div>\n</div>\n',styles:[""]}]}],u.ctorParameters=function(){return[{type:e.FormBuilder},{type:r.AlertService},{type:s.TranslateService}]};var f=t;f.locale(localStorage.getItem("langKey"));var p=function(){function o(o,n){this.formBuilder=o,this.alertService=n}return o.prototype.ngOnInit=function(){this.reset()},o.prototype.ngOnDestroy=function(){location.reload()},Object.defineProperty(o.prototype,"formControls",{get:function(){return this.form.controls},enumerable:!1,configurable:!0}),o.prototype.initData=function(){},o.prototype.setValues=function(){this.profile&&(this.profile.humanize_dates={created_at:f(this.profile.created_at).fromNow(),updated_at:f(this.profile.updated_at).fromNow(),last_password_reset:f(this.profile.last_password_reset).fromNow()})},o.prototype.createFormGroup=function(){return this.formBuilder.group({password:new e.FormControl("",[e.Validators.required,e.Validators.pattern("(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[$@$!%*?&]).{4,}"),e.Validators.maxLength(50)]),confirmPassword:new e.FormControl("",[e.Validators.required,e.Validators.minLength(4),e.Validators.maxLength(50)])},{validator:this.mustMatch("password","confirmPassword")})},o.prototype.mustMatch=function(o,n){return function(e){var r=e.controls[o],t=e.controls[n];t.errors&&!t.errors.mustMatch||(r.value!==t.value?t.setErrors({mustMatch:!0}):t.setErrors(null))}},o.prototype.onSubmit=function(){},o.prototype.reset=function(){this.form=this.createFormGroup(),this.initData()},o}();p.decorators=[{type:n.Component,args:[{selector:"valtimo-password",template:'\x3c!--\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 --\x3e\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">\n <strong>Last password changed</strong>\n </div>\n <div class="col-12 col-sm-8 col-lg-6">\n {{ profile.humanize_dates.last_password_reset }}\n </div>\n </div>\n </div>\n </div>\n </div>\n <div *ngIf="errorMsg" 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"\n >New password</label\n >\n <div class="col-12 col-sm-8 col-lg-6">\n <input\n valtimoFieldAutoFocus\n type="password"\n id="password"\n minlength="4"\n maxlength="50"\n formControlName="password"\n class="form-control"\n placeholder="Your new password"\n [ngClass]="{\n \'is-valid\': formControls.password.touched && formControls.password.valid,\n \'is-invalid\': formControls.password.touched && formControls.password.errors\n }"\n required\n />\n <div\n *ngIf="formControls.password.touched && formControls.password.errors"\n class="invalid-feedback"\n >\n <div *ngIf="formControls.password.errors.required">\n Your password is required\n </div>\n <div *ngIf="formControls.password.errors.pattern">\n It expects at least 1 lowercase letter, 1 uppercase letter, 1 digit and 1\n special characters. The length should be greater than 4 characters. The\n sequence of the characters is not important.\n </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"\n >New password confirmation</label\n >\n <div class="col-12 col-sm-8 col-lg-6">\n <input\n type="password"\n id="confirmPassword"\n minlength="4"\n maxlength="50"\n formControlName="confirmPassword"\n class="form-control"\n placeholder="Your new password confirmation"\n [ngClass]="{\n \'is-valid\':\n formControls.confirmPassword.touched && formControls.confirmPassword.valid,\n \'is-invalid\':\n formControls.confirmPassword.touched && formControls.confirmPassword.errors\n }"\n required\n />\n <div\n *ngIf="\n formControls.confirmPassword.touched && formControls.confirmPassword.errors\n "\n class="invalid-feedback"\n >\n <div *ngIf="formControls.confirmPassword.errors.required">\n Your new password confirmation is required\n </div>\n <div *ngIf="formControls.confirmPassword.errors.minlength">\n Your new password confirmation is required to be at least 4 characters\n </div>\n <div *ngIf="formControls.confirmPassword.errors.mustMatch">\n Your password and confirmation password must match\n </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()">\n Reset\n </button>\n <button\n class="btn btn-space btn-primary"\n type="submit"\n [disabled]="form.invalid"\n >\n Submit\n </button>\n </div>\n </div>\n </div>\n </form>\n </div>\n </div>\n </valtimo-widget>\n </div>\n </div>\n</div>\n',styles:[""]}]}],p.ctorParameters=function(){return[{type:e.FormBuilder},{type:r.AlertService}]};var v={title:"Profile",roles:[d.ROLE_USER]},g={title:"Password",roles:[d.ROLE_USER]},h=[{path:"profile",component:u,canActivate:[l.AuthGuardService],data:v},{path:"password",component:p,canActivate:[l.AuthGuardService],data:g}],b=function(){};b.decorators=[{type:n.NgModule,args:[{declarations:[],imports:[a.CommonModule,i.RouterModule.forChild(h)],exports:[i.RouterModule]}]}];var w=d.HttpLoaderFactory,y=function(){};y.decorators=[{type:n.NgModule,args:[{declarations:[u,p],imports:[a.CommonModule,b,r.WidgetModule,r.ListModule,r.FieldAutoFocusModule,e.FormsModule,s.TranslateModule.forRoot({loader:{provide:s.TranslateLoader,useFactory:w,deps:[c.HttpClient]}}),e.ReactiveFormsModule,r.UploaderModule,r.AlertModule],exports:[u,p],providers:[]}]}],o.AccountModule=y,o.PasswordComponent=p,o.ProfileComponent=u,o.accountInitializer=function(o,n){return function(){return new Promise((function(e,r){try{n.debug("Account initializer"),o.addLangs(["en","nl","de"]);var t=localStorage.getItem("langKey");null===t&&(t="nl",localStorage.setItem("langKey","nl")),n.debug("Using langKey",t),o.use(t),e()}catch(o){n.debug("Account initializer error",o),r(o)}}))}},o.ɵ0=w,o.ɵa=b,Object.defineProperty(o,"__esModule",{value:!0})}));
2
- //# sourceMappingURL=valtimo-account.umd.min.js.map
@@ -1 +0,0 @@
1
- {"version":3,"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"],"names":["moment","momentImported","locale","localStorage","getItem","ProfileComponent","formBuilder","alertService","translate","this","resourceIds","prototype","ngOnInit","reset","ngOnDestroy","location","reload","Object","defineProperty","form","controls","initData","setValues","profile","humanize_dates","created_at","fromNow","updated_at","last_password_reset","firstName","setValue","user_metadata","firstname","lastName","lastname","langKey","createFormGroup","group","FormControl","Validators","required","onFileUpload","resources","map","resource","id","onSubmit","value","email","Component","args","selector","template","FormBuilder","AlertService","TranslateService","PasswordComponent","password","pattern","maxLength","confirmPassword","minLength","validator","mustMatch","controlName","matchingControlName","formGroup","control","matchingControl","errors","setErrors","title","roles","ROLE_USER","routes","path","component","canActivate","AuthGuardService","data","NgModule","declarations","imports","CommonModule","RouterModule","forChild","exports","HttpLoaderFactory","AccountRoutingModule","WidgetModule","ListModule","FieldAutoFocusModule","FormsModule","TranslateModule","forRoot","loader","provide","TranslateLoader","useFactory","deps","HttpClient","ReactiveFormsModule","UploaderModule","AlertModule","providers","logger","Promise","resolve","reject","debug","addLangs","setItem","use","error"],"mappings":"u0BAsBA,IAAMA,EAASC,EACfD,EAAOE,OAAOC,aAAaC,QAAQ,6BAYjC,SAAAC,EACUC,EACAC,EACDC,GAFCC,KAAAH,YAAAA,EACAG,KAAAF,aAAAA,EACDE,KAAAD,UAAAA,EALFC,KAAAC,YAA0B,UAQjCL,EAAAM,UAAAC,SAAA,WACEH,KAAKI,SAGPR,EAAAM,UAAAG,YAAA,WACEC,SAASC,UAGXC,OAAAC,eAAIb,EAAAM,UAAA,eAAY,KAAhB,WACE,OAAOF,KAAKU,KAAKC,0CAGXf,EAAAM,UAAAU,SAAA,aAOAhB,EAAAM,UAAAW,UAAA,WACFb,KAAKc,UAEPd,KAAKc,QAAQC,eAAiB,CAC5BC,WAAYzB,EAAOS,KAAKc,QAAQE,YAAYC,UAC5CC,WAAY3B,EAAOS,KAAKc,QAAQI,YAAYD,UAC5CE,oBAAqB5B,EAAOS,KAAKc,QAAQK,qBAAqBF,WAGhEjB,KAAKU,KAAKC,SAASS,UAAUC,SAASrB,KAAKc,QAAQQ,cAAcC,WACjEvB,KAAKU,KAAKC,SAASa,SAASH,SAASrB,KAAKc,QAAQQ,cAAcG,UAChEzB,KAAKU,KAAKC,SAASe,QAAQL,SAASrB,KAAKc,QAAQQ,cAAcI,WAI3D9B,EAAAM,UAAAyB,gBAAA,WACN,OAAO3B,KAAKH,YAAY+B,MAAM,CAC5BR,UAAW,IAAIS,EAAAA,YAAY,GAAIC,EAAAA,WAAWC,UAC1CP,SAAU,IAAI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AAAA,gBACTC,WAAU,EACVC,KAAM,CAACC,EAAAA,eAGXC,EAAAA,oBACAC,EAAAA,eACAC,EAAAA,aAEFjB,QAAS,CAACjF,EAAkBmD,GAC5BgD,UAAW,kGClCXhG,EACAiG,GAEA,OAAO,WACL,OAAO,IAAIC,SAAQ,SAACC,EAASC,GAC3B,IACEH,EAAOI,MAAM,uBACbrG,EAAUsG,SAAS,CAAC,KAAM,KAAM,OAChC,IAAI3E,EAAUhC,aAAaC,QAAQ,WACnB,OAAZ+B,IACFA,EAAU,KACVhC,aAAa4G,QAAQ,UAAW,OAElCN,EAAOI,MAAM,gBAAiB1E,GAC9B3B,EAAUwG,IAAI7E,GACdwE,IACA,MAAOM,GACPR,EAAOI,MAAM,4BAA6BI,GAC1CL,EAAOK","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';\nimport {TranslateService} from '@ngx-translate/core';\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 public profile: any;\n public form: FormGroup;\n public resourceIds: Array<any> = [];\n\n constructor(\n private formBuilder: FormBuilder,\n private alertService: AlertService,\n public translate: TranslateService\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 * 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 public profile: any;\n public errorMsg: string;\n public form: FormGroup;\n\n constructor(private formBuilder: FormBuilder, private alertService: AlertService) {}\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 {\n password: new FormControl('', [\n Validators.required,\n Validators.pattern('(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[$@$!%*?&]).{4,}'),\n Validators.maxLength(50),\n ]),\n confirmPassword: new FormControl('', [\n Validators.required,\n Validators.minLength(4),\n Validators.maxLength(50),\n ]),\n },\n {\n validator: this.mustMatch('password', 'confirmPassword'),\n }\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 * 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/config';\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: [CommonModule, RouterModule.forChild(routes)],\n exports: [RouterModule],\n})\nexport class AccountRoutingModule {}\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 {\n AlertModule,\n FieldAutoFocusModule,\n ListModule,\n UploaderModule,\n WidgetModule,\n} from '@valtimo/components';\nimport {ProfileComponent} from './profile/profile.component';\nimport {PasswordComponent} from './password/password.component';\nimport {TranslateLoader, TranslateModule} from '@ngx-translate/core';\nimport {HttpLoaderFactory} from '@valtimo/config';\nimport {HttpClient} from '@angular/common/http';\n\n@NgModule({\n declarations: [ProfileComponent, PasswordComponent],\n imports: [\n CommonModule,\n AccountRoutingModule,\n WidgetModule,\n ListModule,\n FieldAutoFocusModule,\n FormsModule,\n TranslateModule.forRoot({\n loader: {\n provide: TranslateLoader,\n useFactory: HttpLoaderFactory,\n deps: [HttpClient],\n },\n }),\n ReactiveFormsModule,\n UploaderModule,\n AlertModule,\n ],\n exports: [ProfileComponent, PasswordComponent],\n providers: [],\n})\nexport class AccountModule {}\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', 'de']);\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"]}