@myrmidon/auth-jwt-admin 0.0.2 → 0.0.3
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/{esm2015/lib/auth-jwt-admin.module.js → esm2020/lib/auth-jwt-admin.module.mjs} +4 -4
- package/esm2020/lib/components/auth-jwt-registration/auth-jwt-registration.component.mjs +203 -0
- package/{esm2015/lib/components/confirm-dialog/confirm-dialog.component.js → esm2020/lib/components/confirm-dialog/confirm-dialog.component.mjs} +5 -10
- package/{esm2015/lib/components/password-strength-bar/password-strength-bar.component.js → esm2020/lib/components/password-strength-bar/password-strength-bar.component.mjs} +5 -9
- package/{esm2015/lib/components/state/users.paginator.js → esm2020/lib/components/state/users.paginator.mjs} +0 -0
- package/{esm2015/lib/components/state/users.query.js → esm2020/lib/components/state/users.query.mjs} +3 -3
- package/esm2020/lib/components/state/users.service.mjs +65 -0
- package/{esm2015/lib/components/state/users.store.js → esm2020/lib/components/state/users.store.mjs} +3 -3
- package/esm2020/lib/components/user-editor/user-editor.component.mjs +112 -0
- package/esm2020/lib/components/user-filter/user-filter.component.mjs +58 -0
- package/esm2020/lib/components/user-list/user-list.component.mjs +134 -0
- package/{esm2015/lib/services/auth-jwt-account.service.js → esm2020/lib/services/auth-jwt-account.service.mjs} +3 -3
- package/{esm2015/lib/services/dialog.service.js → esm2020/lib/services/dialog.service.mjs} +3 -3
- package/{esm2015/lib/validators/password.validators.js → esm2020/lib/validators/password.validators.mjs} +0 -0
- package/{esm2015/myrmidon-auth-jwt-admin.js → esm2020/myrmidon-auth-jwt-admin.mjs} +0 -0
- package/{esm2015/public-api.js → esm2020/public-api.mjs} +0 -0
- package/fesm2015/myrmidon-auth-jwt-admin.mjs +1061 -0
- package/fesm2015/myrmidon-auth-jwt-admin.mjs.map +1 -0
- package/{fesm2015/myrmidon-auth-jwt-admin.js → fesm2020/myrmidon-auth-jwt-admin.mjs} +50 -78
- package/fesm2020/myrmidon-auth-jwt-admin.mjs.map +1 -0
- package/package.json +22 -9
- package/bundles/myrmidon-auth-jwt-admin.umd.js +0 -1466
- package/bundles/myrmidon-auth-jwt-admin.umd.js.map +0 -1
- package/esm2015/lib/components/auth-jwt-registration/auth-jwt-registration.component.js +0 -207
- package/esm2015/lib/components/state/users.service.js +0 -65
- package/esm2015/lib/components/user-editor/user-editor.component.js +0 -118
- package/esm2015/lib/components/user-filter/user-filter.component.js +0 -63
- package/esm2015/lib/components/user-list/user-list.component.js +0 -138
- package/fesm2015/myrmidon-auth-jwt-admin.js.map +0 -1
|
@@ -1,1466 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/forms'), require('rxjs/operators'), require('@angular/material/snack-bar'), require('@angular/common/http'), require('@myrmidon/ng-tools'), require('@angular/material/form-field'), require('@angular/material/icon'), require('@angular/material/button'), require('@angular/material/progress-spinner'), require('@angular/material/input'), require('@angular/common'), require('@datorama/akita'), require('@angular/material/tooltip'), require('rxjs'), require('@angular/material/dialog'), require('@myrmidon/auth-jwt-login'), require('@angular/material/progress-bar'), require('@angular/material/paginator'), require('@angular/material/checkbox'), require('@angular/material/card'), require('@angular/router')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@myrmidon/auth-jwt-admin', ['exports', '@angular/core', '@angular/forms', 'rxjs/operators', '@angular/material/snack-bar', '@angular/common/http', '@myrmidon/ng-tools', '@angular/material/form-field', '@angular/material/icon', '@angular/material/button', '@angular/material/progress-spinner', '@angular/material/input', '@angular/common', '@datorama/akita', '@angular/material/tooltip', 'rxjs', '@angular/material/dialog', '@myrmidon/auth-jwt-login', '@angular/material/progress-bar', '@angular/material/paginator', '@angular/material/checkbox', '@angular/material/card', '@angular/router'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.myrmidon = global.myrmidon || {}, global.myrmidon['auth-jwt-admin'] = {}), global.ng.core, global.ng.forms, global.rxjs.operators, global.ng.material.snackBar, global.ng.common.http, global['@myrmidon/ng-tools'], global.ng.material.formField, global.ng.material.icon, global.ng.material.button, global.ng.material.progressSpinner, global.ng.material.input, global.ng.common, global['@datorama/akita'], global.ng.material.tooltip, global.rxjs, global.ng.material.dialog, global['@myrmidon/auth-jwt-login'], global.ng.material.progressBar, global.ng.material.paginator, global.ng.material.checkbox, global.ng.material.card, global.ng.router));
|
|
5
|
-
}(this, (function (exports, i0, i1$1, operators, i2$1, i1, i2, i4, i6, i5, i8, i7, i13, i15, i8$1, rxjs, i1$2, i2$2, i8$2, i11, i4$1, card, router) { 'use strict';
|
|
6
|
-
|
|
7
|
-
function _interopNamespace(e) {
|
|
8
|
-
if (e && e.__esModule) return e;
|
|
9
|
-
var n = Object.create(null);
|
|
10
|
-
if (e) {
|
|
11
|
-
Object.keys(e).forEach(function (k) {
|
|
12
|
-
if (k !== 'default') {
|
|
13
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: function () {
|
|
17
|
-
return e[k];
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
n['default'] = e;
|
|
24
|
-
return Object.freeze(n);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
|
28
|
-
var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
|
|
29
|
-
var i2__namespace$1 = /*#__PURE__*/_interopNamespace(i2$1);
|
|
30
|
-
var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
|
|
31
|
-
var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
|
|
32
|
-
var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
|
|
33
|
-
var i6__namespace = /*#__PURE__*/_interopNamespace(i6);
|
|
34
|
-
var i5__namespace = /*#__PURE__*/_interopNamespace(i5);
|
|
35
|
-
var i8__namespace = /*#__PURE__*/_interopNamespace(i8);
|
|
36
|
-
var i7__namespace = /*#__PURE__*/_interopNamespace(i7);
|
|
37
|
-
var i13__namespace = /*#__PURE__*/_interopNamespace(i13);
|
|
38
|
-
var i15__namespace = /*#__PURE__*/_interopNamespace(i15);
|
|
39
|
-
var i8__namespace$1 = /*#__PURE__*/_interopNamespace(i8$1);
|
|
40
|
-
var i1__namespace$2 = /*#__PURE__*/_interopNamespace(i1$2);
|
|
41
|
-
var i2__namespace$2 = /*#__PURE__*/_interopNamespace(i2$2);
|
|
42
|
-
var i8__namespace$2 = /*#__PURE__*/_interopNamespace(i8$2);
|
|
43
|
-
var i11__namespace = /*#__PURE__*/_interopNamespace(i11);
|
|
44
|
-
var i4__namespace$1 = /*#__PURE__*/_interopNamespace(i4$1);
|
|
45
|
-
|
|
46
|
-
var PasswordValidators = /** @class */ (function () {
|
|
47
|
-
function PasswordValidators() {
|
|
48
|
-
}
|
|
49
|
-
/** "Standard" password validator for my API services. */
|
|
50
|
-
PasswordValidators.standard = function () {
|
|
51
|
-
return function (control) {
|
|
52
|
-
if (!control.value) {
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
if (control.value.length < 8) {
|
|
56
|
-
return {
|
|
57
|
-
passwordTooShort: true,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
if (!/.*[A-Z].*/.test(control.value)) {
|
|
61
|
-
return {
|
|
62
|
-
noUpperInPassword: true,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
if (!/.*[a-z].*/.test(control.value)) {
|
|
66
|
-
return {
|
|
67
|
-
noLowerInPassword: true,
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
if (!/.*[A-Z].*/.test(control.value)) {
|
|
71
|
-
return {
|
|
72
|
-
noUpperInPassword: true,
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
if (!/.*[-`~!@#$%^&*()_+=\[\]{};:'",.<>/?|\\].*/.test(control.value)) {
|
|
76
|
-
return {
|
|
77
|
-
noSymbolInPassword: true,
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
return null;
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
return PasswordValidators;
|
|
84
|
-
}());
|
|
85
|
-
|
|
86
|
-
var AuthJwtAccountService = /** @class */ (function () {
|
|
87
|
-
function AuthJwtAccountService(_http, _error, _env) {
|
|
88
|
-
this._http = _http;
|
|
89
|
-
this._error = _error;
|
|
90
|
-
this._env = _env;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Checks if the specified email address is registered on the server.
|
|
94
|
-
* @param email email address to test.
|
|
95
|
-
* @returns result.
|
|
96
|
-
*/
|
|
97
|
-
AuthJwtAccountService.prototype.isEmailRegistered = function (email) {
|
|
98
|
-
return this._http.get(this._env.get('apiUrl') +
|
|
99
|
-
'accounts/emailexists/' +
|
|
100
|
-
encodeURIComponent(email));
|
|
101
|
-
};
|
|
102
|
-
/**
|
|
103
|
-
* Checks if the specified user's given name is registered on the server.
|
|
104
|
-
* This name is a nickname chosen by users during registration, and is the key
|
|
105
|
-
* used for referencing users when talking to the server.
|
|
106
|
-
* @param name name to test.
|
|
107
|
-
* @returns result.
|
|
108
|
-
*/
|
|
109
|
-
AuthJwtAccountService.prototype.isNameRegistered = function (name) {
|
|
110
|
-
return this._http.get(this._env.get('apiUrl') +
|
|
111
|
-
'accounts/nameexists/' +
|
|
112
|
-
encodeURIComponent(name));
|
|
113
|
-
};
|
|
114
|
-
/**
|
|
115
|
-
* Register the user with the specified registration data.
|
|
116
|
-
* @param registration The registration data.
|
|
117
|
-
*/
|
|
118
|
-
AuthJwtAccountService.prototype.register = function (registration) {
|
|
119
|
-
// const options = {
|
|
120
|
-
// headers: this.createAuthHeaders({
|
|
121
|
-
// 'Content-Type': 'application/json',
|
|
122
|
-
// }),
|
|
123
|
-
// };
|
|
124
|
-
return this._http.post(this._env.get('apiUrl') + 'accounts/register', registration
|
|
125
|
-
// options
|
|
126
|
-
);
|
|
127
|
-
};
|
|
128
|
-
/**
|
|
129
|
-
* Resend the confirmation email to the specified address.
|
|
130
|
-
* @param email address.
|
|
131
|
-
*/
|
|
132
|
-
AuthJwtAccountService.prototype.resendConfirmEmail = function (email) {
|
|
133
|
-
// const options = {
|
|
134
|
-
// headers: this.createAuthHeaders({
|
|
135
|
-
// 'Content-Type': 'application/json',
|
|
136
|
-
// }),
|
|
137
|
-
// };
|
|
138
|
-
return this._http.get(this._env.get('apiUrl') +
|
|
139
|
-
'accounts/resendconfirm/' +
|
|
140
|
-
encodeURIComponent(email)
|
|
141
|
-
// options
|
|
142
|
-
);
|
|
143
|
-
};
|
|
144
|
-
/**
|
|
145
|
-
* Request a password reset for the specified email address.
|
|
146
|
-
* @param email Email address.
|
|
147
|
-
*/
|
|
148
|
-
AuthJwtAccountService.prototype.requestPasswordReset = function (email) {
|
|
149
|
-
return this._http.post(this._env.get('apiUrl') + 'accounts/resetpassword/request', { email: email });
|
|
150
|
-
};
|
|
151
|
-
AuthJwtAccountService.prototype.getAllUsers = function () {
|
|
152
|
-
return this._http
|
|
153
|
-
.get(this._env.get('apiUrl') + 'users', {
|
|
154
|
-
params: new i1.HttpParams().set('pageNumber', '1'),
|
|
155
|
-
})
|
|
156
|
-
.pipe(operators.retry(3), operators.catchError(this._error.handleError));
|
|
157
|
-
};
|
|
158
|
-
AuthJwtAccountService.prototype.getUsers = function (filter) {
|
|
159
|
-
var httpParams = new i1.HttpParams();
|
|
160
|
-
httpParams = httpParams.set('pageNumber', filter.pageNumber.toString());
|
|
161
|
-
httpParams = httpParams.set('pageSize', filter.pageSize.toString());
|
|
162
|
-
if (filter.name) {
|
|
163
|
-
httpParams = httpParams.set('name', filter.name);
|
|
164
|
-
}
|
|
165
|
-
return this._http
|
|
166
|
-
.get(this._env.get('apiUrl') + 'users', {
|
|
167
|
-
params: httpParams,
|
|
168
|
-
})
|
|
169
|
-
.pipe(operators.retry(3), operators.catchError(this._error.handleError));
|
|
170
|
-
};
|
|
171
|
-
/**
|
|
172
|
-
* Get the top N users matching the specified name filter.
|
|
173
|
-
* @param nameFilter The user name filter.
|
|
174
|
-
* @param limit The maximum number of users to get.
|
|
175
|
-
*/
|
|
176
|
-
AuthJwtAccountService.prototype.getTopUsers = function (nameFilter, limit) {
|
|
177
|
-
if (limit === void 0) { limit = 10; }
|
|
178
|
-
var httpParams = new i1.HttpParams();
|
|
179
|
-
httpParams = httpParams.set('pageNumber', '1');
|
|
180
|
-
httpParams = httpParams.set('pageSize', limit.toString());
|
|
181
|
-
if (nameFilter) {
|
|
182
|
-
httpParams = httpParams.set('name', nameFilter);
|
|
183
|
-
}
|
|
184
|
-
var options = httpParams.keys().length > 0
|
|
185
|
-
? {
|
|
186
|
-
params: httpParams,
|
|
187
|
-
}
|
|
188
|
-
: {};
|
|
189
|
-
return this._http
|
|
190
|
-
.get(this._env.get('apiUrl') + 'users', options)
|
|
191
|
-
.pipe(operators.retry(3), operators.catchError(this._error.handleError));
|
|
192
|
-
};
|
|
193
|
-
/**
|
|
194
|
-
* Get information about all the users listed in the specified names.
|
|
195
|
-
* @param names User(s) names.
|
|
196
|
-
*/
|
|
197
|
-
AuthJwtAccountService.prototype.getUsersFromNames = function (names) {
|
|
198
|
-
var httpParams = new i1.HttpParams();
|
|
199
|
-
if (names && names.length > 0) {
|
|
200
|
-
httpParams = httpParams.set('names', names.join(','));
|
|
201
|
-
}
|
|
202
|
-
var options = httpParams.keys().length > 0
|
|
203
|
-
? {
|
|
204
|
-
params: httpParams,
|
|
205
|
-
}
|
|
206
|
-
: {};
|
|
207
|
-
return this._http
|
|
208
|
-
.get(this._env.get('apiUrl') + 'users-from-names', options)
|
|
209
|
-
.pipe(operators.retry(3), operators.catchError(this._error.handleError));
|
|
210
|
-
};
|
|
211
|
-
/**
|
|
212
|
-
* Get data about the specified user.
|
|
213
|
-
* @param name The user name.
|
|
214
|
-
*/
|
|
215
|
-
AuthJwtAccountService.prototype.getUser = function (name) {
|
|
216
|
-
return this._http
|
|
217
|
-
.get(this._env.get('apiUrl') + 'users/' + name)
|
|
218
|
-
.pipe(operators.retry(3), operators.catchError(this._error.handleError));
|
|
219
|
-
};
|
|
220
|
-
/**
|
|
221
|
-
* Update the editable data for the specified user.
|
|
222
|
-
* @param user The user to update.
|
|
223
|
-
*/
|
|
224
|
-
AuthJwtAccountService.prototype.updateUser = function (user) {
|
|
225
|
-
return this._http
|
|
226
|
-
.put(this._env.get('apiUrl') + 'users', user)
|
|
227
|
-
.pipe(operators.catchError(this._error.handleError));
|
|
228
|
-
};
|
|
229
|
-
/**
|
|
230
|
-
* Request a password reset email for the specified email address.
|
|
231
|
-
* @param email The email address to receive the reset message.
|
|
232
|
-
*/
|
|
233
|
-
AuthJwtAccountService.prototype.resetPassword = function (email) {
|
|
234
|
-
return this._http
|
|
235
|
-
.post(this._env.get('apiUrl') + 'accounts/resetpassword/request', {
|
|
236
|
-
email: email,
|
|
237
|
-
})
|
|
238
|
-
.pipe(operators.catchError(this._error.handleError));
|
|
239
|
-
};
|
|
240
|
-
/**
|
|
241
|
-
* Change the password.
|
|
242
|
-
* @param change The password change data.
|
|
243
|
-
*/
|
|
244
|
-
AuthJwtAccountService.prototype.changePassword = function (change) {
|
|
245
|
-
return this._http
|
|
246
|
-
.post(this._env.get('apiUrl') + 'accounts/changepassword', change)
|
|
247
|
-
.pipe(operators.catchError(this._error.handleError));
|
|
248
|
-
};
|
|
249
|
-
/**
|
|
250
|
-
* Delete the user with the specified username.
|
|
251
|
-
* @param name The user name.
|
|
252
|
-
*/
|
|
253
|
-
AuthJwtAccountService.prototype.deleteUser = function (name) {
|
|
254
|
-
return this._http
|
|
255
|
-
.delete(this._env.get('apiUrl') + 'accounts/' + name)
|
|
256
|
-
.pipe(operators.catchError(this._error.handleError));
|
|
257
|
-
};
|
|
258
|
-
return AuthJwtAccountService;
|
|
259
|
-
}());
|
|
260
|
-
AuthJwtAccountService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: AuthJwtAccountService, deps: [{ token: i1__namespace.HttpClient }, { token: i2__namespace.ErrorService }, { token: i2__namespace.EnvService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
261
|
-
AuthJwtAccountService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: AuthJwtAccountService, providedIn: 'root' });
|
|
262
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: AuthJwtAccountService, decorators: [{
|
|
263
|
-
type: i0.Injectable,
|
|
264
|
-
args: [{
|
|
265
|
-
providedIn: 'root',
|
|
266
|
-
}]
|
|
267
|
-
}], ctorParameters: function () { return [{ type: i1__namespace.HttpClient }, { type: i2__namespace.ErrorService }, { type: i2__namespace.EnvService }]; } });
|
|
268
|
-
|
|
269
|
-
/*! *****************************************************************************
|
|
270
|
-
Copyright (c) Microsoft Corporation.
|
|
271
|
-
|
|
272
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
273
|
-
purpose with or without fee is hereby granted.
|
|
274
|
-
|
|
275
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
276
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
277
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
278
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
279
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
280
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
281
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
282
|
-
***************************************************************************** */
|
|
283
|
-
/* global Reflect, Promise */
|
|
284
|
-
var extendStatics = function (d, b) {
|
|
285
|
-
extendStatics = Object.setPrototypeOf ||
|
|
286
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
287
|
-
function (d, b) { for (var p in b)
|
|
288
|
-
if (Object.prototype.hasOwnProperty.call(b, p))
|
|
289
|
-
d[p] = b[p]; };
|
|
290
|
-
return extendStatics(d, b);
|
|
291
|
-
};
|
|
292
|
-
function __extends(d, b) {
|
|
293
|
-
if (typeof b !== "function" && b !== null)
|
|
294
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
295
|
-
extendStatics(d, b);
|
|
296
|
-
function __() { this.constructor = d; }
|
|
297
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
298
|
-
}
|
|
299
|
-
var __assign = function () {
|
|
300
|
-
__assign = Object.assign || function __assign(t) {
|
|
301
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
302
|
-
s = arguments[i];
|
|
303
|
-
for (var p in s)
|
|
304
|
-
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
305
|
-
t[p] = s[p];
|
|
306
|
-
}
|
|
307
|
-
return t;
|
|
308
|
-
};
|
|
309
|
-
return __assign.apply(this, arguments);
|
|
310
|
-
};
|
|
311
|
-
function __rest(s, e) {
|
|
312
|
-
var t = {};
|
|
313
|
-
for (var p in s)
|
|
314
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
315
|
-
t[p] = s[p];
|
|
316
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
317
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
318
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
319
|
-
t[p[i]] = s[p[i]];
|
|
320
|
-
}
|
|
321
|
-
return t;
|
|
322
|
-
}
|
|
323
|
-
function __decorate(decorators, target, key, desc) {
|
|
324
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
325
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
326
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
|
327
|
-
else
|
|
328
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
|
329
|
-
if (d = decorators[i])
|
|
330
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
331
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
332
|
-
}
|
|
333
|
-
function __param(paramIndex, decorator) {
|
|
334
|
-
return function (target, key) { decorator(target, key, paramIndex); };
|
|
335
|
-
}
|
|
336
|
-
function __metadata(metadataKey, metadataValue) {
|
|
337
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
338
|
-
return Reflect.metadata(metadataKey, metadataValue);
|
|
339
|
-
}
|
|
340
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
341
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
342
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
343
|
-
function fulfilled(value) { try {
|
|
344
|
-
step(generator.next(value));
|
|
345
|
-
}
|
|
346
|
-
catch (e) {
|
|
347
|
-
reject(e);
|
|
348
|
-
} }
|
|
349
|
-
function rejected(value) { try {
|
|
350
|
-
step(generator["throw"](value));
|
|
351
|
-
}
|
|
352
|
-
catch (e) {
|
|
353
|
-
reject(e);
|
|
354
|
-
} }
|
|
355
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
356
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
function __generator(thisArg, body) {
|
|
360
|
-
var _ = { label: 0, sent: function () { if (t[0] & 1)
|
|
361
|
-
throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
362
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
|
363
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
364
|
-
function step(op) {
|
|
365
|
-
if (f)
|
|
366
|
-
throw new TypeError("Generator is already executing.");
|
|
367
|
-
while (_)
|
|
368
|
-
try {
|
|
369
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
|
370
|
-
return t;
|
|
371
|
-
if (y = 0, t)
|
|
372
|
-
op = [op[0] & 2, t.value];
|
|
373
|
-
switch (op[0]) {
|
|
374
|
-
case 0:
|
|
375
|
-
case 1:
|
|
376
|
-
t = op;
|
|
377
|
-
break;
|
|
378
|
-
case 4:
|
|
379
|
-
_.label++;
|
|
380
|
-
return { value: op[1], done: false };
|
|
381
|
-
case 5:
|
|
382
|
-
_.label++;
|
|
383
|
-
y = op[1];
|
|
384
|
-
op = [0];
|
|
385
|
-
continue;
|
|
386
|
-
case 7:
|
|
387
|
-
op = _.ops.pop();
|
|
388
|
-
_.trys.pop();
|
|
389
|
-
continue;
|
|
390
|
-
default:
|
|
391
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
392
|
-
_ = 0;
|
|
393
|
-
continue;
|
|
394
|
-
}
|
|
395
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
|
396
|
-
_.label = op[1];
|
|
397
|
-
break;
|
|
398
|
-
}
|
|
399
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
400
|
-
_.label = t[1];
|
|
401
|
-
t = op;
|
|
402
|
-
break;
|
|
403
|
-
}
|
|
404
|
-
if (t && _.label < t[2]) {
|
|
405
|
-
_.label = t[2];
|
|
406
|
-
_.ops.push(op);
|
|
407
|
-
break;
|
|
408
|
-
}
|
|
409
|
-
if (t[2])
|
|
410
|
-
_.ops.pop();
|
|
411
|
-
_.trys.pop();
|
|
412
|
-
continue;
|
|
413
|
-
}
|
|
414
|
-
op = body.call(thisArg, _);
|
|
415
|
-
}
|
|
416
|
-
catch (e) {
|
|
417
|
-
op = [6, e];
|
|
418
|
-
y = 0;
|
|
419
|
-
}
|
|
420
|
-
finally {
|
|
421
|
-
f = t = 0;
|
|
422
|
-
}
|
|
423
|
-
if (op[0] & 5)
|
|
424
|
-
throw op[1];
|
|
425
|
-
return { value: op[0] ? op[1] : void 0, done: true };
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
var __createBinding = Object.create ? (function (o, m, k, k2) {
|
|
429
|
-
if (k2 === undefined)
|
|
430
|
-
k2 = k;
|
|
431
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
|
|
432
|
-
}) : (function (o, m, k, k2) {
|
|
433
|
-
if (k2 === undefined)
|
|
434
|
-
k2 = k;
|
|
435
|
-
o[k2] = m[k];
|
|
436
|
-
});
|
|
437
|
-
function __exportStar(m, o) {
|
|
438
|
-
for (var p in m)
|
|
439
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
|
440
|
-
__createBinding(o, m, p);
|
|
441
|
-
}
|
|
442
|
-
function __values(o) {
|
|
443
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
444
|
-
if (m)
|
|
445
|
-
return m.call(o);
|
|
446
|
-
if (o && typeof o.length === "number")
|
|
447
|
-
return {
|
|
448
|
-
next: function () {
|
|
449
|
-
if (o && i >= o.length)
|
|
450
|
-
o = void 0;
|
|
451
|
-
return { value: o && o[i++], done: !o };
|
|
452
|
-
}
|
|
453
|
-
};
|
|
454
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
455
|
-
}
|
|
456
|
-
function __read(o, n) {
|
|
457
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
458
|
-
if (!m)
|
|
459
|
-
return o;
|
|
460
|
-
var i = m.call(o), r, ar = [], e;
|
|
461
|
-
try {
|
|
462
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
|
463
|
-
ar.push(r.value);
|
|
464
|
-
}
|
|
465
|
-
catch (error) {
|
|
466
|
-
e = { error: error };
|
|
467
|
-
}
|
|
468
|
-
finally {
|
|
469
|
-
try {
|
|
470
|
-
if (r && !r.done && (m = i["return"]))
|
|
471
|
-
m.call(i);
|
|
472
|
-
}
|
|
473
|
-
finally {
|
|
474
|
-
if (e)
|
|
475
|
-
throw e.error;
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
return ar;
|
|
479
|
-
}
|
|
480
|
-
/** @deprecated */
|
|
481
|
-
function __spread() {
|
|
482
|
-
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
483
|
-
ar = ar.concat(__read(arguments[i]));
|
|
484
|
-
return ar;
|
|
485
|
-
}
|
|
486
|
-
/** @deprecated */
|
|
487
|
-
function __spreadArrays() {
|
|
488
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
|
489
|
-
s += arguments[i].length;
|
|
490
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
491
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
492
|
-
r[k] = a[j];
|
|
493
|
-
return r;
|
|
494
|
-
}
|
|
495
|
-
function __spreadArray(to, from, pack) {
|
|
496
|
-
if (pack || arguments.length === 2)
|
|
497
|
-
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
498
|
-
if (ar || !(i in from)) {
|
|
499
|
-
if (!ar)
|
|
500
|
-
ar = Array.prototype.slice.call(from, 0, i);
|
|
501
|
-
ar[i] = from[i];
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
505
|
-
}
|
|
506
|
-
function __await(v) {
|
|
507
|
-
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
508
|
-
}
|
|
509
|
-
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
510
|
-
if (!Symbol.asyncIterator)
|
|
511
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
512
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
513
|
-
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
514
|
-
function verb(n) { if (g[n])
|
|
515
|
-
i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
516
|
-
function resume(n, v) { try {
|
|
517
|
-
step(g[n](v));
|
|
518
|
-
}
|
|
519
|
-
catch (e) {
|
|
520
|
-
settle(q[0][3], e);
|
|
521
|
-
} }
|
|
522
|
-
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
523
|
-
function fulfill(value) { resume("next", value); }
|
|
524
|
-
function reject(value) { resume("throw", value); }
|
|
525
|
-
function settle(f, v) { if (f(v), q.shift(), q.length)
|
|
526
|
-
resume(q[0][0], q[0][1]); }
|
|
527
|
-
}
|
|
528
|
-
function __asyncDelegator(o) {
|
|
529
|
-
var i, p;
|
|
530
|
-
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
531
|
-
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
|
532
|
-
}
|
|
533
|
-
function __asyncValues(o) {
|
|
534
|
-
if (!Symbol.asyncIterator)
|
|
535
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
536
|
-
var m = o[Symbol.asyncIterator], i;
|
|
537
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
538
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
539
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
|
540
|
-
}
|
|
541
|
-
function __makeTemplateObject(cooked, raw) {
|
|
542
|
-
if (Object.defineProperty) {
|
|
543
|
-
Object.defineProperty(cooked, "raw", { value: raw });
|
|
544
|
-
}
|
|
545
|
-
else {
|
|
546
|
-
cooked.raw = raw;
|
|
547
|
-
}
|
|
548
|
-
return cooked;
|
|
549
|
-
}
|
|
550
|
-
;
|
|
551
|
-
var __setModuleDefault = Object.create ? (function (o, v) {
|
|
552
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
553
|
-
}) : function (o, v) {
|
|
554
|
-
o["default"] = v;
|
|
555
|
-
};
|
|
556
|
-
function __importStar(mod) {
|
|
557
|
-
if (mod && mod.__esModule)
|
|
558
|
-
return mod;
|
|
559
|
-
var result = {};
|
|
560
|
-
if (mod != null)
|
|
561
|
-
for (var k in mod)
|
|
562
|
-
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
563
|
-
__createBinding(result, mod, k);
|
|
564
|
-
__setModuleDefault(result, mod);
|
|
565
|
-
return result;
|
|
566
|
-
}
|
|
567
|
-
function __importDefault(mod) {
|
|
568
|
-
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
569
|
-
}
|
|
570
|
-
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
571
|
-
if (kind === "a" && !f)
|
|
572
|
-
throw new TypeError("Private accessor was defined without a getter");
|
|
573
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
574
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
575
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
576
|
-
}
|
|
577
|
-
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
578
|
-
if (kind === "m")
|
|
579
|
-
throw new TypeError("Private method is not writable");
|
|
580
|
-
if (kind === "a" && !f)
|
|
581
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
582
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
583
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
584
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
var PasswordStrengthBarComponent = /** @class */ (function () {
|
|
588
|
-
function PasswordStrengthBarComponent() {
|
|
589
|
-
this._colors = ['#F00', '#F90', '#FF0', '#9F0', '#0F0'];
|
|
590
|
-
this.strengthChange = new i0.EventEmitter();
|
|
591
|
-
this.strengthChange = new i0.EventEmitter();
|
|
592
|
-
this.bars = [];
|
|
593
|
-
}
|
|
594
|
-
PasswordStrengthBarComponent.prototype.measureStrength = function (p) {
|
|
595
|
-
var e_1, _a;
|
|
596
|
-
var force = 0;
|
|
597
|
-
var regex = /[$-/:-?{-~!"^_`\[\]]/g; // "
|
|
598
|
-
var lowerLetters = /[a-z]+/.test(p);
|
|
599
|
-
var upperLetters = /[A-Z]+/.test(p);
|
|
600
|
-
var numbers = /[0-9]+/.test(p);
|
|
601
|
-
var symbols = regex.test(p);
|
|
602
|
-
var flags = [lowerLetters, upperLetters, numbers, symbols];
|
|
603
|
-
var passedMatches = 0;
|
|
604
|
-
try {
|
|
605
|
-
for (var flags_1 = __values(flags), flags_1_1 = flags_1.next(); !flags_1_1.done; flags_1_1 = flags_1.next()) {
|
|
606
|
-
var flag = flags_1_1.value;
|
|
607
|
-
passedMatches += flag === true ? 1 : 0;
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
611
|
-
finally {
|
|
612
|
-
try {
|
|
613
|
-
if (flags_1_1 && !flags_1_1.done && (_a = flags_1.return)) _a.call(flags_1);
|
|
614
|
-
}
|
|
615
|
-
finally { if (e_1) throw e_1.error; }
|
|
616
|
-
}
|
|
617
|
-
force += 2 * p.length + (p.length >= 10 ? 1 : 0);
|
|
618
|
-
force += passedMatches * 10;
|
|
619
|
-
// penalty (short password)
|
|
620
|
-
force = p.length <= 6 ? Math.min(force, 10) : force;
|
|
621
|
-
// penalty (poor letiety of characters)
|
|
622
|
-
force = passedMatches === 1 ? Math.min(force, 10) : force;
|
|
623
|
-
force = passedMatches === 2 ? Math.min(force, 20) : force;
|
|
624
|
-
force = passedMatches === 3 ? Math.min(force, 40) : force;
|
|
625
|
-
return force;
|
|
626
|
-
};
|
|
627
|
-
PasswordStrengthBarComponent.prototype.getColor = function (s) {
|
|
628
|
-
var idx = 0;
|
|
629
|
-
if (s <= 10) {
|
|
630
|
-
idx = 0;
|
|
631
|
-
}
|
|
632
|
-
else if (s <= 20) {
|
|
633
|
-
idx = 1;
|
|
634
|
-
}
|
|
635
|
-
else if (s <= 30) {
|
|
636
|
-
idx = 2;
|
|
637
|
-
}
|
|
638
|
-
else if (s <= 40) {
|
|
639
|
-
idx = 3;
|
|
640
|
-
}
|
|
641
|
-
else {
|
|
642
|
-
idx = 4;
|
|
643
|
-
}
|
|
644
|
-
return {
|
|
645
|
-
idx: idx + 1,
|
|
646
|
-
col: this._colors[idx],
|
|
647
|
-
};
|
|
648
|
-
};
|
|
649
|
-
PasswordStrengthBarComponent.prototype.ngOnChanges = function (changes) {
|
|
650
|
-
var password = changes['passwordToCheck'].currentValue;
|
|
651
|
-
this.setBarColors(5, '#DDD');
|
|
652
|
-
if (password) {
|
|
653
|
-
var strength = this.measureStrength(password);
|
|
654
|
-
var c = this.getColor(strength);
|
|
655
|
-
this.setBarColors(c.idx, c.col);
|
|
656
|
-
this.strengthChange.emit(strength);
|
|
657
|
-
}
|
|
658
|
-
};
|
|
659
|
-
PasswordStrengthBarComponent.prototype.setBarColors = function (count, col) {
|
|
660
|
-
for (var n = 0; n < count; n++) {
|
|
661
|
-
this.bars[n] = col;
|
|
662
|
-
}
|
|
663
|
-
};
|
|
664
|
-
return PasswordStrengthBarComponent;
|
|
665
|
-
}());
|
|
666
|
-
PasswordStrengthBarComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: PasswordStrengthBarComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
667
|
-
PasswordStrengthBarComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: PasswordStrengthBarComponent, selector: "auth-jwt-password-strength-bar", inputs: { passwordToCheck: "passwordToCheck" }, outputs: { strengthChange: "strengthChange" }, usesOnChanges: true, ngImport: i0__namespace, template: "<div id=\"strength\">\n <small>strength:</small>\n <ul id=\"strengthBar\">\n <li class=\"point\" [style.background-color]=\"bars[0]\"></li>\n <li class=\"point\" [style.background-color]=\"bars[1]\"></li>\n <li class=\"point\" [style.background-color]=\"bars[2]\"></li>\n <li class=\"point\" [style.background-color]=\"bars[3]\"></li>\n <li class=\"point\" [style.background-color]=\"bars[4]\"></li>\n </ul>\n</div>\n", styles: ["ul#strengthBar{display:inline;list-style:none;margin:0 0 0 15px;padding:0;vertical-align:2px}li.point:last{margin:0!important}li.point{background:#ddd;border-radius:2px;display:inline-block;height:5px;margin-right:1px;width:20px}\n"] });
|
|
668
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: PasswordStrengthBarComponent, decorators: [{
|
|
669
|
-
type: i0.Component,
|
|
670
|
-
args: [{
|
|
671
|
-
selector: 'auth-jwt-password-strength-bar',
|
|
672
|
-
templateUrl: './password-strength-bar.component.html',
|
|
673
|
-
styleUrls: ['./password-strength-bar.component.css'],
|
|
674
|
-
}]
|
|
675
|
-
}], ctorParameters: function () { return []; }, propDecorators: { passwordToCheck: [{
|
|
676
|
-
type: i0.Input
|
|
677
|
-
}], strengthChange: [{
|
|
678
|
-
type: i0.Output
|
|
679
|
-
}] } });
|
|
680
|
-
|
|
681
|
-
var AuthJwtRegistrationComponent = /** @class */ (function () {
|
|
682
|
-
function AuthJwtRegistrationComponent(formBuilder, _snackbar, _accountService) {
|
|
683
|
-
this._snackbar = _snackbar;
|
|
684
|
-
this._accountService = _accountService;
|
|
685
|
-
this.registered = new i0.EventEmitter();
|
|
686
|
-
// form
|
|
687
|
-
this.email = formBuilder.control('', [i1$1.Validators.required, i1$1.Validators.email], this.getUniqueEmailValidator(this._accountService).bind(this));
|
|
688
|
-
this.name = formBuilder.control('', i1$1.Validators.required, this.getUniqueNameValidator(this._accountService).bind(this));
|
|
689
|
-
this.firstName = formBuilder.control('', [
|
|
690
|
-
i1$1.Validators.required,
|
|
691
|
-
i1$1.Validators.maxLength(50),
|
|
692
|
-
]);
|
|
693
|
-
this.lastName = formBuilder.control('', [
|
|
694
|
-
i1$1.Validators.required,
|
|
695
|
-
i1$1.Validators.maxLength(50),
|
|
696
|
-
]);
|
|
697
|
-
// http://stackoverflow.com/questions/35474991/angular-2-form-validating-for-repeat-password
|
|
698
|
-
this.password = formBuilder.control('', i1$1.Validators.compose([i1$1.Validators.required, PasswordValidators.standard]));
|
|
699
|
-
this.confirmPassword = formBuilder.control('', i1$1.Validators.required);
|
|
700
|
-
this.passwords = formBuilder.group({
|
|
701
|
-
password: this.password,
|
|
702
|
-
confirmPassword: this.confirmPassword,
|
|
703
|
-
}, { validator: this.areEqual.bind(this) });
|
|
704
|
-
this.registration = formBuilder.group({
|
|
705
|
-
email: this.email,
|
|
706
|
-
name: this.name,
|
|
707
|
-
firstName: this.firstName,
|
|
708
|
-
lastName: this.lastName,
|
|
709
|
-
passwords: this.passwords,
|
|
710
|
-
});
|
|
711
|
-
}
|
|
712
|
-
AuthJwtRegistrationComponent.prototype.areEqual = function (group) {
|
|
713
|
-
if (this.password.value === this.confirmPassword.value) {
|
|
714
|
-
return null;
|
|
715
|
-
}
|
|
716
|
-
return {
|
|
717
|
-
areEqual: true,
|
|
718
|
-
};
|
|
719
|
-
};
|
|
720
|
-
/**
|
|
721
|
-
* Creates a unique name validator. There is no dependency injection at this level,
|
|
722
|
-
* but we can use closures. As a matter of fact, we have access to the service instance
|
|
723
|
-
* from the component where we register validators. So we will implement a function
|
|
724
|
-
* that will accept the service as parameter, and create the actual validation function.
|
|
725
|
-
* This function will have access to the service when called during the validation process.
|
|
726
|
-
* See http://restlet.com/blog/2016/02/17/implementing-angular2-forms-beyond-basics-part-2/.
|
|
727
|
-
*/
|
|
728
|
-
AuthJwtRegistrationComponent.prototype.getUniqueNameValidator = function (service) {
|
|
729
|
-
return function (control) {
|
|
730
|
-
return new Promise(function (resolve, reject) {
|
|
731
|
-
// avoid checking if empty
|
|
732
|
-
if (!control.value) {
|
|
733
|
-
resolve(null);
|
|
734
|
-
}
|
|
735
|
-
else {
|
|
736
|
-
service.isNameRegistered(control.value).subscribe(function (data) {
|
|
737
|
-
if (!data.isExisting) {
|
|
738
|
-
resolve(null);
|
|
739
|
-
}
|
|
740
|
-
else {
|
|
741
|
-
resolve({ uniqueName: true });
|
|
742
|
-
}
|
|
743
|
-
}, function (err) {
|
|
744
|
-
resolve({ uniqueName: true });
|
|
745
|
-
});
|
|
746
|
-
}
|
|
747
|
-
});
|
|
748
|
-
};
|
|
749
|
-
};
|
|
750
|
-
AuthJwtRegistrationComponent.prototype.getUniqueEmailValidator = function (service) {
|
|
751
|
-
return function (control) {
|
|
752
|
-
return new Promise(function (resolve, reject) {
|
|
753
|
-
// avoid checking if empty
|
|
754
|
-
if (!control.value) {
|
|
755
|
-
resolve(null);
|
|
756
|
-
}
|
|
757
|
-
else {
|
|
758
|
-
service.isEmailRegistered(control.value).subscribe(function (data) {
|
|
759
|
-
if (!data.isExisting) {
|
|
760
|
-
resolve(null);
|
|
761
|
-
}
|
|
762
|
-
else {
|
|
763
|
-
resolve({ uniqueEmail: true });
|
|
764
|
-
}
|
|
765
|
-
}, function (err) {
|
|
766
|
-
resolve({ uniqueEmail: true });
|
|
767
|
-
});
|
|
768
|
-
}
|
|
769
|
-
});
|
|
770
|
-
};
|
|
771
|
-
};
|
|
772
|
-
AuthJwtRegistrationComponent.prototype.ngOnInit = function () { };
|
|
773
|
-
AuthJwtRegistrationComponent.prototype.getEmailErrorLabel = function () {
|
|
774
|
-
if (!this.email.dirty) {
|
|
775
|
-
return null;
|
|
776
|
-
}
|
|
777
|
-
if (this.email.hasError('required')) {
|
|
778
|
-
return 'email address required';
|
|
779
|
-
}
|
|
780
|
-
if (this.email.hasError('email')) {
|
|
781
|
-
return 'invalid email address';
|
|
782
|
-
}
|
|
783
|
-
if (this.email.hasError('uniqueEmail') && !this.email.pending) {
|
|
784
|
-
return 'email address already registered';
|
|
785
|
-
}
|
|
786
|
-
return null;
|
|
787
|
-
};
|
|
788
|
-
AuthJwtRegistrationComponent.prototype.getNameErrorLabel = function () {
|
|
789
|
-
if (!this.name.dirty) {
|
|
790
|
-
return null;
|
|
791
|
-
}
|
|
792
|
-
if (this.name.hasError('required')) {
|
|
793
|
-
return 'username required';
|
|
794
|
-
}
|
|
795
|
-
if (this.name.hasError('pattern')) {
|
|
796
|
-
return 'invalid username';
|
|
797
|
-
}
|
|
798
|
-
if (this.name.hasError('uniqueName') && !this.name.pending) {
|
|
799
|
-
return 'username already taken';
|
|
800
|
-
}
|
|
801
|
-
return null;
|
|
802
|
-
};
|
|
803
|
-
AuthJwtRegistrationComponent.prototype.getPasswordErrorLabel = function () {
|
|
804
|
-
if (!this.password.dirty) {
|
|
805
|
-
return null;
|
|
806
|
-
}
|
|
807
|
-
if (this.password.hasError('required')) {
|
|
808
|
-
return 'password required';
|
|
809
|
-
}
|
|
810
|
-
if (this.password.hasError('passwordTooShort')) {
|
|
811
|
-
var s = 'at least 8 characters';
|
|
812
|
-
if (this.password.value) {
|
|
813
|
-
s += " (now " + this.password.value.length + ")";
|
|
814
|
-
}
|
|
815
|
-
return s;
|
|
816
|
-
}
|
|
817
|
-
if (this.password.hasError('noUpperInPassword')) {
|
|
818
|
-
return 'at least 1 uppercase letter';
|
|
819
|
-
}
|
|
820
|
-
if (this.password.hasError('noLowerInPassword')) {
|
|
821
|
-
return 'at least 1 lowercase letter';
|
|
822
|
-
}
|
|
823
|
-
if (this.password.hasError('noSymbolInPassword')) {
|
|
824
|
-
return 'at least 1 punctuation or symbol';
|
|
825
|
-
}
|
|
826
|
-
return null;
|
|
827
|
-
};
|
|
828
|
-
AuthJwtRegistrationComponent.prototype.onSubmit = function () {
|
|
829
|
-
var _this = this;
|
|
830
|
-
if (!this.registration.valid ||
|
|
831
|
-
this.busy ||
|
|
832
|
-
this.name.pending ||
|
|
833
|
-
this.email.pending) {
|
|
834
|
-
return;
|
|
835
|
-
}
|
|
836
|
-
var model = {
|
|
837
|
-
email: this.email.value,
|
|
838
|
-
name: this.name.value,
|
|
839
|
-
firstName: this.firstName.value,
|
|
840
|
-
lastName: this.lastName.value,
|
|
841
|
-
password: this.password.value,
|
|
842
|
-
};
|
|
843
|
-
this.busy = true;
|
|
844
|
-
this._accountService
|
|
845
|
-
.register(model)
|
|
846
|
-
.pipe(operators.take(1))
|
|
847
|
-
.subscribe(function () {
|
|
848
|
-
_this.busy = false;
|
|
849
|
-
_this._snackbar.open('Registration succeeded', 'OK');
|
|
850
|
-
// this.registration.reset();
|
|
851
|
-
// this.registration.clearValidators();
|
|
852
|
-
// this.registration.markAsPristine();
|
|
853
|
-
_this.registered.emit();
|
|
854
|
-
}, function (error) {
|
|
855
|
-
_this.busy = false;
|
|
856
|
-
console.error(error);
|
|
857
|
-
_this._snackbar.open('Registration error', 'OK');
|
|
858
|
-
});
|
|
859
|
-
};
|
|
860
|
-
return AuthJwtRegistrationComponent;
|
|
861
|
-
}());
|
|
862
|
-
AuthJwtRegistrationComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: AuthJwtRegistrationComponent, deps: [{ token: i1__namespace$1.FormBuilder }, { token: i2__namespace$1.MatSnackBar }, { token: AuthJwtAccountService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
863
|
-
AuthJwtRegistrationComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: AuthJwtRegistrationComponent, selector: "auth-jwt-registration", outputs: { registered: "registered" }, ngImport: i0__namespace, template: "<div>\n <div>\n <p>\n To register a new user, you must provide his email address, choose a\n password, and choose a username, which must be unique (you will be\n notified if another user has already taken that name). The username must\n include only letters/digits, start with a letter, and be no shorter than 3\n characters, nor longer than 50.\n </p>\n <p>\n To promote a decent security level, the password must include at least 8\n characters, uppercase and lowercase letters, digits, and punctuation (like\n dashes, stops, parentheses, etc.).\n </p>\n <p>\n Once registered, the user will receive an email message to the email\n address you specified; he will have to click on the provided link to\n complete the registration process.\n </p>\n </div>\n\n <form role=\"form\" [formGroup]=\"registration\" (submit)=\"onSubmit()\">\n <fieldset>\n <label>register user</label>\n <!-- email -->\n <div>\n <mat-form-field>\n <input\n matInput\n type=\"email\"\n id=\"email\"\n maxlength=\"256\"\n required\n autofocus\n spellcheck=\"false\"\n placeholder=\"email\"\n formControlName=\"email\"\n />\n <mat-error>{{ getEmailErrorLabel() }}</mat-error>\n <mat-icon *ngIf=\"email.pending\">hourglass</mat-icon>\n </mat-form-field>\n </div>\n\n <!-- name -->\n <div>\n <mat-form-field>\n <input\n matInput\n type=\"text\"\n id=\"name\"\n maxlength=\"50\"\n required\n pattern=\"^[a-zA-Z][a-zA-Z0-9]{2,49}$\"\n spellcheck=\"false\"\n placeholder=\"username\"\n formControlName=\"name\"\n />\n <mat-error>{{ getNameErrorLabel() }}</mat-error>\n <mat-icon *ngIf=\"name.pending\">hourglass</mat-icon>\n </mat-form-field>\n </div>\n\n <!-- first name -->\n <div>\n <mat-form-field>\n <input\n matInput\n type=\"text\"\n id=\"firstName\"\n maxlength=\"50\"\n required\n spellcheck=\"false\"\n placeholder=\"first name\"\n formControlName=\"firstName\"\n />\n <mat-error\n *ngIf=\"\n firstName.hasError('required') &&\n (firstName.dirty || firstName.touched)\n \"\n class=\"text-danger small\"\n >\n first name required\n </mat-error>\n </mat-form-field>\n </div>\n\n <!-- last name -->\n <div>\n <mat-form-field>\n <input\n matInput\n type=\"text\"\n id=\"lastName\"\n maxlength=\"50\"\n required\n spellcheck=\"false\"\n placeholder=\"last name\"\n formControlName=\"lastName\"\n />\n <mat-error\n *ngIf=\"\n lastName.hasError('required') &&\n (lastName.dirty || lastName.touched)\n \"\n class=\"text-danger small\"\n >\n last name required\n </mat-error>\n </mat-form-field>\n </div>\n\n <div [formGroup]=\"passwords\">\n <!-- password -->\n <div>\n <mat-form-field>\n <input\n matInput\n type=\"password\"\n name=\"password\"\n autocomplete=\"new-password\"\n maxlength=\"50\"\n required\n spellcheck=\"false\"\n placeholder=\"password\"\n formControlName=\"password\"\n />\n <auth-jwt-password-strength-bar [passwordToCheck]=\"password.value\">\n </auth-jwt-password-strength-bar>\n <mat-error>{{ getPasswordErrorLabel() }}</mat-error>\n </mat-form-field>\n </div>\n\n <!-- confirm password -->\n <div>\n <mat-form-field>\n <input\n matInput\n type=\"password\"\n name=\"confirmPassword\"\n maxlength=\"50\"\n required\n spellcheck=\"false\"\n placeholder=\"confirm password\"\n formControlName=\"confirmPassword\"\n />\n <mat-error\n *ngIf=\"\n passwords.hasError('areEqual') &&\n (confirmPassword.dirty || confirmPassword.touched)\n \"\n >\n password differs from confirmation password\n </mat-error>\n </mat-form-field>\n </div>\n </div>\n\n <button\n mat-raised-button\n type=\"submit\"\n color=\"primary\"\n [disabled]=\"\n !registration.valid || busy || name.pending || email.pending\n \"\n >\n register\n </button>\n <mat-progress-spinner\n diameter=\"20\"\n *ngIf=\"busy\"\n aria-label=\"Busy\"\n ></mat-progress-spinner>\n </fieldset>\n </form>\n</div>\n", styles: ["mat-form-field{width:400px}fieldset{border:1px solid silver;border-radius:8px;padding:16px}\n"], components: [{ type: i4__namespace.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i6__namespace.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: PasswordStrengthBarComponent, selector: "auth-jwt-password-strength-bar", inputs: ["passwordToCheck"], outputs: ["strengthChange"] }, { type: i5__namespace.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i8__namespace.MatProgressSpinner, selector: "mat-progress-spinner", inputs: ["color", "mode", "diameter", "strokeWidth", "value"], exportAs: ["matProgressSpinner"] }], directives: [{ type: i1__namespace$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i1__namespace$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i1__namespace$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i7__namespace.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i1__namespace$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i1__namespace$1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { type: i1__namespace$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { type: i1__namespace$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1__namespace$1.FormControlName, selector: "[formControlName]", inputs: ["disabled", "formControlName", "ngModel"], outputs: ["ngModelChange"] }, { type: i4__namespace.MatError, selector: "mat-error", inputs: ["id"] }, { type: i13__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1__namespace$1.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }] });
|
|
864
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: AuthJwtRegistrationComponent, decorators: [{
|
|
865
|
-
type: i0.Component,
|
|
866
|
-
args: [{
|
|
867
|
-
selector: 'auth-jwt-registration',
|
|
868
|
-
templateUrl: './auth-jwt-registration.component.html',
|
|
869
|
-
styleUrls: ['./auth-jwt-registration.component.css'],
|
|
870
|
-
}]
|
|
871
|
-
}], ctorParameters: function () { return [{ type: i1__namespace$1.FormBuilder }, { type: i2__namespace$1.MatSnackBar }, { type: AuthJwtAccountService }]; }, propDecorators: { registered: [{
|
|
872
|
-
type: i0.Output
|
|
873
|
-
}] } });
|
|
874
|
-
|
|
875
|
-
var initialState = {
|
|
876
|
-
filter: {
|
|
877
|
-
pageNumber: 1,
|
|
878
|
-
pageSize: 20,
|
|
879
|
-
},
|
|
880
|
-
active: null
|
|
881
|
-
};
|
|
882
|
-
var UsersStore = /** @class */ (function (_super) {
|
|
883
|
-
__extends(UsersStore, _super);
|
|
884
|
-
function UsersStore() {
|
|
885
|
-
return _super.call(this, initialState) || this;
|
|
886
|
-
}
|
|
887
|
-
return UsersStore;
|
|
888
|
-
}(i15.EntityStore));
|
|
889
|
-
UsersStore.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: UsersStore, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
890
|
-
UsersStore.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: UsersStore, providedIn: 'root' });
|
|
891
|
-
UsersStore = __decorate([
|
|
892
|
-
i15.StoreConfig({ name: 'Users', idKey: 'userName', resettable: true })
|
|
893
|
-
], UsersStore);
|
|
894
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: UsersStore, decorators: [{
|
|
895
|
-
type: i0.Injectable,
|
|
896
|
-
args: [{ providedIn: 'root' }]
|
|
897
|
-
}], ctorParameters: function () { return []; } });
|
|
898
|
-
|
|
899
|
-
var UsersQuery = /** @class */ (function (_super) {
|
|
900
|
-
__extends(UsersQuery, _super);
|
|
901
|
-
function UsersQuery(_store) {
|
|
902
|
-
var _this = _super.call(this, _store) || this;
|
|
903
|
-
_this._store = _store;
|
|
904
|
-
return _this;
|
|
905
|
-
}
|
|
906
|
-
UsersQuery.prototype.selectFilter = function () {
|
|
907
|
-
return this.select(function (state) { return state.filter; });
|
|
908
|
-
};
|
|
909
|
-
return UsersQuery;
|
|
910
|
-
}(i15.QueryEntity));
|
|
911
|
-
UsersQuery.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: UsersQuery, deps: [{ token: UsersStore }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
912
|
-
UsersQuery.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: UsersQuery, providedIn: 'root' });
|
|
913
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: UsersQuery, decorators: [{
|
|
914
|
-
type: i0.Injectable,
|
|
915
|
-
args: [{ providedIn: 'root' }]
|
|
916
|
-
}], ctorParameters: function () { return [{ type: UsersStore }]; } });
|
|
917
|
-
|
|
918
|
-
var UsersService = /** @class */ (function () {
|
|
919
|
-
function UsersService(_store, _accountService) {
|
|
920
|
-
this._store = _store;
|
|
921
|
-
this._accountService = _accountService;
|
|
922
|
-
}
|
|
923
|
-
/**
|
|
924
|
-
* Update the filter in the store.
|
|
925
|
-
* @param filter The filter.
|
|
926
|
-
*/
|
|
927
|
-
UsersService.prototype.updateFilter = function (filter) {
|
|
928
|
-
this._store.update({
|
|
929
|
-
filter: filter,
|
|
930
|
-
});
|
|
931
|
-
};
|
|
932
|
-
UsersService.prototype.setActive = function (name) {
|
|
933
|
-
this._store.setActive(name);
|
|
934
|
-
};
|
|
935
|
-
UsersService.prototype.updateActive = function (user) {
|
|
936
|
-
var _this = this;
|
|
937
|
-
var promise = new Promise(function (resolve, reject) {
|
|
938
|
-
_this._store.setLoading(true);
|
|
939
|
-
_this._accountService.updateUser(user).subscribe(function (_) {
|
|
940
|
-
_this._store.setLoading(false);
|
|
941
|
-
_this._store.setError(null);
|
|
942
|
-
_this._store.updateActive(function (u) {
|
|
943
|
-
return Object.assign({}, user);
|
|
944
|
-
});
|
|
945
|
-
resolve(true);
|
|
946
|
-
}, function (error) {
|
|
947
|
-
console.error(error);
|
|
948
|
-
_this._store.setLoading(false);
|
|
949
|
-
_this._store.setError('Error updating user');
|
|
950
|
-
resolve(false);
|
|
951
|
-
});
|
|
952
|
-
});
|
|
953
|
-
return promise;
|
|
954
|
-
};
|
|
955
|
-
UsersService.prototype.deleteUser = function (name) {
|
|
956
|
-
var _this = this;
|
|
957
|
-
var promise = new Promise(function (resolve, reject) {
|
|
958
|
-
_this._store.setLoading(true);
|
|
959
|
-
_this._accountService.deleteUser(name).subscribe(function (_) {
|
|
960
|
-
_this._store.setLoading(false);
|
|
961
|
-
_this._store.setError(null);
|
|
962
|
-
_this._store.remove(name);
|
|
963
|
-
resolve(true);
|
|
964
|
-
}, function (error) {
|
|
965
|
-
console.error(error);
|
|
966
|
-
_this._store.setLoading(false);
|
|
967
|
-
_this._store.setError('Error deleting user');
|
|
968
|
-
reject(error);
|
|
969
|
-
});
|
|
970
|
-
});
|
|
971
|
-
return promise;
|
|
972
|
-
};
|
|
973
|
-
return UsersService;
|
|
974
|
-
}());
|
|
975
|
-
UsersService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: UsersService, deps: [{ token: UsersStore }, { token: AuthJwtAccountService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
976
|
-
UsersService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: UsersService, providedIn: 'root' });
|
|
977
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: UsersService, decorators: [{
|
|
978
|
-
type: i0.Injectable,
|
|
979
|
-
args: [{ providedIn: 'root' }]
|
|
980
|
-
}], ctorParameters: function () { return [{ type: UsersStore }, { type: AuthJwtAccountService }]; } });
|
|
981
|
-
|
|
982
|
-
var UserFilterComponent = /** @class */ (function () {
|
|
983
|
-
function UserFilterComponent(formBuilder, query, _corporaService) {
|
|
984
|
-
this._corporaService = _corporaService;
|
|
985
|
-
this.filter$ = query.selectFilter();
|
|
986
|
-
// form
|
|
987
|
-
this.name = formBuilder.control(null);
|
|
988
|
-
this.form = formBuilder.group({
|
|
989
|
-
name: this.name,
|
|
990
|
-
});
|
|
991
|
-
}
|
|
992
|
-
UserFilterComponent.prototype.ngOnInit = function () {
|
|
993
|
-
var _this = this;
|
|
994
|
-
this.filter$.subscribe(function (f) {
|
|
995
|
-
_this.updateForm(f);
|
|
996
|
-
});
|
|
997
|
-
};
|
|
998
|
-
UserFilterComponent.prototype.updateForm = function (filter) {
|
|
999
|
-
this.name.setValue(filter.name);
|
|
1000
|
-
this.form.markAsPristine();
|
|
1001
|
-
};
|
|
1002
|
-
UserFilterComponent.prototype.reset = function () {
|
|
1003
|
-
this.form.reset();
|
|
1004
|
-
this.apply();
|
|
1005
|
-
};
|
|
1006
|
-
UserFilterComponent.prototype.getFilter = function () {
|
|
1007
|
-
var _a;
|
|
1008
|
-
return {
|
|
1009
|
-
pageNumber: 1,
|
|
1010
|
-
pageSize: 20,
|
|
1011
|
-
name: (_a = this.name.value) === null || _a === void 0 ? void 0 : _a.trim(),
|
|
1012
|
-
};
|
|
1013
|
-
};
|
|
1014
|
-
UserFilterComponent.prototype.apply = function () {
|
|
1015
|
-
if (this.form.invalid) {
|
|
1016
|
-
return;
|
|
1017
|
-
}
|
|
1018
|
-
var filter = this.getFilter();
|
|
1019
|
-
// update filter in state
|
|
1020
|
-
this._corporaService.updateFilter(filter);
|
|
1021
|
-
};
|
|
1022
|
-
return UserFilterComponent;
|
|
1023
|
-
}());
|
|
1024
|
-
UserFilterComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: UserFilterComponent, deps: [{ token: i1__namespace$1.FormBuilder }, { token: UsersQuery }, { token: UsersService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
1025
|
-
UserFilterComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: UserFilterComponent, selector: "auth-jwt-user-filter", inputs: { disabled: "disabled" }, ngImport: i0__namespace, template: "<form [formGroup]=\"form\" (submit)=\"apply()\" ng-disabled=\"disabled\">\n <mat-form-field>\n <input matInput [formControl]=\"name\" placeholder=\"name or ID\" />\n <button\n mat-icon-button\n matSuffix\n type=\"button\"\n (click)=\"reset()\"\n color=\"warn\"\n matTooltip=\"Reset filters\"\n [disabled]=\"disabled\"\n >\n <mat-icon>clear</mat-icon>\n </button>\n </mat-form-field>\n\n <button\n type=\"submit\"\n mat-icon-button\n color=\"primary\"\n [disabled]=\"disabled\"\n matTooltip=\"Apply filters\"\n >\n <mat-icon>check_circle</mat-icon>\n </button>\n</form>\n", styles: [""], components: [{ type: i4__namespace.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i5__namespace.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i6__namespace.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i1__namespace$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i1__namespace$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i1__namespace$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i7__namespace.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i1__namespace$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i1__namespace$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1__namespace$1.FormControlDirective, selector: "[formControl]", inputs: ["disabled", "formControl", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i4__namespace.MatSuffix, selector: "[matSuffix]" }, { type: i8__namespace$1.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }] });
|
|
1026
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: UserFilterComponent, decorators: [{
|
|
1027
|
-
type: i0.Component,
|
|
1028
|
-
args: [{
|
|
1029
|
-
selector: 'auth-jwt-user-filter',
|
|
1030
|
-
templateUrl: './user-filter.component.html',
|
|
1031
|
-
styleUrls: ['./user-filter.component.css'],
|
|
1032
|
-
}]
|
|
1033
|
-
}], ctorParameters: function () { return [{ type: i1__namespace$1.FormBuilder }, { type: UsersQuery }, { type: UsersService }]; }, propDecorators: { disabled: [{
|
|
1034
|
-
type: i0.Input
|
|
1035
|
-
}] } });
|
|
1036
|
-
|
|
1037
|
-
// create a factory provider for the paginator
|
|
1038
|
-
var USERS_PAGINATOR = new i0.InjectionToken('USERS_PAGINATOR', {
|
|
1039
|
-
providedIn: 'root',
|
|
1040
|
-
factory: function () {
|
|
1041
|
-
var query = i0.inject(UsersQuery);
|
|
1042
|
-
return new i15.PaginatorPlugin(query).withControls().withRange();
|
|
1043
|
-
},
|
|
1044
|
-
});
|
|
1045
|
-
|
|
1046
|
-
// https://medium.com/@tarik.nzl/making-use-of-dialogs-in-material-2-mddialog-7533d27df41
|
|
1047
|
-
var ConfirmDialogComponent = /** @class */ (function () {
|
|
1048
|
-
function ConfirmDialogComponent(dialogRef, data) {
|
|
1049
|
-
this.dialogRef = dialogRef;
|
|
1050
|
-
this.data = data;
|
|
1051
|
-
this.title = 'Confirm';
|
|
1052
|
-
this.prompt = 'Confirm operation?';
|
|
1053
|
-
this.ok = 'yes';
|
|
1054
|
-
this.cancel = 'no';
|
|
1055
|
-
}
|
|
1056
|
-
ConfirmDialogComponent.prototype.ngOnInit = function () { };
|
|
1057
|
-
return ConfirmDialogComponent;
|
|
1058
|
-
}());
|
|
1059
|
-
ConfirmDialogComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: ConfirmDialogComponent, deps: [{ token: i1__namespace$2.MatDialogRef }, { token: i1$2.MAT_DIALOG_DATA, optional: true }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
1060
|
-
ConfirmDialogComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: ConfirmDialogComponent, selector: "ng-component", ngImport: i0__namespace, template: "<h1 mat-dialog-title>{{ title }}</h1>\r\n<mat-dialog-content>\r\n {{ prompt }}\r\n</mat-dialog-content>\r\n<mat-dialog-actions>\r\n <button\r\n type=\"button\"\r\n mat-raised-button\r\n color=\"warn\"\r\n (click)=\"dialogRef.close(true)\"\r\n >\r\n {{ ok }}\r\n </button>\r\n <button type=\"button\" mat-button (click)=\"dialogRef.close()\">\r\n {{ cancel }}\r\n </button>\r\n</mat-dialog-actions>\r\n", styles: [""], components: [{ type: i5__namespace.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i1__namespace$2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i1__namespace$2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i1__namespace$2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }] });
|
|
1061
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: ConfirmDialogComponent, decorators: [{
|
|
1062
|
-
type: i0.Component,
|
|
1063
|
-
args: [{
|
|
1064
|
-
// https://github.com/angular/components/issues/7718
|
|
1065
|
-
// selector: 'cadmus-confirm-dialog',
|
|
1066
|
-
templateUrl: './confirm-dialog.component.html',
|
|
1067
|
-
styleUrls: ['./confirm-dialog.component.css'],
|
|
1068
|
-
}]
|
|
1069
|
-
}], ctorParameters: function () {
|
|
1070
|
-
return [{ type: i1__namespace$2.MatDialogRef }, { type: undefined, decorators: [{
|
|
1071
|
-
type: i0.Optional
|
|
1072
|
-
}, {
|
|
1073
|
-
type: i0.Inject,
|
|
1074
|
-
args: [i1$2.MAT_DIALOG_DATA]
|
|
1075
|
-
}] }];
|
|
1076
|
-
} });
|
|
1077
|
-
|
|
1078
|
-
// https://medium.com/@tarik.nzl/making-use-of-dialogs-in-material-2-mddialog-7533d27df41
|
|
1079
|
-
/**
|
|
1080
|
-
* This service acts as a wrapper for MatDialog to simplify the process of calling
|
|
1081
|
-
* the dialog and subscribing to it. What it will do is create an Instance of
|
|
1082
|
-
* MatDialog with our custom component (ConfirmDialogComponent). Then it will set
|
|
1083
|
-
* any public properties it needs to by setting the properties on the
|
|
1084
|
-
* componentInstance object. It will return the observable afterClosed()
|
|
1085
|
-
* to the caller so they can subscribe to it. This will emit an event whenever
|
|
1086
|
-
* the dialog is closed.
|
|
1087
|
-
*/
|
|
1088
|
-
var DialogService = /** @class */ (function () {
|
|
1089
|
-
function DialogService(dialog) {
|
|
1090
|
-
this.dialog = dialog;
|
|
1091
|
-
}
|
|
1092
|
-
DialogService.prototype.confirm = function (title, prompt, ok, cancel) {
|
|
1093
|
-
if (ok === void 0) { ok = 'yes'; }
|
|
1094
|
-
if (cancel === void 0) { cancel = 'no'; }
|
|
1095
|
-
var dialogRef;
|
|
1096
|
-
dialogRef = this.dialog.open(ConfirmDialogComponent);
|
|
1097
|
-
dialogRef.componentInstance.title = title;
|
|
1098
|
-
dialogRef.componentInstance.prompt = prompt;
|
|
1099
|
-
dialogRef.componentInstance.ok = ok;
|
|
1100
|
-
dialogRef.componentInstance.cancel = cancel;
|
|
1101
|
-
return dialogRef.afterClosed();
|
|
1102
|
-
};
|
|
1103
|
-
return DialogService;
|
|
1104
|
-
}());
|
|
1105
|
-
DialogService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: DialogService, deps: [{ token: i1__namespace$2.MatDialog }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
1106
|
-
DialogService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: DialogService, providedIn: 'root' });
|
|
1107
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: DialogService, decorators: [{
|
|
1108
|
-
type: i0.Injectable,
|
|
1109
|
-
args: [{
|
|
1110
|
-
providedIn: 'root'
|
|
1111
|
-
}]
|
|
1112
|
-
}], ctorParameters: function () { return [{ type: i1__namespace$2.MatDialog }]; } });
|
|
1113
|
-
|
|
1114
|
-
var UserEditorComponent = /** @class */ (function () {
|
|
1115
|
-
function UserEditorComponent(formBuilder, _authService) {
|
|
1116
|
-
this._authService = _authService;
|
|
1117
|
-
// events
|
|
1118
|
-
this.userChange = new i0.EventEmitter();
|
|
1119
|
-
this.editorClose = new i0.EventEmitter();
|
|
1120
|
-
// form
|
|
1121
|
-
this.email = formBuilder.control(null, [
|
|
1122
|
-
i1$1.Validators.required,
|
|
1123
|
-
i1$1.Validators.email,
|
|
1124
|
-
]);
|
|
1125
|
-
this.emailConfirmed = formBuilder.control(false);
|
|
1126
|
-
this.lockoutEnabled = formBuilder.control(false);
|
|
1127
|
-
this.firstName = formBuilder.control(null, [
|
|
1128
|
-
i1$1.Validators.required,
|
|
1129
|
-
i1$1.Validators.maxLength(50),
|
|
1130
|
-
]);
|
|
1131
|
-
this.lastName = formBuilder.control(null, [
|
|
1132
|
-
i1$1.Validators.required,
|
|
1133
|
-
i1$1.Validators.maxLength(50),
|
|
1134
|
-
]);
|
|
1135
|
-
this.roles = formBuilder.control(null, i1$1.Validators.maxLength(200));
|
|
1136
|
-
this.form = formBuilder.group({
|
|
1137
|
-
email: this.email,
|
|
1138
|
-
emailConfirmed: this.emailConfirmed,
|
|
1139
|
-
lockoutEnabled: this.lockoutEnabled,
|
|
1140
|
-
firstName: this.firstName,
|
|
1141
|
-
lastName: this.lastName,
|
|
1142
|
-
roles: this.roles,
|
|
1143
|
-
});
|
|
1144
|
-
}
|
|
1145
|
-
Object.defineProperty(UserEditorComponent.prototype, "user", {
|
|
1146
|
-
get: function () {
|
|
1147
|
-
return this._user;
|
|
1148
|
-
},
|
|
1149
|
-
set: function (value) {
|
|
1150
|
-
this._user = value;
|
|
1151
|
-
this.updateForm(value);
|
|
1152
|
-
},
|
|
1153
|
-
enumerable: false,
|
|
1154
|
-
configurable: true
|
|
1155
|
-
});
|
|
1156
|
-
UserEditorComponent.prototype.ngOnInit = function () { };
|
|
1157
|
-
UserEditorComponent.prototype.updateForm = function (user) {
|
|
1158
|
-
var _a;
|
|
1159
|
-
if (!user) {
|
|
1160
|
-
this.form.reset();
|
|
1161
|
-
}
|
|
1162
|
-
else {
|
|
1163
|
-
this.email.setValue(user.email);
|
|
1164
|
-
this.emailConfirmed.setValue(user.emailConfirmed);
|
|
1165
|
-
this.lockoutEnabled.setValue(user.lockoutEnabled);
|
|
1166
|
-
this.firstName.setValue(user.firstName);
|
|
1167
|
-
this.lastName.setValue(user.lastName);
|
|
1168
|
-
if (((_a = user.roles) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
1169
|
-
this.roles.setValue(user.roles.join(' '));
|
|
1170
|
-
}
|
|
1171
|
-
else {
|
|
1172
|
-
this.roles.setValue(null);
|
|
1173
|
-
}
|
|
1174
|
-
}
|
|
1175
|
-
};
|
|
1176
|
-
UserEditorComponent.prototype.getUserFromForm = function () {
|
|
1177
|
-
var _a;
|
|
1178
|
-
return {
|
|
1179
|
-
userName: ((_a = this._user) === null || _a === void 0 ? void 0 : _a.userName) || '',
|
|
1180
|
-
email: this.email.value,
|
|
1181
|
-
emailConfirmed: this.emailConfirmed.value,
|
|
1182
|
-
lockoutEnabled: this.lockoutEnabled.value,
|
|
1183
|
-
firstName: this.firstName.value,
|
|
1184
|
-
lastName: this.lastName.value,
|
|
1185
|
-
roles: this.roles.value
|
|
1186
|
-
? this.roles.value.split(' ').filter(function (s) { return s; })
|
|
1187
|
-
: [],
|
|
1188
|
-
};
|
|
1189
|
-
};
|
|
1190
|
-
UserEditorComponent.prototype.endLockout = function () {
|
|
1191
|
-
if (this.unlocked) {
|
|
1192
|
-
return;
|
|
1193
|
-
}
|
|
1194
|
-
this._user.lockoutEnd = this._authService.getUTCDate();
|
|
1195
|
-
this.unlocked = true;
|
|
1196
|
-
};
|
|
1197
|
-
UserEditorComponent.prototype.close = function () {
|
|
1198
|
-
this.editorClose.emit();
|
|
1199
|
-
};
|
|
1200
|
-
UserEditorComponent.prototype.save = function () {
|
|
1201
|
-
if (this.form.invalid) {
|
|
1202
|
-
return;
|
|
1203
|
-
}
|
|
1204
|
-
this.userChange.emit(this.getUserFromForm());
|
|
1205
|
-
};
|
|
1206
|
-
return UserEditorComponent;
|
|
1207
|
-
}());
|
|
1208
|
-
UserEditorComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: UserEditorComponent, deps: [{ token: i1__namespace$1.FormBuilder }, { token: i2__namespace$2.AuthJwtService }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
1209
|
-
UserEditorComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: UserEditorComponent, selector: "auth-jwt-user-editor", inputs: { user: "user" }, outputs: { userChange: "userChange", editorClose: "editorClose" }, ngImport: i0__namespace, template: "<form [formGroup]=\"form\" (submit)=\"save()\">\n <!-- email -->\n <div>\n <mat-form-field>\n <input type=\"text\" matInput [formControl]=\"email\" placeholder=\"email\" />\n <mat-error\n *ngIf=\"email.hasError('required') && (email.dirty || email.touched)\"\n >\n email address required\n </mat-error>\n <mat-error\n *ngIf=\"email.hasError('pattern') && (email.dirty || email.touched)\"\n >\n invalid email address\n </mat-error>\n </mat-form-field>\n </div>\n\n <!-- emailConfirmed -->\n <div>\n <mat-checkbox [formControl]=\"emailConfirmed\"\n >email address confirmed</mat-checkbox\n >\n </div>\n\n <!-- lockoutEnabled -->\n <div>\n <mat-checkbox [formControl]=\"lockoutEnabled\"\n >lockout enabled</mat-checkbox\n >\n \n <button\n mat-stroked-button\n (click)=\"endLockout()\"\n [disabled]=\"unlocked\"\n matTooltip=\"Unlock this user if locked\"\n >\n unlock\n </button>\n </div>\n\n <!-- firstName -->\n <div>\n <mat-form-field>\n <input\n type=\"text\"\n matInput\n [formControl]=\"firstName\"\n placeholder=\"first name\"\n />\n <mat-error\n *ngIf=\"\n firstName.hasError('required') &&\n (firstName.dirty || firstName.touched)\n \"\n >\n first name required\n </mat-error>\n <mat-error\n *ngIf=\"\n firstName.hasError('maxlength') &&\n (firstName.dirty || firstName.touched)\n \"\n >\n first name too long\n </mat-error>\n </mat-form-field>\n </div>\n\n <!-- lastName -->\n <div>\n <mat-form-field>\n <input\n type=\"text\"\n matInput\n [formControl]=\"lastName\"\n placeholder=\"last name\"\n />\n <mat-error\n *ngIf=\"\n lastName.hasError('required') && (lastName.dirty || lastName.touched)\n \"\n >\n last name required\n </mat-error>\n <mat-error\n *ngIf=\"\n lastName.hasError('maxlength') && (lastName.dirty || lastName.touched)\n \"\n >\n last name too long\n </mat-error>\n </mat-form-field>\n </div>\n\n <!-- roles -->\n <div>\n <mat-form-field>\n <input\n type=\"text\"\n matInput\n [formControl]=\"roles\"\n placeholder=\"roles (separated by space)\"\n />\n <mat-error\n *ngIf=\"roles.hasError('maxlength') && (roles.dirty || roles.touched)\"\n >\n too long\n </mat-error>\n </mat-form-field>\n </div>\n\n <!-- buttons -->\n <br />\n <div>\n <button mat-icon-button color=\"warn\" matTooltip=\"Close\" (click)=\"close()\">\n <mat-icon>cancel</mat-icon>\n </button>\n \n <button\n type=\"submit\"\n mat-button\n color=\"primary\"\n [disabled]=\"form.invalid\"\n matTooltip=\"Save user data\"\n >\n <mat-icon>check_circle</mat-icon> save\n </button>\n </div>\n</form>\n", styles: [""], components: [{ type: i4__namespace.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i4__namespace$1.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "id", "labelPosition", "name", "required", "checked", "disabled", "indeterminate", "aria-describedby", "value"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { type: i5__namespace.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i6__namespace.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], directives: [{ type: i1__namespace$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { type: i1__namespace$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i1__namespace$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i7__namespace.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i1__namespace$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i1__namespace$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i1__namespace$1.FormControlDirective, selector: "[formControl]", inputs: ["disabled", "formControl", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i13__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4__namespace.MatError, selector: "mat-error", inputs: ["id"] }, { type: i8__namespace$1.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }] });
|
|
1210
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: UserEditorComponent, decorators: [{
|
|
1211
|
-
type: i0.Component,
|
|
1212
|
-
args: [{
|
|
1213
|
-
selector: 'auth-jwt-user-editor',
|
|
1214
|
-
templateUrl: './user-editor.component.html',
|
|
1215
|
-
styleUrls: ['./user-editor.component.css'],
|
|
1216
|
-
}]
|
|
1217
|
-
}], ctorParameters: function () { return [{ type: i1__namespace$1.FormBuilder }, { type: i2__namespace$2.AuthJwtService }]; }, propDecorators: { user: [{
|
|
1218
|
-
type: i0.Input
|
|
1219
|
-
}], userChange: [{
|
|
1220
|
-
type: i0.Output
|
|
1221
|
-
}], editorClose: [{
|
|
1222
|
-
type: i0.Output
|
|
1223
|
-
}] } });
|
|
1224
|
-
|
|
1225
|
-
var UserListComponent = /** @class */ (function () {
|
|
1226
|
-
function UserListComponent(paginator, userQuery, _accountService, _usersService, _dialogService, _gravatarService, formBuilder) {
|
|
1227
|
-
var _this = this;
|
|
1228
|
-
this.paginator = paginator;
|
|
1229
|
-
this._accountService = _accountService;
|
|
1230
|
-
this._usersService = _usersService;
|
|
1231
|
-
this._dialogService = _dialogService;
|
|
1232
|
-
this._gravatarService = _gravatarService;
|
|
1233
|
-
this.pageSize = formBuilder.control(20);
|
|
1234
|
-
this._refresh$ = new rxjs.BehaviorSubject(0);
|
|
1235
|
-
this._filter$ = userQuery.selectFilter();
|
|
1236
|
-
// https://netbasal.com/manage-your-entities-with-akita-like-a-boss-768732f8d4d1
|
|
1237
|
-
this.active$ = userQuery.selectActive();
|
|
1238
|
-
this.pagination$ = rxjs.combineLatest([
|
|
1239
|
-
this.paginator.pageChanges,
|
|
1240
|
-
this.pageSize.valueChanges.pipe(
|
|
1241
|
-
// we are required to emit at least the initial value
|
|
1242
|
-
// as combineLatest emits only if ALL observables have emitted
|
|
1243
|
-
operators.startWith(20),
|
|
1244
|
-
// clear the cache when page size changes
|
|
1245
|
-
operators.tap(function (_) {
|
|
1246
|
-
_this.paginator.clearCache();
|
|
1247
|
-
})),
|
|
1248
|
-
this._filter$.pipe(
|
|
1249
|
-
// clear the cache when filters changed
|
|
1250
|
-
operators.tap(function (_) {
|
|
1251
|
-
_this.paginator.clearCache();
|
|
1252
|
-
})),
|
|
1253
|
-
this._refresh$.pipe(
|
|
1254
|
-
// clear the cache when forcing refresh
|
|
1255
|
-
operators.tap(function (_) {
|
|
1256
|
-
_this.paginator.clearCache();
|
|
1257
|
-
})),
|
|
1258
|
-
]).pipe(
|
|
1259
|
-
// for each emitted value, combine into a filter and use it
|
|
1260
|
-
// to request the page from server
|
|
1261
|
-
operators.switchMap(function (_a) {
|
|
1262
|
-
var _b = __read(_a, 4), pageNumber = _b[0], pageSize = _b[1], filter = _b[2], refresh = _b[3];
|
|
1263
|
-
// const filter = { ...this._docsQuery.getValue().filter };
|
|
1264
|
-
var f = Object.assign({}, filter);
|
|
1265
|
-
f.pageNumber = pageNumber;
|
|
1266
|
-
f.pageSize = pageSize;
|
|
1267
|
-
var request = _this.getRequest(f);
|
|
1268
|
-
// update saved filters
|
|
1269
|
-
_this.paginator.metadata.set('filter', f);
|
|
1270
|
-
return _this.paginator.getPage(request);
|
|
1271
|
-
}));
|
|
1272
|
-
}
|
|
1273
|
-
UserListComponent.prototype.ngOnDestroy = function () {
|
|
1274
|
-
this.paginator.destroy();
|
|
1275
|
-
};
|
|
1276
|
-
UserListComponent.prototype.getRequest = function (filter) {
|
|
1277
|
-
var _this = this;
|
|
1278
|
-
return function () { return _this._accountService.getUsers(filter).pipe(
|
|
1279
|
-
// adapt server results to the paginator plugin
|
|
1280
|
-
operators.map(function (p) {
|
|
1281
|
-
return {
|
|
1282
|
-
currentPage: p.pageNumber,
|
|
1283
|
-
perPage: p.pageSize,
|
|
1284
|
-
lastPage: p.pageCount,
|
|
1285
|
-
data: p.items,
|
|
1286
|
-
total: p.total,
|
|
1287
|
-
};
|
|
1288
|
-
})); };
|
|
1289
|
-
};
|
|
1290
|
-
UserListComponent.prototype.pageChange = function (event) {
|
|
1291
|
-
// https://material.angular.io/components/paginator/api
|
|
1292
|
-
this.paginator.setPage(event.pageIndex + 1);
|
|
1293
|
-
if (event.pageSize !== this.pageSize.value) {
|
|
1294
|
-
this.pageSize.setValue(event.pageSize);
|
|
1295
|
-
}
|
|
1296
|
-
};
|
|
1297
|
-
UserListComponent.prototype.refresh = function () {
|
|
1298
|
-
this.paginator.clearCache();
|
|
1299
|
-
this._refresh$.next(this._refresh$.value + 1);
|
|
1300
|
-
};
|
|
1301
|
-
UserListComponent.prototype.deleteUser = function (user) {
|
|
1302
|
-
var _this = this;
|
|
1303
|
-
this._dialogService
|
|
1304
|
-
.confirm('Confirm', "Delete User " + user.userName + "?")
|
|
1305
|
-
.pipe(operators.take(1))
|
|
1306
|
-
.subscribe(function (yes) {
|
|
1307
|
-
if (!yes) {
|
|
1308
|
-
return;
|
|
1309
|
-
}
|
|
1310
|
-
_this._usersService.deleteUser(user.userName).finally(function () {
|
|
1311
|
-
_this.refresh();
|
|
1312
|
-
});
|
|
1313
|
-
});
|
|
1314
|
-
};
|
|
1315
|
-
UserListComponent.prototype.setActiveUser = function (user) {
|
|
1316
|
-
this._usersService.setActive((user === null || user === void 0 ? void 0 : user.userName) || null);
|
|
1317
|
-
};
|
|
1318
|
-
UserListComponent.prototype.resetActiveUser = function () {
|
|
1319
|
-
this._usersService.setActive(null);
|
|
1320
|
-
};
|
|
1321
|
-
UserListComponent.prototype.saveActiveUser = function (user) {
|
|
1322
|
-
var _this = this;
|
|
1323
|
-
this._usersService.updateActive(user).finally(function () {
|
|
1324
|
-
_this.refresh();
|
|
1325
|
-
});
|
|
1326
|
-
};
|
|
1327
|
-
UserListComponent.prototype.onUserEditorClose = function () {
|
|
1328
|
-
this.setActiveUser(null);
|
|
1329
|
-
};
|
|
1330
|
-
UserListComponent.prototype.getGravatarUrl = function (email, size) {
|
|
1331
|
-
if (size === void 0) { size = 80; }
|
|
1332
|
-
return this._gravatarService.buildGravatarUrl(email, size);
|
|
1333
|
-
};
|
|
1334
|
-
return UserListComponent;
|
|
1335
|
-
}());
|
|
1336
|
-
UserListComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: UserListComponent, deps: [{ token: USERS_PAGINATOR }, { token: UsersQuery }, { token: AuthJwtAccountService }, { token: UsersService }, { token: DialogService }, { token: i2__namespace$2.GravatarService }, { token: i1__namespace$1.FormBuilder }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
1337
|
-
UserListComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.1.5", type: UserListComponent, selector: "auth-jwt-user-list", ngImport: i0__namespace, template: "<div\n gdAreas=\"filters | progress | list | pager | editor\"\n gdRows=\"80px 64px 2fr 40px 1fr\"\n gdColumns=\"1fr\"\n gdGap=\"8px\"\n>\n <div>\n <!-- filters -->\n <div gdArea=\"filters\">\n <auth-jwt-user-filter></auth-jwt-user-filter>\n </div>\n\n <!-- progress -->\n <div *ngIf=\"paginator.isLoading$ | async\" gdArea=\"progress\">\n <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\n </div>\n\n <!-- list -->\n <div gdArea=\"list\" *ngIf=\"pagination$ | async as pagination\">\n <table>\n <thead>\n <td></td>\n <td></td>\n <td></td>\n <th>name</th>\n <th>first</th>\n <th>last</th>\n <th>email</th>\n <th>roles</th>\n <th>lock end</th>\n </thead>\n <tbody>\n <tr *ngFor=\"let user of pagination.data\">\n <td class=\"command\">\n <button\n mat-icon-button\n type=\"button\"\n matTooltip=\"Edit {{ user.userName }}\"\n color=\"primary\"\n (click)=\"setActiveUser(user)\"\n >\n <mat-icon>mode_edit</mat-icon>\n </button>\n </td>\n <td class=\"command\">\n <button\n mat-icon-button\n type=\"button\"\n matTooltip=\"Delete {{ user.userName }}\"\n color=\"warn\"\n (click)=\"deleteUser(user)\"\n >\n <mat-icon>remove_circle</mat-icon>\n </button>\n </td>\n <td>\n <img\n [src]=\"getGravatarUrl(user.email, 32)\"\n [alt]=\"user.userName\"\n />\n </td>\n <td>{{ user.userName }}</td>\n <td>{{ user.firstName }}</td>\n <td>{{ user.lastName }}</td>\n <td>\n <a [href]=\"'mailto:' + user.email\">{{ user.email }}</a>\n </td>\n <td>{{ user.roles?.join(\" \") }}</td>\n <td>{{ user.lockoutEnd }}</td>\n </tr>\n </tbody>\n </table>\n <!-- pagination -->\n <mat-paginator\n gdArea=\"pager\"\n gdAlignColumns=\"center\"\n gdAlignRows=\"start\"\n [length]=\"pagination.total\"\n [pageSize]=\"pageSize?.value\"\n [pageSizeOptions]=\"[20, 50, 75, 100]\"\n [pageIndex]=\"pagination.currentPage - 1\"\n [showFirstLastButtons]=\"true\"\n (page)=\"pageChange($event)\"\n ></mat-paginator>\n </div>\n </div>\n\n <!-- editor -->\n <div gdArea=\"editor\" *ngIf=\"active$ | async as active\">\n <fieldset>\n <legend>{{ active.userName }}</legend>\n <auth-jwt-user-editor\n [user]=\"active\"\n (userChange)=\"saveActiveUser($event)\"\n (editorClose)=\"resetActiveUser()\"\n ></auth-jwt-user-editor>\n </fieldset>\n </div>\n</div>\n", styles: ["tr:nth-child(odd){background-color:#f8f8f8}th{padding:0 8px;text-align:left;color:silver;font-weight:normal}td{padding:0 8px}td.command{width:24px}table{width:100%;border-collapse:collapse}fieldset{border:1px solid silver;border-radius:8px;padding:16px}\n"], components: [{ type: UserFilterComponent, selector: "auth-jwt-user-filter", inputs: ["disabled"] }, { type: i8__namespace$2.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "mode", "value", "bufferValue"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { type: i5__namespace.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i6__namespace.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i11__namespace.MatPaginator, selector: "mat-paginator", inputs: ["disabled"], exportAs: ["matPaginator"] }, { type: UserEditorComponent, selector: "auth-jwt-user-editor", inputs: ["user"], outputs: ["userChange", "editorClose"] }], directives: [{ type: i13__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i13__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i8__namespace$1.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }], pipes: { "async": i13__namespace.AsyncPipe } });
|
|
1338
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: UserListComponent, decorators: [{
|
|
1339
|
-
type: i0.Component,
|
|
1340
|
-
args: [{
|
|
1341
|
-
selector: 'auth-jwt-user-list',
|
|
1342
|
-
templateUrl: './user-list.component.html',
|
|
1343
|
-
styleUrls: ['./user-list.component.css'],
|
|
1344
|
-
}]
|
|
1345
|
-
}], ctorParameters: function () {
|
|
1346
|
-
return [{ type: i15__namespace.PaginatorPlugin, decorators: [{
|
|
1347
|
-
type: i0.Inject,
|
|
1348
|
-
args: [USERS_PAGINATOR]
|
|
1349
|
-
}] }, { type: UsersQuery }, { type: AuthJwtAccountService }, { type: UsersService }, { type: DialogService }, { type: i2__namespace$2.GravatarService }, { type: i1__namespace$1.FormBuilder }];
|
|
1350
|
-
} });
|
|
1351
|
-
|
|
1352
|
-
var AuthJwtAdminModule = /** @class */ (function () {
|
|
1353
|
-
function AuthJwtAdminModule() {
|
|
1354
|
-
}
|
|
1355
|
-
return AuthJwtAdminModule;
|
|
1356
|
-
}());
|
|
1357
|
-
AuthJwtAdminModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: AuthJwtAdminModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
1358
|
-
AuthJwtAdminModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: AuthJwtAdminModule, declarations: [AuthJwtRegistrationComponent,
|
|
1359
|
-
PasswordStrengthBarComponent,
|
|
1360
|
-
UserFilterComponent,
|
|
1361
|
-
UserListComponent,
|
|
1362
|
-
ConfirmDialogComponent,
|
|
1363
|
-
UserEditorComponent], imports: [i13.CommonModule,
|
|
1364
|
-
i1.HttpClientModule,
|
|
1365
|
-
i1$1.FormsModule,
|
|
1366
|
-
router.RouterModule,
|
|
1367
|
-
i1$1.ReactiveFormsModule,
|
|
1368
|
-
// material
|
|
1369
|
-
i5.MatButtonModule,
|
|
1370
|
-
card.MatCardModule,
|
|
1371
|
-
i4$1.MatCheckboxModule,
|
|
1372
|
-
i1$2.MatDialogModule,
|
|
1373
|
-
i6.MatIconModule,
|
|
1374
|
-
i7.MatInputModule,
|
|
1375
|
-
i11.MatPaginatorModule,
|
|
1376
|
-
i8$2.MatProgressBarModule,
|
|
1377
|
-
i8.MatProgressSpinnerModule,
|
|
1378
|
-
i2$1.MatSnackBarModule,
|
|
1379
|
-
i8$1.MatTooltipModule,
|
|
1380
|
-
i2$2.AuthJwtLoginModule,
|
|
1381
|
-
i2.NgToolsModule], exports: [AuthJwtRegistrationComponent,
|
|
1382
|
-
PasswordStrengthBarComponent,
|
|
1383
|
-
UserFilterComponent,
|
|
1384
|
-
UserListComponent] });
|
|
1385
|
-
AuthJwtAdminModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: AuthJwtAdminModule, imports: [[
|
|
1386
|
-
i13.CommonModule,
|
|
1387
|
-
i1.HttpClientModule,
|
|
1388
|
-
i1$1.FormsModule,
|
|
1389
|
-
router.RouterModule,
|
|
1390
|
-
i1$1.ReactiveFormsModule,
|
|
1391
|
-
// material
|
|
1392
|
-
i5.MatButtonModule,
|
|
1393
|
-
card.MatCardModule,
|
|
1394
|
-
i4$1.MatCheckboxModule,
|
|
1395
|
-
i1$2.MatDialogModule,
|
|
1396
|
-
i6.MatIconModule,
|
|
1397
|
-
i7.MatInputModule,
|
|
1398
|
-
i11.MatPaginatorModule,
|
|
1399
|
-
i8$2.MatProgressBarModule,
|
|
1400
|
-
i8.MatProgressSpinnerModule,
|
|
1401
|
-
i2$1.MatSnackBarModule,
|
|
1402
|
-
i8$1.MatTooltipModule,
|
|
1403
|
-
i2$2.AuthJwtLoginModule,
|
|
1404
|
-
i2.NgToolsModule
|
|
1405
|
-
]] });
|
|
1406
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: AuthJwtAdminModule, decorators: [{
|
|
1407
|
-
type: i0.NgModule,
|
|
1408
|
-
args: [{
|
|
1409
|
-
declarations: [
|
|
1410
|
-
AuthJwtRegistrationComponent,
|
|
1411
|
-
PasswordStrengthBarComponent,
|
|
1412
|
-
UserFilterComponent,
|
|
1413
|
-
UserListComponent,
|
|
1414
|
-
ConfirmDialogComponent,
|
|
1415
|
-
UserEditorComponent,
|
|
1416
|
-
],
|
|
1417
|
-
imports: [
|
|
1418
|
-
i13.CommonModule,
|
|
1419
|
-
i1.HttpClientModule,
|
|
1420
|
-
i1$1.FormsModule,
|
|
1421
|
-
router.RouterModule,
|
|
1422
|
-
i1$1.ReactiveFormsModule,
|
|
1423
|
-
// material
|
|
1424
|
-
i5.MatButtonModule,
|
|
1425
|
-
card.MatCardModule,
|
|
1426
|
-
i4$1.MatCheckboxModule,
|
|
1427
|
-
i1$2.MatDialogModule,
|
|
1428
|
-
i6.MatIconModule,
|
|
1429
|
-
i7.MatInputModule,
|
|
1430
|
-
i11.MatPaginatorModule,
|
|
1431
|
-
i8$2.MatProgressBarModule,
|
|
1432
|
-
i8.MatProgressSpinnerModule,
|
|
1433
|
-
i2$1.MatSnackBarModule,
|
|
1434
|
-
i8$1.MatTooltipModule,
|
|
1435
|
-
i2$2.AuthJwtLoginModule,
|
|
1436
|
-
i2.NgToolsModule
|
|
1437
|
-
],
|
|
1438
|
-
exports: [
|
|
1439
|
-
AuthJwtRegistrationComponent,
|
|
1440
|
-
PasswordStrengthBarComponent,
|
|
1441
|
-
UserFilterComponent,
|
|
1442
|
-
UserListComponent
|
|
1443
|
-
],
|
|
1444
|
-
}]
|
|
1445
|
-
}] });
|
|
1446
|
-
|
|
1447
|
-
/*
|
|
1448
|
-
* Public API Surface of auth-jwt-admin
|
|
1449
|
-
*/
|
|
1450
|
-
|
|
1451
|
-
/**
|
|
1452
|
-
* Generated bundle index. Do not edit.
|
|
1453
|
-
*/
|
|
1454
|
-
|
|
1455
|
-
exports.AuthJwtAccountService = AuthJwtAccountService;
|
|
1456
|
-
exports.AuthJwtAdminModule = AuthJwtAdminModule;
|
|
1457
|
-
exports.AuthJwtRegistrationComponent = AuthJwtRegistrationComponent;
|
|
1458
|
-
exports.PasswordStrengthBarComponent = PasswordStrengthBarComponent;
|
|
1459
|
-
exports.PasswordValidators = PasswordValidators;
|
|
1460
|
-
exports.UserFilterComponent = UserFilterComponent;
|
|
1461
|
-
exports.UserListComponent = UserListComponent;
|
|
1462
|
-
|
|
1463
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1464
|
-
|
|
1465
|
-
})));
|
|
1466
|
-
//# sourceMappingURL=myrmidon-auth-jwt-admin.umd.js.map
|