@valtimo/account 4.15.2 → 4.16.0-next-main.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/valtimo-account.umd.js +53 -43
- package/bundles/valtimo-account.umd.js.map +1 -1
- package/bundles/valtimo-account.umd.min.js +1 -1
- package/bundles/valtimo-account.umd.min.js.map +1 -1
- package/esm2015/lib/account-routing.module.js +7 -10
- package/esm2015/lib/account.init.js +2 -2
- package/esm2015/lib/account.module.js +16 -4
- package/esm2015/lib/password/password.component.js +20 -16
- package/esm2015/lib/profile/profile.component.js +14 -13
- package/esm2015/public_api.js +1 -1
- package/esm2015/valtimo-account.js +1 -1
- package/fesm2015/valtimo-account.js +51 -40
- package/fesm2015/valtimo-account.js.map +1 -1
- package/lib/profile/profile.component.d.ts +3 -1
- package/package.json +1 -4
- package/valtimo-account.metadata.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
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('@angular/router'), require('@angular/common'), require('@valtimo/security'), require('@valtimo/
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@valtimo/account', ['exports', '@angular/core', '@angular/forms', '@valtimo/components', 'moment', '@angular/router', '@angular/common', '@valtimo/security', '@valtimo/
|
|
4
|
-
(global = global || self, factory((global.valtimo = global.valtimo || {}, global.valtimo.account = {}), global.ng.core, global.ng.forms, global.components, global.moment, global.ng.router, global.ng.common, global.security, global.
|
|
5
|
-
}(this, (function (exports, core, forms, components, momentImported, router, common, security,
|
|
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
6
|
|
|
7
7
|
/*
|
|
8
8
|
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
@@ -22,11 +22,10 @@
|
|
|
22
22
|
var moment = momentImported;
|
|
23
23
|
moment.locale(localStorage.getItem('langKey'));
|
|
24
24
|
var ProfileComponent = /** @class */ (function () {
|
|
25
|
-
function ProfileComponent(formBuilder, alertService
|
|
26
|
-
// private userProviderService: UserProviderService
|
|
27
|
-
) {
|
|
25
|
+
function ProfileComponent(formBuilder, alertService, translate) {
|
|
28
26
|
this.formBuilder = formBuilder;
|
|
29
27
|
this.alertService = alertService;
|
|
28
|
+
this.translate = translate;
|
|
30
29
|
this.resourceIds = [];
|
|
31
30
|
}
|
|
32
31
|
ProfileComponent.prototype.ngOnInit = function () {
|
|
@@ -44,9 +43,9 @@
|
|
|
44
43
|
});
|
|
45
44
|
ProfileComponent.prototype.initData = function () {
|
|
46
45
|
/* this.userProviderService.getUserIdentity().subscribe(value => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
this.profile = value;
|
|
47
|
+
this.setValues();
|
|
48
|
+
});*/
|
|
50
49
|
};
|
|
51
50
|
ProfileComponent.prototype.setValues = function () {
|
|
52
51
|
if (this.profile) {
|
|
@@ -54,7 +53,7 @@
|
|
|
54
53
|
this.profile.humanize_dates = {
|
|
55
54
|
created_at: moment(this.profile.created_at).fromNow(),
|
|
56
55
|
updated_at: moment(this.profile.updated_at).fromNow(),
|
|
57
|
-
last_password_reset: moment(this.profile.last_password_reset).fromNow()
|
|
56
|
+
last_password_reset: moment(this.profile.last_password_reset).fromNow(),
|
|
58
57
|
};
|
|
59
58
|
// set form values
|
|
60
59
|
this.form.controls.firstName.setValue(this.profile.user_metadata.firstname);
|
|
@@ -66,7 +65,7 @@
|
|
|
66
65
|
return this.formBuilder.group({
|
|
67
66
|
firstName: new forms.FormControl('', forms.Validators.required),
|
|
68
67
|
lastName: new forms.FormControl('', forms.Validators.required),
|
|
69
|
-
langKey: new forms.FormControl('', forms.Validators.required)
|
|
68
|
+
langKey: new forms.FormControl('', forms.Validators.required),
|
|
70
69
|
});
|
|
71
70
|
};
|
|
72
71
|
ProfileComponent.prototype.onFileUpload = function (resources) {
|
|
@@ -76,8 +75,8 @@
|
|
|
76
75
|
this.form.value.email = this.profile.email;
|
|
77
76
|
// TODO Updating profile ?? allowed when using keycloak
|
|
78
77
|
/* this.userService.updateProfile(this.form.value).subscribe(() => {
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
this.alertService.success('Profile has been updated');
|
|
79
|
+
});*/
|
|
81
80
|
};
|
|
82
81
|
ProfileComponent.prototype.reset = function () {
|
|
83
82
|
this.form = this.createFormGroup();
|
|
@@ -88,13 +87,14 @@
|
|
|
88
87
|
ProfileComponent.decorators = [
|
|
89
88
|
{ type: core.Component, args: [{
|
|
90
89
|
selector: 'valtimo-profile',
|
|
91
|
-
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
|
|
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",
|
|
92
91
|
styles: [""]
|
|
93
92
|
},] }
|
|
94
93
|
];
|
|
95
94
|
ProfileComponent.ctorParameters = function () { return [
|
|
96
95
|
{ type: forms.FormBuilder },
|
|
97
|
-
{ type: components.AlertService }
|
|
96
|
+
{ type: components.AlertService },
|
|
97
|
+
{ type: core$1.TranslateService }
|
|
98
98
|
]; };
|
|
99
99
|
|
|
100
100
|
/*
|
|
@@ -134,9 +134,9 @@
|
|
|
134
134
|
});
|
|
135
135
|
PasswordComponent.prototype.initData = function () {
|
|
136
136
|
/* this.userService.getUserIdentity().subscribe(value => {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
this.profile = value;
|
|
138
|
+
this.setValues();
|
|
139
|
+
});*/
|
|
140
140
|
};
|
|
141
141
|
PasswordComponent.prototype.setValues = function () {
|
|
142
142
|
if (this.profile) {
|
|
@@ -144,20 +144,24 @@
|
|
|
144
144
|
this.profile.humanize_dates = {
|
|
145
145
|
created_at: moment$1(this.profile.created_at).fromNow(),
|
|
146
146
|
updated_at: moment$1(this.profile.updated_at).fromNow(),
|
|
147
|
-
last_password_reset: moment$1(this.profile.last_password_reset).fromNow()
|
|
147
|
+
last_password_reset: moment$1(this.profile.last_password_reset).fromNow(),
|
|
148
148
|
};
|
|
149
149
|
}
|
|
150
150
|
};
|
|
151
151
|
PasswordComponent.prototype.createFormGroup = function () {
|
|
152
152
|
return this.formBuilder.group({
|
|
153
|
-
password: new forms.FormControl('', [
|
|
153
|
+
password: new forms.FormControl('', [
|
|
154
|
+
forms.Validators.required,
|
|
154
155
|
forms.Validators.pattern('(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[$@$!%*?&]).{4,}'),
|
|
155
|
-
forms.Validators.maxLength(50)
|
|
156
|
-
|
|
156
|
+
forms.Validators.maxLength(50),
|
|
157
|
+
]),
|
|
158
|
+
confirmPassword: new forms.FormControl('', [
|
|
159
|
+
forms.Validators.required,
|
|
157
160
|
forms.Validators.minLength(4),
|
|
158
|
-
forms.Validators.maxLength(50)
|
|
161
|
+
forms.Validators.maxLength(50),
|
|
162
|
+
]),
|
|
159
163
|
}, {
|
|
160
|
-
validator: this.mustMatch('password', 'confirmPassword')
|
|
164
|
+
validator: this.mustMatch('password', 'confirmPassword'),
|
|
161
165
|
});
|
|
162
166
|
};
|
|
163
167
|
PasswordComponent.prototype.mustMatch = function (controlName, matchingControlName) {
|
|
@@ -177,11 +181,11 @@
|
|
|
177
181
|
};
|
|
178
182
|
PasswordComponent.prototype.onSubmit = function () {
|
|
179
183
|
/* this.userService.changePassword(this.form.value.password).subscribe(() => {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
184
|
+
this.alertService.success('Password has been changed');
|
|
185
|
+
}, result => {
|
|
186
|
+
this.errorMsg = result.error.detail.split(': ', 2)[1];
|
|
187
|
+
this.reset();
|
|
188
|
+
});*/
|
|
185
189
|
};
|
|
186
190
|
PasswordComponent.prototype.reset = function () {
|
|
187
191
|
this.form = this.createFormGroup();
|
|
@@ -192,7 +196,7 @@
|
|
|
192
196
|
PasswordComponent.decorators = [
|
|
193
197
|
{ type: core.Component, args: [{
|
|
194
198
|
selector: 'valtimo-password',
|
|
195
|
-
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\"
|
|
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",
|
|
196
200
|
styles: [""]
|
|
197
201
|
},] }
|
|
198
202
|
];
|
|
@@ -216,20 +220,20 @@
|
|
|
216
220
|
* See the License for the specific language governing permissions and
|
|
217
221
|
* limitations under the License.
|
|
218
222
|
*/
|
|
219
|
-
var ɵ0 = { title: 'Profile', roles: [
|
|
223
|
+
var ɵ0 = { title: 'Profile', roles: [config.ROLE_USER] }, ɵ1 = { title: 'Password', roles: [config.ROLE_USER] };
|
|
220
224
|
var routes = [
|
|
221
225
|
{
|
|
222
226
|
path: 'profile',
|
|
223
227
|
component: ProfileComponent,
|
|
224
228
|
canActivate: [security.AuthGuardService],
|
|
225
|
-
data: ɵ0
|
|
229
|
+
data: ɵ0,
|
|
226
230
|
},
|
|
227
231
|
{
|
|
228
232
|
path: 'password',
|
|
229
233
|
component: PasswordComponent,
|
|
230
234
|
canActivate: [security.AuthGuardService],
|
|
231
|
-
data: ɵ1
|
|
232
|
-
}
|
|
235
|
+
data: ɵ1,
|
|
236
|
+
},
|
|
233
237
|
];
|
|
234
238
|
var AccountRoutingModule = /** @class */ (function () {
|
|
235
239
|
function AccountRoutingModule() {
|
|
@@ -239,11 +243,8 @@
|
|
|
239
243
|
AccountRoutingModule.decorators = [
|
|
240
244
|
{ type: core.NgModule, args: [{
|
|
241
245
|
declarations: [],
|
|
242
|
-
imports: [
|
|
243
|
-
|
|
244
|
-
router.RouterModule.forChild(routes)
|
|
245
|
-
],
|
|
246
|
-
exports: [router.RouterModule]
|
|
246
|
+
imports: [common.CommonModule, router.RouterModule.forChild(routes)],
|
|
247
|
+
exports: [router.RouterModule],
|
|
247
248
|
},] }
|
|
248
249
|
];
|
|
249
250
|
|
|
@@ -262,6 +263,7 @@
|
|
|
262
263
|
* See the License for the specific language governing permissions and
|
|
263
264
|
* limitations under the License.
|
|
264
265
|
*/
|
|
266
|
+
var ɵ0$1 = config.HttpLoaderFactory;
|
|
265
267
|
var AccountModule = /** @class */ (function () {
|
|
266
268
|
function AccountModule() {
|
|
267
269
|
}
|
|
@@ -277,12 +279,19 @@
|
|
|
277
279
|
components.ListModule,
|
|
278
280
|
components.FieldAutoFocusModule,
|
|
279
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
|
+
}),
|
|
280
289
|
forms.ReactiveFormsModule,
|
|
281
290
|
components.UploaderModule,
|
|
282
|
-
components.AlertModule
|
|
291
|
+
components.AlertModule,
|
|
283
292
|
],
|
|
284
293
|
exports: [ProfileComponent, PasswordComponent],
|
|
285
|
-
providers: []
|
|
294
|
+
providers: [],
|
|
286
295
|
},] }
|
|
287
296
|
];
|
|
288
297
|
|
|
@@ -306,7 +315,7 @@
|
|
|
306
315
|
return new Promise(function (resolve, reject) {
|
|
307
316
|
try {
|
|
308
317
|
logger.debug('Account initializer');
|
|
309
|
-
translate.addLangs(['en', 'nl']);
|
|
318
|
+
translate.addLangs(['en', 'nl', 'de']);
|
|
310
319
|
var langKey = localStorage.getItem('langKey');
|
|
311
320
|
if (langKey === null) {
|
|
312
321
|
langKey = 'nl';
|
|
@@ -348,6 +357,7 @@
|
|
|
348
357
|
exports.PasswordComponent = PasswordComponent;
|
|
349
358
|
exports.ProfileComponent = ProfileComponent;
|
|
350
359
|
exports.accountInitializer = accountInitializer;
|
|
360
|
+
exports.ɵ0 = ɵ0$1;
|
|
351
361
|
exports.ɵa = AccountRoutingModule;
|
|
352
362
|
|
|
353
363
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
@@ -1 +1 @@
|
|
|
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';\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":["FormControl","Validators","Component","FormBuilder","AlertService","moment","ROLE_USER","AuthGuardService","NgModule","CommonModule","RouterModule","WidgetModule","ListModule","FieldAutoFocusModule","FormsModule","ReactiveFormsModule","UploaderModule","AlertModule"],"mappings":";;;;;;IAAA;;;;;;;;;;;;;;;IAqBA,IAAM,MAAM,GAAG,cAAc,CAAC;IAC9B,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;;QAa7C,0BACU,WAAwB,EACxB,YAA0B;;;YAD1B,gBAAW,GAAX,WAAW,CAAa;YACxB,iBAAY,GAAZ,YAAY,CAAc;YAJ7B,gBAAW,GAAe,EAAE,CAAC;SAM/B;QAEL,mCAAQ,GAAR;YACE,IAAI,CAAC,KAAK,EAAE,CAAC;SACd;QAED,sCAAW,GAAX;YACE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AO,EAAE,CAAC,gBAAgB,EAAE,iBAAiB,CAAC;oBAC9C,SAAS,EAAE,EAAE;iBACd;;;ICvCD;;;;;;;;;;;;;;;aAmBgB,kBAAkB,CAChC,SAA2B,EAC3B,MAAiB;QAEjB,OAAO;YACL,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;gBACjC,IAAI;oBACF,MAAM,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;oBACpC,SAAS,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;oBACjC,IAAI,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;oBAC9C,IAAI,OAAO,KAAK,IAAI,EAAE;wBACpB,OAAO,GAAG,IAAI,CAAC;wBACf,YAAY,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;qBACvC;oBACD,MAAM,CAAC,KAAK,CAAC,eAAe,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
|
+
{"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","ReactiveFormsModule","UploaderModule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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 +1,2 @@
|
|
|
1
|
-
!function(o,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("@angular/core"),require("@angular/forms"),require("@valtimo/components"),require("moment"),require("@angular/router"),require("@angular/common"),require("@valtimo/security"),require("@valtimo/contract")):"function"==typeof define&&define.amd?define("@valtimo/account",["exports","@angular/core","@angular/forms","@valtimo/components","moment","@angular/router","@angular/common","@valtimo/security","@valtimo/contract"],r):r(((o=o||self).valtimo=o.valtimo||{},o.valtimo.account={}),o.ng.core,o.ng.forms,o.components,o.moment,o.ng.router,o.ng.common,o.security,o.contract)}(this,(function(o,r,e,t,n,s,i,a,l){"use strict";var d=n;d.locale(localStorage.getItem("langKey"));var c=function(){function o(o,r){this.formBuilder=o,this.alertService=r,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:d(this.profile.created_at).fromNow(),updated_at:d(this.profile.updated_at).fromNow(),last_password_reset:d(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}();c.decorators=[{type:r.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 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:[""]}]}],c.ctorParameters=function(){return[{type:e.FormBuilder},{type:t.AlertService}]};var m=n;m.locale(localStorage.getItem("langKey"));var u=function(){function o(o,r){this.formBuilder=o,this.alertService=r}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()})},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,r){return function(e){var t=e.controls[o],n=e.controls[r];n.errors&&!n.errors.mustMatch||(t.value!==n.value?n.setErrors({mustMatch:!0}):n.setErrors(null))}},o.prototype.onSubmit=function(){},o.prototype.reset=function(){this.form=this.createFormGroup(),this.initData()},o}();u.decorators=[{type:r.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"><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:[""]}]}],u.ctorParameters=function(){return[{type:e.FormBuilder},{type:t.AlertService}]};var f={title:"Profile",roles:[l.ROLE_USER]},p={title:"Password",roles:[l.ROLE_USER]},v=[{path:"profile",component:c,canActivate:[a.AuthGuardService],data:f},{path:"password",component:u,canActivate:[a.AuthGuardService],data:p}],g=function(){};g.decorators=[{type:r.NgModule,args:[{declarations:[],imports:[i.CommonModule,s.RouterModule.forChild(v)],exports:[s.RouterModule]}]}];var h=function(){};h.decorators=[{type:r.NgModule,args:[{declarations:[c,u],imports:[i.CommonModule,g,t.WidgetModule,t.ListModule,t.FieldAutoFocusModule,e.FormsModule,e.ReactiveFormsModule,t.UploaderModule,t.AlertModule],exports:[c,u],providers:[]}]}],o.AccountModule=h,o.PasswordComponent=u,o.ProfileComponent=c,o.accountInitializer=function(o,r){return function(){return new Promise((function(e,t){try{r.debug("Account initializer"),o.addLangs(["en","nl"]);var n=localStorage.getItem("langKey");null===n&&(n="nl",localStorage.setItem("langKey","nl")),r.debug("Using langKey",n),o.use(n),e()}catch(o){r.debug("Account initializer error",o),t(o)}}))}},o.ɵa=g,Object.defineProperty(o,"__esModule",{value:!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
2
|
//# sourceMappingURL=valtimo-account.umd.min.js.map
|
|
@@ -1 +1 @@
|
|
|
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","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","PasswordComponent","password","pattern","maxLength","confirmPassword","minLength","validator","mustMatch","controlName","matchingControlName","formGroup","control","matchingControl","errors","setErrors","title","roles","ROLE_USER","ɵ1","routes","path","component","canActivate","AuthGuardService","data","ɵ0","NgModule","declarations","imports","CommonModule","RouterModule","forChild","exports","AccountRoutingModule","WidgetModule","ListModule","FieldAutoFocusModule","FormsModule","ReactiveFormsModule","UploaderModule","AlertModule","providers","transl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AOI,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';\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"]}
|
|
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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AaC,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"]}
|