@valtimo/account 4.15.2-next-main.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/valtimo-account.umd.js +356 -0
- package/bundles/valtimo-account.umd.js.map +1 -0
- package/bundles/valtimo-account.umd.min.js +2 -0
- package/bundles/valtimo-account.umd.min.js.map +1 -0
- package/esm2015/lib/account-routing.module.js +51 -0
- package/esm2015/lib/account.init.js +38 -0
- package/esm2015/lib/account.module.js +43 -0
- package/esm2015/lib/password/password.component.js +103 -0
- package/esm2015/lib/profile/profile.component.js +92 -0
- package/esm2015/public_api.js +23 -0
- package/esm2015/valtimo-account.js +6 -0
- package/fesm2015/valtimo-account.js +335 -0
- package/fesm2015/valtimo-account.js.map +1 -0
- package/lib/account-routing.module.d.ts +2 -0
- package/lib/account.init.d.ts +3 -0
- package/lib/account.module.d.ts +2 -0
- package/lib/password/password.component.d.ts +22 -0
- package/lib/profile/profile.component.d.ts +22 -0
- package/package.json +23 -0
- package/public_api.d.ts +4 -0
- package/valtimo-account.d.ts +5 -0
- package/valtimo-account.metadata.json +1 -0
|
@@ -0,0 +1,356 @@
|
|
|
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/contract')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@valtimo/account', ['exports', '@angular/core', '@angular/forms', '@valtimo/components', 'moment', '@angular/router', '@angular/common', '@valtimo/security', '@valtimo/contract'], factory) :
|
|
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.contract));
|
|
5
|
+
}(this, (function (exports, core, forms, components, momentImported, router, common, security, contract) { 'use strict';
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
9
|
+
*
|
|
10
|
+
* Licensed under EUPL, Version 1.2 (the "License");
|
|
11
|
+
* you may not use this file except in compliance with the License.
|
|
12
|
+
* You may obtain a copy of the License at
|
|
13
|
+
*
|
|
14
|
+
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
17
|
+
* distributed under the License is distributed on an "AS IS" basis,
|
|
18
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
+
* See the License for the specific language governing permissions and
|
|
20
|
+
* limitations under the License.
|
|
21
|
+
*/
|
|
22
|
+
var moment = momentImported;
|
|
23
|
+
moment.locale(localStorage.getItem('langKey'));
|
|
24
|
+
var ProfileComponent = /** @class */ (function () {
|
|
25
|
+
function ProfileComponent(formBuilder, alertService
|
|
26
|
+
// private userProviderService: UserProviderService
|
|
27
|
+
) {
|
|
28
|
+
this.formBuilder = formBuilder;
|
|
29
|
+
this.alertService = alertService;
|
|
30
|
+
this.resourceIds = [];
|
|
31
|
+
}
|
|
32
|
+
ProfileComponent.prototype.ngOnInit = function () {
|
|
33
|
+
this.reset();
|
|
34
|
+
};
|
|
35
|
+
ProfileComponent.prototype.ngOnDestroy = function () {
|
|
36
|
+
location.reload();
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(ProfileComponent.prototype, "formControls", {
|
|
39
|
+
get: function () {
|
|
40
|
+
return this.form.controls;
|
|
41
|
+
},
|
|
42
|
+
enumerable: false,
|
|
43
|
+
configurable: true
|
|
44
|
+
});
|
|
45
|
+
ProfileComponent.prototype.initData = function () {
|
|
46
|
+
/* this.userProviderService.getUserIdentity().subscribe(value => {
|
|
47
|
+
this.profile = value;
|
|
48
|
+
this.setValues();
|
|
49
|
+
});*/
|
|
50
|
+
};
|
|
51
|
+
ProfileComponent.prototype.setValues = function () {
|
|
52
|
+
if (this.profile) {
|
|
53
|
+
// set humanize dates
|
|
54
|
+
this.profile.humanize_dates = {
|
|
55
|
+
created_at: moment(this.profile.created_at).fromNow(),
|
|
56
|
+
updated_at: moment(this.profile.updated_at).fromNow(),
|
|
57
|
+
last_password_reset: moment(this.profile.last_password_reset).fromNow()
|
|
58
|
+
};
|
|
59
|
+
// set form values
|
|
60
|
+
this.form.controls.firstName.setValue(this.profile.user_metadata.firstname);
|
|
61
|
+
this.form.controls.lastName.setValue(this.profile.user_metadata.lastname);
|
|
62
|
+
this.form.controls.langKey.setValue(this.profile.user_metadata.langKey);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
ProfileComponent.prototype.createFormGroup = function () {
|
|
66
|
+
return this.formBuilder.group({
|
|
67
|
+
firstName: new forms.FormControl('', forms.Validators.required),
|
|
68
|
+
lastName: new forms.FormControl('', forms.Validators.required),
|
|
69
|
+
langKey: new forms.FormControl('', forms.Validators.required)
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
ProfileComponent.prototype.onFileUpload = function (resources) {
|
|
73
|
+
this.resourceIds = resources.map(function (resource) { return resource.id; });
|
|
74
|
+
};
|
|
75
|
+
ProfileComponent.prototype.onSubmit = function () {
|
|
76
|
+
this.form.value.email = this.profile.email;
|
|
77
|
+
// TODO Updating profile ?? allowed when using keycloak
|
|
78
|
+
/* this.userService.updateProfile(this.form.value).subscribe(() => {
|
|
79
|
+
this.alertService.success('Profile has been updated');
|
|
80
|
+
});*/
|
|
81
|
+
};
|
|
82
|
+
ProfileComponent.prototype.reset = function () {
|
|
83
|
+
this.form = this.createFormGroup();
|
|
84
|
+
this.initData();
|
|
85
|
+
};
|
|
86
|
+
return ProfileComponent;
|
|
87
|
+
}());
|
|
88
|
+
ProfileComponent.decorators = [
|
|
89
|
+
{ type: core.Component, args: [{
|
|
90
|
+
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 <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",
|
|
92
|
+
styles: [""]
|
|
93
|
+
},] }
|
|
94
|
+
];
|
|
95
|
+
ProfileComponent.ctorParameters = function () { return [
|
|
96
|
+
{ type: forms.FormBuilder },
|
|
97
|
+
{ type: components.AlertService }
|
|
98
|
+
]; };
|
|
99
|
+
|
|
100
|
+
/*
|
|
101
|
+
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
102
|
+
*
|
|
103
|
+
* Licensed under EUPL, Version 1.2 (the "License");
|
|
104
|
+
* you may not use this file except in compliance with the License.
|
|
105
|
+
* You may obtain a copy of the License at
|
|
106
|
+
*
|
|
107
|
+
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
108
|
+
*
|
|
109
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
110
|
+
* distributed under the License is distributed on an "AS IS" basis,
|
|
111
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
112
|
+
* See the License for the specific language governing permissions and
|
|
113
|
+
* limitations under the License.
|
|
114
|
+
*/
|
|
115
|
+
var moment$1 = momentImported;
|
|
116
|
+
moment$1.locale(localStorage.getItem('langKey'));
|
|
117
|
+
var PasswordComponent = /** @class */ (function () {
|
|
118
|
+
function PasswordComponent(formBuilder, alertService) {
|
|
119
|
+
this.formBuilder = formBuilder;
|
|
120
|
+
this.alertService = alertService;
|
|
121
|
+
}
|
|
122
|
+
PasswordComponent.prototype.ngOnInit = function () {
|
|
123
|
+
this.reset();
|
|
124
|
+
};
|
|
125
|
+
PasswordComponent.prototype.ngOnDestroy = function () {
|
|
126
|
+
location.reload();
|
|
127
|
+
};
|
|
128
|
+
Object.defineProperty(PasswordComponent.prototype, "formControls", {
|
|
129
|
+
get: function () {
|
|
130
|
+
return this.form.controls;
|
|
131
|
+
},
|
|
132
|
+
enumerable: false,
|
|
133
|
+
configurable: true
|
|
134
|
+
});
|
|
135
|
+
PasswordComponent.prototype.initData = function () {
|
|
136
|
+
/* this.userService.getUserIdentity().subscribe(value => {
|
|
137
|
+
this.profile = value;
|
|
138
|
+
this.setValues();
|
|
139
|
+
});*/
|
|
140
|
+
};
|
|
141
|
+
PasswordComponent.prototype.setValues = function () {
|
|
142
|
+
if (this.profile) {
|
|
143
|
+
// humanize dates
|
|
144
|
+
this.profile.humanize_dates = {
|
|
145
|
+
created_at: moment$1(this.profile.created_at).fromNow(),
|
|
146
|
+
updated_at: moment$1(this.profile.updated_at).fromNow(),
|
|
147
|
+
last_password_reset: moment$1(this.profile.last_password_reset).fromNow()
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
PasswordComponent.prototype.createFormGroup = function () {
|
|
152
|
+
return this.formBuilder.group({
|
|
153
|
+
password: new forms.FormControl('', [forms.Validators.required,
|
|
154
|
+
forms.Validators.pattern('(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[$@$!%*?&]).{4,}'),
|
|
155
|
+
forms.Validators.maxLength(50)]),
|
|
156
|
+
confirmPassword: new forms.FormControl('', [forms.Validators.required,
|
|
157
|
+
forms.Validators.minLength(4),
|
|
158
|
+
forms.Validators.maxLength(50)])
|
|
159
|
+
}, {
|
|
160
|
+
validator: this.mustMatch('password', 'confirmPassword')
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
PasswordComponent.prototype.mustMatch = function (controlName, matchingControlName) {
|
|
164
|
+
return function (formGroup) {
|
|
165
|
+
var control = formGroup.controls[controlName];
|
|
166
|
+
var matchingControl = formGroup.controls[matchingControlName];
|
|
167
|
+
if (matchingControl.errors && !matchingControl.errors.mustMatch) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (control.value !== matchingControl.value) {
|
|
171
|
+
matchingControl.setErrors({ mustMatch: true });
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
matchingControl.setErrors(null);
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
PasswordComponent.prototype.onSubmit = function () {
|
|
179
|
+
/* this.userService.changePassword(this.form.value.password).subscribe(() => {
|
|
180
|
+
this.alertService.success('Password has been changed');
|
|
181
|
+
}, result => {
|
|
182
|
+
this.errorMsg = result.error.detail.split(': ', 2)[1];
|
|
183
|
+
this.reset();
|
|
184
|
+
});*/
|
|
185
|
+
};
|
|
186
|
+
PasswordComponent.prototype.reset = function () {
|
|
187
|
+
this.form = this.createFormGroup();
|
|
188
|
+
this.initData();
|
|
189
|
+
};
|
|
190
|
+
return PasswordComponent;
|
|
191
|
+
}());
|
|
192
|
+
PasswordComponent.decorators = [
|
|
193
|
+
{ type: core.Component, args: [{
|
|
194
|
+
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\"><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",
|
|
196
|
+
styles: [""]
|
|
197
|
+
},] }
|
|
198
|
+
];
|
|
199
|
+
PasswordComponent.ctorParameters = function () { return [
|
|
200
|
+
{ type: forms.FormBuilder },
|
|
201
|
+
{ type: components.AlertService }
|
|
202
|
+
]; };
|
|
203
|
+
|
|
204
|
+
/*
|
|
205
|
+
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
206
|
+
*
|
|
207
|
+
* Licensed under EUPL, Version 1.2 (the "License");
|
|
208
|
+
* you may not use this file except in compliance with the License.
|
|
209
|
+
* You may obtain a copy of the License at
|
|
210
|
+
*
|
|
211
|
+
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
212
|
+
*
|
|
213
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
214
|
+
* distributed under the License is distributed on an "AS IS" basis,
|
|
215
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
216
|
+
* See the License for the specific language governing permissions and
|
|
217
|
+
* limitations under the License.
|
|
218
|
+
*/
|
|
219
|
+
var ɵ0 = { title: 'Profile', roles: [contract.ROLE_USER] }, ɵ1 = { title: 'Password', roles: [contract.ROLE_USER] };
|
|
220
|
+
var routes = [
|
|
221
|
+
{
|
|
222
|
+
path: 'profile',
|
|
223
|
+
component: ProfileComponent,
|
|
224
|
+
canActivate: [security.AuthGuardService],
|
|
225
|
+
data: ɵ0
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
path: 'password',
|
|
229
|
+
component: PasswordComponent,
|
|
230
|
+
canActivate: [security.AuthGuardService],
|
|
231
|
+
data: ɵ1
|
|
232
|
+
}
|
|
233
|
+
];
|
|
234
|
+
var AccountRoutingModule = /** @class */ (function () {
|
|
235
|
+
function AccountRoutingModule() {
|
|
236
|
+
}
|
|
237
|
+
return AccountRoutingModule;
|
|
238
|
+
}());
|
|
239
|
+
AccountRoutingModule.decorators = [
|
|
240
|
+
{ type: core.NgModule, args: [{
|
|
241
|
+
declarations: [],
|
|
242
|
+
imports: [
|
|
243
|
+
common.CommonModule,
|
|
244
|
+
router.RouterModule.forChild(routes)
|
|
245
|
+
],
|
|
246
|
+
exports: [router.RouterModule]
|
|
247
|
+
},] }
|
|
248
|
+
];
|
|
249
|
+
|
|
250
|
+
/*
|
|
251
|
+
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
252
|
+
*
|
|
253
|
+
* Licensed under EUPL, Version 1.2 (the "License");
|
|
254
|
+
* you may not use this file except in compliance with the License.
|
|
255
|
+
* You may obtain a copy of the License at
|
|
256
|
+
*
|
|
257
|
+
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
258
|
+
*
|
|
259
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
260
|
+
* distributed under the License is distributed on an "AS IS" basis,
|
|
261
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
262
|
+
* See the License for the specific language governing permissions and
|
|
263
|
+
* limitations under the License.
|
|
264
|
+
*/
|
|
265
|
+
var AccountModule = /** @class */ (function () {
|
|
266
|
+
function AccountModule() {
|
|
267
|
+
}
|
|
268
|
+
return AccountModule;
|
|
269
|
+
}());
|
|
270
|
+
AccountModule.decorators = [
|
|
271
|
+
{ type: core.NgModule, args: [{
|
|
272
|
+
declarations: [ProfileComponent, PasswordComponent],
|
|
273
|
+
imports: [
|
|
274
|
+
common.CommonModule,
|
|
275
|
+
AccountRoutingModule,
|
|
276
|
+
components.WidgetModule,
|
|
277
|
+
components.ListModule,
|
|
278
|
+
components.FieldAutoFocusModule,
|
|
279
|
+
forms.FormsModule,
|
|
280
|
+
forms.ReactiveFormsModule,
|
|
281
|
+
components.UploaderModule,
|
|
282
|
+
components.AlertModule
|
|
283
|
+
],
|
|
284
|
+
exports: [ProfileComponent, PasswordComponent],
|
|
285
|
+
providers: []
|
|
286
|
+
},] }
|
|
287
|
+
];
|
|
288
|
+
|
|
289
|
+
/*
|
|
290
|
+
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
291
|
+
*
|
|
292
|
+
* Licensed under EUPL, Version 1.2 (the "License");
|
|
293
|
+
* you may not use this file except in compliance with the License.
|
|
294
|
+
* You may obtain a copy of the License at
|
|
295
|
+
*
|
|
296
|
+
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
297
|
+
*
|
|
298
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
299
|
+
* distributed under the License is distributed on an "AS IS" basis,
|
|
300
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
301
|
+
* See the License for the specific language governing permissions and
|
|
302
|
+
* limitations under the License.
|
|
303
|
+
*/
|
|
304
|
+
function accountInitializer(translate, logger) {
|
|
305
|
+
return function () {
|
|
306
|
+
return new Promise(function (resolve, reject) {
|
|
307
|
+
try {
|
|
308
|
+
logger.debug('Account initializer');
|
|
309
|
+
translate.addLangs(['en', 'nl']);
|
|
310
|
+
var langKey = localStorage.getItem('langKey');
|
|
311
|
+
if (langKey === null) {
|
|
312
|
+
langKey = 'nl';
|
|
313
|
+
localStorage.setItem('langKey', 'nl');
|
|
314
|
+
}
|
|
315
|
+
logger.debug('Using langKey', langKey);
|
|
316
|
+
translate.use(langKey);
|
|
317
|
+
resolve();
|
|
318
|
+
}
|
|
319
|
+
catch (error) {
|
|
320
|
+
logger.debug('Account initializer error', error);
|
|
321
|
+
reject(error);
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/*
|
|
328
|
+
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
329
|
+
*
|
|
330
|
+
* Licensed under EUPL, Version 1.2 (the "License");
|
|
331
|
+
* you may not use this file except in compliance with the License.
|
|
332
|
+
* You may obtain a copy of the License at
|
|
333
|
+
*
|
|
334
|
+
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
335
|
+
*
|
|
336
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
337
|
+
* distributed under the License is distributed on an "AS IS" basis,
|
|
338
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
339
|
+
* See the License for the specific language governing permissions and
|
|
340
|
+
* limitations under the License.
|
|
341
|
+
*/
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Generated bundle index. Do not edit.
|
|
345
|
+
*/
|
|
346
|
+
|
|
347
|
+
exports.AccountModule = AccountModule;
|
|
348
|
+
exports.PasswordComponent = PasswordComponent;
|
|
349
|
+
exports.ProfileComponent = ProfileComponent;
|
|
350
|
+
exports.accountInitializer = accountInitializer;
|
|
351
|
+
exports.ɵa = AccountRoutingModule;
|
|
352
|
+
|
|
353
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
354
|
+
|
|
355
|
+
})));
|
|
356
|
+
//# sourceMappingURL=valtimo-account.umd.js.map
|
|
@@ -0,0 +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,CA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EAAE;wBACPC,mBAAY;wBACZ,oBAAoB;wBACpBE,uBAAY;wBACZC,qBAAU;wBACVC,+BAAoB;wBACpBC,iBAAW;wBACXC,yBAAmB;wBACnBC,yBAAc;wBACdC,sBAAW;qBACZ;oBACD,OAAO,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;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +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})}));
|
|
2
|
+
//# sourceMappingURL=valtimo-account.umd.min.js.map
|
|
@@ -0,0 +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","translate","logger","Promise","resolve","reject","debug","addLangs","setItem","use","error"],"mappings":"msBAqBA,IAAMA,EAASC,EACfD,EAAOE,OAAOC,aAAaC,QAAQ,6BAajC,SAAAC,EACUC,EACAC,GADAC,KAAAF,YAAAA,EACAE,KAAAD,aAAAA,EAJHC,KAAAC,YAA0B,UAQjCJ,EAAAK,UAAAC,SAAA,WACEH,KAAKI,SAGPP,EAAAK,UAAAG,YAAA,WACEC,SAASC,UAGXC,OAAAC,eAAIZ,EAAAK,UAAA,eAAY,KAAhB,WACE,OAAOF,KAAKU,KAAKC,0CAGXd,EAAAK,UAAAU,SAAA,aAOAf,EAAAK,UAAAW,UAAA,WACFb,KAAKc,UAEPd,KAAKc,QAAQC,eAAiB,CAC5BC,WAAYxB,EAAOQ,KAAKc,QAAQE,YAAYC,UAC5CC,WAAY1B,EAAOQ,KAAKc,QAAQI,YAAYD,UAC5CE,oBAAqB3B,EAAOQ,KAAKc,QAAQK,qBAAqBF,WAGhEjB,KAAKU,KAAKC,SAASS,UAAUC,SAASrB,KAAKc,QAAQQ,cAAcC,WACjEvB,KAAKU,KAAKC,SAASa,SAASH,SAASrB,KAAKc,QAAQQ,cAAcG,UAChEzB,KAAKU,KAAKC,SAASe,QAAQL,SAASrB,KAAKc,QAAQQ,cAAcI,WAI3D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A,aACAC,EAAAA,WACAC,EAAAA,qBACAC,EAAAA,YACAC,EAAAA,oBACAC,EAAAA,eACAC,EAAAA,aAEFR,QAAS,CAACjF,EAAkBiD,GAC5ByC,UAAW,kGClBXC,EACAC,GAEA,OAAO,WACL,OAAO,IAAIC,SAAQ,SAACC,EAASC,GAC3B,IACEH,EAAOI,MAAM,uBACbL,EAAUM,SAAS,CAAC,KAAM,OAC1B,IAAIpE,EAAU/B,aAAaC,QAAQ,WACnB,OAAZ8B,IACFA,EAAU,KACV/B,aAAaoG,QAAQ,UAAW,OAElCN,EAAOI,MAAM,gBAAiBnE,GAC9B8D,EAAUQ,IAAItE,GACdiE,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';\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"]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under EUPL, Version 1.2 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" basis,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { NgModule } from '@angular/core';
|
|
17
|
+
import { RouterModule } from '@angular/router';
|
|
18
|
+
import { CommonModule } from '@angular/common';
|
|
19
|
+
import { AuthGuardService } from '@valtimo/security';
|
|
20
|
+
import { ProfileComponent } from './profile/profile.component';
|
|
21
|
+
import { PasswordComponent } from './password/password.component';
|
|
22
|
+
import { ROLE_USER } from '@valtimo/contract';
|
|
23
|
+
const ɵ0 = { title: 'Profile', roles: [ROLE_USER] }, ɵ1 = { title: 'Password', roles: [ROLE_USER] };
|
|
24
|
+
const routes = [
|
|
25
|
+
{
|
|
26
|
+
path: 'profile',
|
|
27
|
+
component: ProfileComponent,
|
|
28
|
+
canActivate: [AuthGuardService],
|
|
29
|
+
data: ɵ0
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
path: 'password',
|
|
33
|
+
component: PasswordComponent,
|
|
34
|
+
canActivate: [AuthGuardService],
|
|
35
|
+
data: ɵ1
|
|
36
|
+
}
|
|
37
|
+
];
|
|
38
|
+
export class AccountRoutingModule {
|
|
39
|
+
}
|
|
40
|
+
AccountRoutingModule.decorators = [
|
|
41
|
+
{ type: NgModule, args: [{
|
|
42
|
+
declarations: [],
|
|
43
|
+
imports: [
|
|
44
|
+
CommonModule,
|
|
45
|
+
RouterModule.forChild(routes)
|
|
46
|
+
],
|
|
47
|
+
exports: [RouterModule]
|
|
48
|
+
},] }
|
|
49
|
+
];
|
|
50
|
+
export { ɵ0, ɵ1 };
|
|
51
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWNjb3VudC1yb3V0aW5nLm1vZHVsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL3ZhbHRpbW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S5mb3JDaGlsZChyb3V0ZXMpXG4gIF0sXG4gIGV4cG9ydHM6IFtSb3V0ZXJNb2R1bGVdXG59KVxuZXhwb3J0IGNsYXNzIEFjY291bnRSb3V0aW5nTW9kdWxlIHtcbn1cbiJdfQ==
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under EUPL, Version 1.2 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" basis,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export function accountInitializer(translate, logger) {
|
|
17
|
+
return () => {
|
|
18
|
+
return new Promise((resolve, reject) => {
|
|
19
|
+
try {
|
|
20
|
+
logger.debug('Account initializer');
|
|
21
|
+
translate.addLangs(['en', 'nl']);
|
|
22
|
+
let langKey = localStorage.getItem('langKey');
|
|
23
|
+
if (langKey === null) {
|
|
24
|
+
langKey = 'nl';
|
|
25
|
+
localStorage.setItem('langKey', 'nl');
|
|
26
|
+
}
|
|
27
|
+
logger.debug('Using langKey', langKey);
|
|
28
|
+
translate.use(langKey);
|
|
29
|
+
resolve();
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
logger.debug('Account initializer error', error);
|
|
33
|
+
reject(error);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjo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