@myrmidon/auth-jwt-admin 1.0.6 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/esm2022/lib/auth-jwt-admin.module.mjs +120 -0
  2. package/esm2022/lib/components/auth-jwt-registration/auth-jwt-registration.component.mjs +165 -0
  3. package/esm2022/lib/components/confirm-dialog/confirm-dialog.component.mjs +30 -0
  4. package/esm2022/lib/components/password-strength-bar/password-strength-bar.component.mjs +81 -0
  5. package/esm2022/lib/components/state/user-list.repository.mjs +127 -0
  6. package/esm2022/lib/components/user-editor/user-editor.component.mjs +113 -0
  7. package/esm2022/lib/components/user-filter/user-filter.component.mjs +65 -0
  8. package/esm2022/lib/components/user-list/user-list.component.mjs +68 -0
  9. package/esm2022/lib/services/auth-jwt-account.service.mjs +182 -0
  10. package/esm2022/lib/services/dialog.service.mjs +38 -0
  11. package/{esm2020 → esm2022}/lib/validators/password.validators.mjs +48 -48
  12. package/{esm2020 → esm2022}/myrmidon-auth-jwt-admin.mjs +4 -4
  13. package/{esm2020 → esm2022}/public-api.mjs +11 -11
  14. package/fesm2022/myrmidon-auth-jwt-admin.mjs +982 -0
  15. package/fesm2022/myrmidon-auth-jwt-admin.mjs.map +1 -0
  16. package/index.d.ts +5 -5
  17. package/lib/auth-jwt-admin.module.d.ts +30 -30
  18. package/lib/components/auth-jwt-registration/auth-jwt-registration.component.d.ts +37 -37
  19. package/lib/components/confirm-dialog/confirm-dialog.component.d.ts +15 -15
  20. package/lib/components/password-strength-bar/password-strength-bar.component.d.ts +17 -17
  21. package/lib/components/state/user-list.repository.d.ts +29 -36
  22. package/lib/components/user-editor/user-editor.component.d.ts +29 -29
  23. package/lib/components/user-filter/user-filter.component.d.ts +23 -21
  24. package/lib/components/user-list/user-list.component.d.ts +30 -29
  25. package/lib/services/auth-jwt-account.service.d.ts +114 -114
  26. package/lib/services/dialog.service.d.ts +19 -19
  27. package/lib/validators/password.validators.d.ts +6 -6
  28. package/package.json +24 -17
  29. package/public-api.d.ts +8 -8
  30. package/esm2020/lib/auth-jwt-admin.module.mjs +0 -119
  31. package/esm2020/lib/components/auth-jwt-registration/auth-jwt-registration.component.mjs +0 -164
  32. package/esm2020/lib/components/confirm-dialog/confirm-dialog.component.mjs +0 -29
  33. package/esm2020/lib/components/password-strength-bar/password-strength-bar.component.mjs +0 -80
  34. package/esm2020/lib/components/state/user-list.repository.mjs +0 -144
  35. package/esm2020/lib/components/user-editor/user-editor.component.mjs +0 -112
  36. package/esm2020/lib/components/user-filter/user-filter.component.mjs +0 -55
  37. package/esm2020/lib/components/user-list/user-list.component.mjs +0 -70
  38. package/esm2020/lib/services/auth-jwt-account.service.mjs +0 -181
  39. package/esm2020/lib/services/dialog.service.mjs +0 -37
  40. package/fesm2015/myrmidon-auth-jwt-admin.mjs +0 -998
  41. package/fesm2015/myrmidon-auth-jwt-admin.mjs.map +0 -1
  42. package/fesm2020/myrmidon-auth-jwt-admin.mjs +0 -992
  43. package/fesm2020/myrmidon-auth-jwt-admin.mjs.map +0 -1
@@ -0,0 +1,982 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, EventEmitter, Component, Input, Output, Optional, Inject, NgModule } from '@angular/core';
3
+ import * as i1$1 from '@angular/forms';
4
+ import { Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
5
+ import { retry, catchError, take } from 'rxjs/operators';
6
+ import * as i2$1 from '@angular/material/snack-bar';
7
+ import { MatSnackBarModule } from '@angular/material/snack-bar';
8
+ import * as i1 from '@angular/common/http';
9
+ import { HttpParams, HttpClientModule } from '@angular/common/http';
10
+ import * as i2 from '@myrmidon/ng-tools';
11
+ import { NgToolsModule } from '@myrmidon/ng-tools';
12
+ import * as i4 from '@angular/common';
13
+ import { CommonModule } from '@angular/common';
14
+ import * as i2$2 from '@angular/material/button';
15
+ import { MatButtonModule } from '@angular/material/button';
16
+ import * as i6 from '@angular/material/icon';
17
+ import { MatIconModule } from '@angular/material/icon';
18
+ import * as i7 from '@angular/material/input';
19
+ import { MatInputModule } from '@angular/material/input';
20
+ import * as i8 from '@angular/material/form-field';
21
+ import * as i9 from '@angular/material/progress-spinner';
22
+ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
23
+ import * as i6$1 from '@angular/material/tooltip';
24
+ import { MatTooltipModule } from '@angular/material/tooltip';
25
+ import '@angular/localize/init';
26
+ import { BehaviorSubject, tap } from 'rxjs';
27
+ import { PagedListStore } from '@myrmidon/paged-data-browsers';
28
+ import * as i1$2 from '@angular/material/dialog';
29
+ import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
30
+ import * as i2$3 from '@myrmidon/auth-jwt-login';
31
+ import { AuthJwtLoginModule } from '@myrmidon/auth-jwt-login';
32
+ import * as i6$2 from '@angular/material/expansion';
33
+ import { MatExpansionModule } from '@angular/material/expansion';
34
+ import * as i8$1 from '@angular/material/paginator';
35
+ import { MatPaginatorModule } from '@angular/material/paginator';
36
+ import * as i9$1 from '@angular/material/progress-bar';
37
+ import { MatProgressBarModule } from '@angular/material/progress-bar';
38
+ import * as i5 from '@angular/material/checkbox';
39
+ import { MatCheckboxModule } from '@angular/material/checkbox';
40
+ import { RouterModule } from '@angular/router';
41
+ import { MatCardModule } from '@angular/material/card';
42
+
43
+ class PasswordValidators {
44
+ /** "Standard" password validator for my API services. */
45
+ static standard() {
46
+ return (control) => {
47
+ if (!control.value) {
48
+ return null;
49
+ }
50
+ if (control.value.length < 8) {
51
+ return {
52
+ passwordtooshort: true,
53
+ };
54
+ }
55
+ if (!/.*[A-Z].*/.test(control.value)) {
56
+ return {
57
+ noupperinpassword: true,
58
+ };
59
+ }
60
+ if (!/.*[a-z].*/.test(control.value)) {
61
+ return {
62
+ nolowerinpassword: true,
63
+ };
64
+ }
65
+ if (!/.*[A-Z].*/.test(control.value)) {
66
+ return {
67
+ noupperinpassword: true,
68
+ };
69
+ }
70
+ if (!/.*[-`~!@#$%^&*()_+=\[\]{};:'",.<>/?|\\].*/.test(control.value)) {
71
+ return {
72
+ nosymbolinpassword: true,
73
+ };
74
+ }
75
+ return null;
76
+ };
77
+ }
78
+ static areEqual(controlName, otherControlName) {
79
+ return (control) => {
80
+ const g = control;
81
+ const a = g.controls[controlName];
82
+ const b = g.controls[otherControlName];
83
+ return a.value !== b.value
84
+ ? {
85
+ areequal: true,
86
+ }
87
+ : null;
88
+ };
89
+ }
90
+ }
91
+
92
+ class AuthJwtAccountService {
93
+ constructor(_http, _error, _env) {
94
+ this._http = _http;
95
+ this._error = _error;
96
+ this._env = _env;
97
+ }
98
+ /**
99
+ * Checks if the specified email address is registered on the server.
100
+ * @param email email address to test.
101
+ * @returns result.
102
+ */
103
+ isEmailRegistered(email) {
104
+ return this._http.get(this._env.get('apiUrl') +
105
+ 'accounts/emailexists/' +
106
+ encodeURIComponent(email));
107
+ }
108
+ /**
109
+ * Checks if the specified user's given name is registered on the server.
110
+ * This name is a nickname chosen by users during registration, and is the key
111
+ * used for referencing users when talking to the server.
112
+ * @param name name to test.
113
+ * @returns result.
114
+ */
115
+ isNameRegistered(name) {
116
+ return this._http.get(this._env.get('apiUrl') +
117
+ 'accounts/nameexists/' +
118
+ encodeURIComponent(name));
119
+ }
120
+ /**
121
+ * Register the user with the specified registration data.
122
+ * @param registration The registration data.
123
+ * @param confirmed True to automatically confirm the user's email address
124
+ * without sending the confirmation email message.
125
+ */
126
+ register(registration, confirmed = false) {
127
+ return this._http.post(this._env.get('apiUrl') +
128
+ 'accounts/register' +
129
+ (confirmed ? '?confirmed=true' : ''), registration);
130
+ }
131
+ /**
132
+ * Resend the confirmation email to the specified address.
133
+ * @param email address.
134
+ */
135
+ resendConfirmEmail(email) {
136
+ return this._http.get(this._env.get('apiUrl') +
137
+ 'accounts/resendconfirm/' +
138
+ encodeURIComponent(email)
139
+ // options
140
+ );
141
+ }
142
+ /**
143
+ * Request a password reset for the specified email address.
144
+ * @param email Email address.
145
+ */
146
+ requestPasswordReset(email) {
147
+ return this._http.post(this._env.get('apiUrl') + 'accounts/resetpassword/request', { email });
148
+ }
149
+ getAllUsers() {
150
+ return this._http
151
+ .get(this._env.get('apiUrl') + 'users', {
152
+ params: new HttpParams().set('pageNumber', '1'),
153
+ })
154
+ .pipe(retry(3), catchError(this._error.handleError));
155
+ }
156
+ getUsers(filter, pageNumber = 1, pageSize = 20) {
157
+ let httpParams = new HttpParams();
158
+ httpParams = httpParams.set('pageNumber', pageNumber.toString());
159
+ httpParams = httpParams.set('pageSize', pageSize.toString());
160
+ if (filter.name) {
161
+ httpParams = httpParams.set('name', filter.name);
162
+ }
163
+ return this._http
164
+ .get(this._env.get('apiUrl') + 'users', {
165
+ params: httpParams,
166
+ })
167
+ .pipe(retry(3), catchError(this._error.handleError));
168
+ }
169
+ /**
170
+ * Get the top N users matching the specified name filter.
171
+ * @param nameFilter The user name filter.
172
+ * @param limit The maximum number of users to get.
173
+ */
174
+ getTopUsers(nameFilter, limit = 10) {
175
+ let httpParams = new HttpParams();
176
+ httpParams = httpParams.set('pageNumber', '1');
177
+ httpParams = httpParams.set('pageSize', limit.toString());
178
+ if (nameFilter) {
179
+ httpParams = httpParams.set('name', nameFilter);
180
+ }
181
+ const options = httpParams.keys().length > 0
182
+ ? {
183
+ params: httpParams,
184
+ }
185
+ : {};
186
+ return this._http
187
+ .get(this._env.get('apiUrl') + 'users', options)
188
+ .pipe(retry(3), catchError(this._error.handleError));
189
+ }
190
+ /**
191
+ * Get information about all the users listed in the specified names.
192
+ * @param names User(s) names.
193
+ */
194
+ getUsersFromNames(names) {
195
+ let httpParams = new HttpParams();
196
+ if (names && names.length > 0) {
197
+ httpParams = httpParams.set('names', names.join(','));
198
+ }
199
+ const options = httpParams.keys().length > 0
200
+ ? {
201
+ params: httpParams,
202
+ }
203
+ : {};
204
+ return this._http
205
+ .get(this._env.get('apiUrl') + 'users-from-names', options)
206
+ .pipe(retry(3), catchError(this._error.handleError));
207
+ }
208
+ /**
209
+ * Get data about the specified user.
210
+ * @param name The user name.
211
+ */
212
+ getUser(name) {
213
+ return this._http
214
+ .get(this._env.get('apiUrl') + 'users/' + name)
215
+ .pipe(retry(3), catchError(this._error.handleError));
216
+ }
217
+ /**
218
+ * Update the editable data for the specified user.
219
+ * @param user The user to update.
220
+ */
221
+ updateUser(user) {
222
+ return this._http
223
+ .put(this._env.get('apiUrl') +
224
+ 'users' +
225
+ (user.emailConfirmed ? '?confirmed=true' : ''), user)
226
+ .pipe(catchError(this._error.handleError));
227
+ }
228
+ /**
229
+ * Request a password reset email for the specified email address.
230
+ * @param email The email address to receive the reset message.
231
+ */
232
+ resetPassword(email) {
233
+ return this._http
234
+ .post(this._env.get('apiUrl') + 'accounts/resetpassword/request', {
235
+ email: email,
236
+ })
237
+ .pipe(catchError(this._error.handleError));
238
+ }
239
+ /**
240
+ * Change the password.
241
+ * @param change The password change data.
242
+ */
243
+ changePassword(change) {
244
+ return this._http
245
+ .post(this._env.get('apiUrl') + 'accounts/changepassword', change)
246
+ .pipe(catchError(this._error.handleError));
247
+ }
248
+ /**
249
+ * Delete the user with the specified username.
250
+ * @param name The user name.
251
+ */
252
+ deleteUser(name) {
253
+ return this._http
254
+ .delete(this._env.get('apiUrl') + 'accounts/' + name)
255
+ .pipe(catchError(this._error.handleError));
256
+ }
257
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: AuthJwtAccountService, deps: [{ token: i1.HttpClient }, { token: i2.ErrorService }, { token: i2.EnvService }], target: i0.ɵɵFactoryTarget.Injectable }); }
258
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: AuthJwtAccountService, providedIn: 'root' }); }
259
+ }
260
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: AuthJwtAccountService, decorators: [{
261
+ type: Injectable,
262
+ args: [{
263
+ providedIn: 'root',
264
+ }]
265
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: i2.ErrorService }, { type: i2.EnvService }]; } });
266
+
267
+ class PasswordStrengthBarComponent {
268
+ constructor() {
269
+ this._colors = ['#F00', '#F90', '#FF0', '#9F0', '#0F0'];
270
+ this.strengthChange = new EventEmitter();
271
+ this.strengthChange = new EventEmitter();
272
+ this.bars = [];
273
+ }
274
+ measureStrength(p) {
275
+ let force = 0;
276
+ const regex = /[$-/:-?{-~!"^_`\[\]]/g; // "
277
+ const lowerLetters = /[a-z]+/.test(p);
278
+ const upperLetters = /[A-Z]+/.test(p);
279
+ const numbers = /[0-9]+/.test(p);
280
+ const symbols = regex.test(p);
281
+ const flags = [lowerLetters, upperLetters, numbers, symbols];
282
+ let passedMatches = 0;
283
+ for (const flag of flags) {
284
+ passedMatches += flag === true ? 1 : 0;
285
+ }
286
+ force += 2 * p.length + (p.length >= 10 ? 1 : 0);
287
+ force += passedMatches * 10;
288
+ // penalty (short password)
289
+ force = p.length <= 6 ? Math.min(force, 10) : force;
290
+ // penalty (poor letiety of characters)
291
+ force = passedMatches === 1 ? Math.min(force, 10) : force;
292
+ force = passedMatches === 2 ? Math.min(force, 20) : force;
293
+ force = passedMatches === 3 ? Math.min(force, 40) : force;
294
+ return force;
295
+ }
296
+ getColor(s) {
297
+ let idx = 0;
298
+ if (s <= 10) {
299
+ idx = 0;
300
+ }
301
+ else if (s <= 20) {
302
+ idx = 1;
303
+ }
304
+ else if (s <= 30) {
305
+ idx = 2;
306
+ }
307
+ else if (s <= 40) {
308
+ idx = 3;
309
+ }
310
+ else {
311
+ idx = 4;
312
+ }
313
+ return {
314
+ idx: idx + 1,
315
+ col: this._colors[idx],
316
+ };
317
+ }
318
+ ngOnChanges(changes) {
319
+ const password = changes['passwordToCheck'].currentValue;
320
+ this.setBarColors(5, '#DDD');
321
+ if (password) {
322
+ const strength = this.measureStrength(password);
323
+ const c = this.getColor(strength);
324
+ this.setBarColors(c.idx, c.col);
325
+ this.strengthChange.emit(strength);
326
+ }
327
+ }
328
+ setBarColors(count, col) {
329
+ for (let n = 0; n < count; n++) {
330
+ this.bars[n] = col;
331
+ }
332
+ }
333
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: PasswordStrengthBarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
334
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.7", type: PasswordStrengthBarComponent, selector: "auth-jwt-password-strength-bar", inputs: { passwordToCheck: "passwordToCheck" }, outputs: { strengthChange: "strengthChange" }, usesOnChanges: true, ngImport: i0, 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"] }); }
335
+ }
336
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: PasswordStrengthBarComponent, decorators: [{
337
+ type: Component,
338
+ args: [{ selector: 'auth-jwt-password-strength-bar', 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"] }]
339
+ }], ctorParameters: function () { return []; }, propDecorators: { passwordToCheck: [{
340
+ type: Input
341
+ }], strengthChange: [{
342
+ type: Output
343
+ }] } });
344
+
345
+ class AuthJwtRegistrationComponent {
346
+ constructor(formBuilder, _snackbar, _accountService) {
347
+ this._snackbar = _snackbar;
348
+ this._accountService = _accountService;
349
+ this.registered = new EventEmitter();
350
+ // form
351
+ this.email = formBuilder.control('', {
352
+ validators: [Validators.required, Validators.email],
353
+ asyncValidators: this.getUniqueEmailValidator(this._accountService).bind(this),
354
+ nonNullable: true,
355
+ });
356
+ this.name = formBuilder.control('', {
357
+ validators: Validators.required,
358
+ asyncValidators: this.getUniqueNameValidator(this._accountService).bind(this),
359
+ nonNullable: true,
360
+ });
361
+ this.firstName = formBuilder.control('', {
362
+ validators: [Validators.required, Validators.maxLength(50)],
363
+ nonNullable: true,
364
+ });
365
+ this.lastName = formBuilder.control('', {
366
+ validators: [Validators.required, Validators.maxLength(50)],
367
+ nonNullable: true,
368
+ });
369
+ // http://stackoverflow.com/questions/35474991/angular-2-form-validating-for-repeat-password
370
+ this.password = formBuilder.control('', {
371
+ validators: [Validators.required, PasswordValidators.standard()],
372
+ nonNullable: true,
373
+ });
374
+ this.confirmPassword = formBuilder.control('', {
375
+ validators: Validators.required,
376
+ nonNullable: true,
377
+ });
378
+ this.form = formBuilder.group({
379
+ email: this.email,
380
+ name: this.name,
381
+ firstName: this.firstName,
382
+ lastName: this.lastName,
383
+ password: this.password,
384
+ confirmPassword: this.confirmPassword,
385
+ }, {
386
+ validators: [
387
+ PasswordValidators.areEqual('password', 'confirmPassword'),
388
+ ],
389
+ });
390
+ }
391
+ /**
392
+ * Creates a unique name validator. There is no dependency injection at this level,
393
+ * but we can use closures. As a matter of fact, we have access to the service instance
394
+ * from the component where we register validators. So we will implement a function
395
+ * that will accept the service as parameter, and create the actual validation function.
396
+ * This function will have access to the service when called during the validation process.
397
+ * See http://restlet.com/blog/2016/02/17/implementing-angular2-forms-beyond-basics-part-2/.
398
+ */
399
+ getUniqueNameValidator(service) {
400
+ return (control) => {
401
+ return new Promise((resolve, reject) => {
402
+ // avoid checking if empty
403
+ if (!control.value) {
404
+ resolve(null);
405
+ }
406
+ else {
407
+ service.isNameRegistered(control.value).subscribe({
408
+ next: (data) => {
409
+ if (!data.isExisting) {
410
+ resolve(null);
411
+ }
412
+ else {
413
+ resolve({ uniqueName: true });
414
+ }
415
+ },
416
+ error: (error) => {
417
+ console.error('Unique name validator error' +
418
+ (error ? JSON.stringify(error) : ''));
419
+ resolve({ uniqueName: true });
420
+ },
421
+ });
422
+ }
423
+ });
424
+ };
425
+ }
426
+ getUniqueEmailValidator(service) {
427
+ return (control) => {
428
+ return new Promise((resolve, reject) => {
429
+ // avoid checking if empty
430
+ if (!control.value) {
431
+ resolve(null);
432
+ }
433
+ else {
434
+ service.isEmailRegistered(control.value).subscribe({
435
+ next: (data) => {
436
+ if (!data.isExisting) {
437
+ resolve(null);
438
+ }
439
+ else {
440
+ resolve({ uniqueEmail: true });
441
+ }
442
+ },
443
+ error: (error) => {
444
+ console.error('Unique email validator error' +
445
+ (error ? JSON.stringify(error) : ''));
446
+ resolve({ uniqueEmail: true });
447
+ },
448
+ });
449
+ }
450
+ });
451
+ };
452
+ }
453
+ onSubmit() {
454
+ if (!this.form.valid ||
455
+ this.busy ||
456
+ this.name.pending ||
457
+ this.email.pending) {
458
+ return;
459
+ }
460
+ const model = {
461
+ email: this.email.value,
462
+ name: this.name.value,
463
+ firstName: this.firstName.value,
464
+ lastName: this.lastName.value,
465
+ password: this.password.value,
466
+ };
467
+ this.busy = true;
468
+ this._accountService
469
+ .register(model)
470
+ .pipe(take(1))
471
+ .subscribe({
472
+ next: () => {
473
+ this.busy = false;
474
+ this._snackbar.open($localize `Registration succeeded`, 'OK');
475
+ this.registered.emit();
476
+ },
477
+ error: (error) => {
478
+ this.busy = false;
479
+ console.error('Registration error' + (error ? JSON.stringify(error) : ''));
480
+ this._snackbar.open($localize `Registration error`, 'OK');
481
+ },
482
+ });
483
+ }
484
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: AuthJwtRegistrationComponent, deps: [{ token: i1$1.FormBuilder }, { token: i2$1.MatSnackBar }, { token: AuthJwtAccountService }], target: i0.ɵɵFactoryTarget.Component }); }
485
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.7", type: AuthJwtRegistrationComponent, selector: "auth-jwt-registration", outputs: { registered: "registered" }, ngImport: i0, template: "<div>\r\n <form role=\"form\" [formGroup]=\"form\" (submit)=\"onSubmit()\">\r\n <fieldset>\r\n <legend i18n>registration</legend>\r\n <!-- email -->\r\n <div class=\"form-row\">\r\n <mat-form-field>\r\n <mat-label i18n>email</mat-label>\r\n <input\r\n matInput\r\n type=\"email\"\r\n id=\"email\"\r\n maxlength=\"256\"\r\n required\r\n autofocus\r\n spellcheck=\"false\"\r\n [formControl]=\"email\"\r\n />\r\n <mat-error\r\n i18n\r\n *ngIf=\"\r\n $any(email).errors?.required && (email.dirty || email.touched)\r\n \"\r\n >email required</mat-error\r\n >\r\n <mat-error\r\n i18n\r\n *ngIf=\"$any(email).errors?.email && (email.dirty || email.touched)\"\r\n >invalid email</mat-error\r\n >\r\n <mat-error\r\n i18n\r\n *ngIf=\"\r\n $any(email).errors?.uniqueEmail && (email.dirty || email.touched)\r\n \"\r\n >email already registered</mat-error\r\n >\r\n </mat-form-field>\r\n <mat-icon *ngIf=\"email.pending\">hourglass</mat-icon>\r\n </div>\r\n\r\n <!-- name -->\r\n <div class=\"form-row\">\r\n <mat-form-field>\r\n <mat-label i18n>username</mat-label>\r\n <input\r\n matInput\r\n type=\"text\"\r\n id=\"name\"\r\n maxlength=\"50\"\r\n required\r\n pattern=\"^[a-zA-Z][a-zA-Z0-9]{2,49}$\"\r\n spellcheck=\"false\"\r\n [formControl]=\"name\"\r\n />\r\n <mat-error\r\n i18n\r\n *ngIf=\"$any(name).errors?.required && (name.dirty || name.touched)\"\r\n >username required</mat-error\r\n >\r\n <mat-error\r\n i18n\r\n *ngIf=\"$any(name).errors?.pattern && (name.dirty || name.touched)\"\r\n >invalid username</mat-error\r\n >\r\n <mat-error\r\n i18n\r\n *ngIf=\"\r\n $any(name).errors?.uniqueName && (name.dirty || name.touched)\r\n \"\r\n >username already registered</mat-error\r\n >\r\n </mat-form-field>\r\n <mat-icon *ngIf=\"name.pending\">hourglass</mat-icon>\r\n </div>\r\n\r\n <!-- first name -->\r\n <div>\r\n <mat-form-field>\r\n <mat-label i18n>first name</mat-label>\r\n <input\r\n matInput\r\n type=\"text\"\r\n id=\"firstName\"\r\n maxlength=\"50\"\r\n required\r\n spellcheck=\"false\"\r\n [formControl]=\"firstName\"\r\n />\r\n <mat-error\r\n i18n\r\n *ngIf=\"\r\n firstName.hasError('required') &&\r\n (firstName.dirty || firstName.touched)\r\n \"\r\n class=\"text-danger small\"\r\n >\r\n first name required\r\n </mat-error>\r\n </mat-form-field>\r\n </div>\r\n\r\n <!-- last name -->\r\n <div>\r\n <mat-form-field>\r\n <mat-label i18n>last name</mat-label>\r\n <input\r\n matInput\r\n type=\"text\"\r\n id=\"lastName\"\r\n maxlength=\"50\"\r\n required\r\n spellcheck=\"false\"\r\n [formControl]=\"lastName\"\r\n />\r\n <mat-error\r\n i18n\r\n *ngIf=\"\r\n lastName.hasError('required') &&\r\n (lastName.dirty || lastName.touched)\r\n \"\r\n class=\"text-danger small\"\r\n >\r\n last name required\r\n </mat-error>\r\n </mat-form-field>\r\n </div>\r\n\r\n <!-- <div [formGroup]=\"passwords\"> -->\r\n <!-- password -->\r\n <div>\r\n <mat-form-field>\r\n <mat-label i18n>password</mat-label>\r\n <input\r\n matInput\r\n type=\"password\"\r\n name=\"password\"\r\n autocomplete=\"new-password\"\r\n maxlength=\"50\"\r\n required\r\n spellcheck=\"false\"\r\n [formControl]=\"password\"\r\n />\r\n <auth-jwt-password-strength-bar [passwordToCheck]=\"password.value\">\r\n </auth-jwt-password-strength-bar>\r\n <mat-error\r\n i18n\r\n *ngIf=\"\r\n $any(password).errors?.required &&\r\n (password.dirty || password.touched)\r\n \"\r\n >password required</mat-error\r\n >\r\n <mat-error\r\n i18n\r\n *ngIf=\"\r\n $any(password).errors?.passwordtooshort &&\r\n (password.dirty || password.touched)\r\n \"\r\n >at least 8 characters</mat-error\r\n >\r\n <mat-error\r\n i18n\r\n *ngIf=\"\r\n $any(password).errors?.noupperinpassword &&\r\n (password.dirty || password.touched)\r\n \"\r\n >at least 1 uppercase letter</mat-error\r\n >\r\n <mat-error\r\n i18n\r\n *ngIf=\"\r\n $any(password).errors?.nolowerinpassword &&\r\n (password.dirty || password.touched)\r\n \"\r\n >at least 1 lowercase letter</mat-error\r\n >\r\n <mat-error\r\n i18n\r\n *ngIf=\"\r\n $any(password).errors?.nosymbolinpassword &&\r\n (password.dirty || password.touched)\r\n \"\r\n >at least 1 punctuation/symbol</mat-error\r\n >\r\n </mat-form-field>\r\n </div>\r\n\r\n <!-- confirm password -->\r\n <div>\r\n <mat-form-field>\r\n <mat-label i18n>confirm password</mat-label>\r\n <input\r\n matInput\r\n type=\"password\"\r\n name=\"confirmPassword\"\r\n maxlength=\"50\"\r\n required\r\n spellcheck=\"false\"\r\n [formControl]=\"confirmPassword\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n <div\r\n i18n\r\n *ngIf=\"form.errors?.areequal && confirmPassword.touched\"\r\n style=\"color: red\"\r\n >\r\n password differs from confirmation password\r\n </div>\r\n\r\n <button i18n\r\n mat-raised-button\r\n type=\"submit\"\r\n color=\"primary\"\r\n [disabled]=\"\r\n form.invalid || form.pristine || busy || name.pending || email.pending\r\n \"\r\n >\r\n register\r\n </button>\r\n <mat-progress-spinner diameter=\"20\" *ngIf=\"busy\"></mat-progress-spinner>\r\n </fieldset>\r\n </form>\r\n\r\n <details>\r\n <summary i18n>Hints</summary>\r\n <p i18n>\r\n To register a new user, you must provide his email address, choose a\r\n password, and choose a username, which must be unique (you will be\r\n notified if another user has already taken that name). The username must\r\n include only letters/digits, start with a letter, and be no shorter than 3\r\n characters, nor longer than 50.\r\n </p>\r\n <p i18n>\r\n To promote a decent security level, the password must include at least 8\r\n characters, uppercase and lowercase letters, digits, and punctuation (like\r\n dashes, stops, parentheses, etc.).\r\n </p>\r\n <p i18n>\r\n Once registered, if messaging is enabled on the server side the user will\r\n receive an email message to the email address you specified; he will have\r\n to click on the provided link to complete the registration process.\r\n Otherwise, you should edit the newly created user and confirm the email\r\n registration.\r\n </p>\r\n </details>\r\n</div>\r\n", styles: ["mat-form-field{width:400px}fieldset{border:1px solid silver;border-radius:8px;padding:16px}.form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}details{margin:8px}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$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]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1$1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i1$1.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i2$2.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i7.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i8.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i8.MatLabel, selector: "mat-label" }, { kind: "directive", type: i8.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "component", type: i9.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "component", type: PasswordStrengthBarComponent, selector: "auth-jwt-password-strength-bar", inputs: ["passwordToCheck"], outputs: ["strengthChange"] }] }); }
486
+ }
487
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: AuthJwtRegistrationComponent, decorators: [{
488
+ type: Component,
489
+ args: [{ selector: 'auth-jwt-registration', template: "<div>\r\n <form role=\"form\" [formGroup]=\"form\" (submit)=\"onSubmit()\">\r\n <fieldset>\r\n <legend i18n>registration</legend>\r\n <!-- email -->\r\n <div class=\"form-row\">\r\n <mat-form-field>\r\n <mat-label i18n>email</mat-label>\r\n <input\r\n matInput\r\n type=\"email\"\r\n id=\"email\"\r\n maxlength=\"256\"\r\n required\r\n autofocus\r\n spellcheck=\"false\"\r\n [formControl]=\"email\"\r\n />\r\n <mat-error\r\n i18n\r\n *ngIf=\"\r\n $any(email).errors?.required && (email.dirty || email.touched)\r\n \"\r\n >email required</mat-error\r\n >\r\n <mat-error\r\n i18n\r\n *ngIf=\"$any(email).errors?.email && (email.dirty || email.touched)\"\r\n >invalid email</mat-error\r\n >\r\n <mat-error\r\n i18n\r\n *ngIf=\"\r\n $any(email).errors?.uniqueEmail && (email.dirty || email.touched)\r\n \"\r\n >email already registered</mat-error\r\n >\r\n </mat-form-field>\r\n <mat-icon *ngIf=\"email.pending\">hourglass</mat-icon>\r\n </div>\r\n\r\n <!-- name -->\r\n <div class=\"form-row\">\r\n <mat-form-field>\r\n <mat-label i18n>username</mat-label>\r\n <input\r\n matInput\r\n type=\"text\"\r\n id=\"name\"\r\n maxlength=\"50\"\r\n required\r\n pattern=\"^[a-zA-Z][a-zA-Z0-9]{2,49}$\"\r\n spellcheck=\"false\"\r\n [formControl]=\"name\"\r\n />\r\n <mat-error\r\n i18n\r\n *ngIf=\"$any(name).errors?.required && (name.dirty || name.touched)\"\r\n >username required</mat-error\r\n >\r\n <mat-error\r\n i18n\r\n *ngIf=\"$any(name).errors?.pattern && (name.dirty || name.touched)\"\r\n >invalid username</mat-error\r\n >\r\n <mat-error\r\n i18n\r\n *ngIf=\"\r\n $any(name).errors?.uniqueName && (name.dirty || name.touched)\r\n \"\r\n >username already registered</mat-error\r\n >\r\n </mat-form-field>\r\n <mat-icon *ngIf=\"name.pending\">hourglass</mat-icon>\r\n </div>\r\n\r\n <!-- first name -->\r\n <div>\r\n <mat-form-field>\r\n <mat-label i18n>first name</mat-label>\r\n <input\r\n matInput\r\n type=\"text\"\r\n id=\"firstName\"\r\n maxlength=\"50\"\r\n required\r\n spellcheck=\"false\"\r\n [formControl]=\"firstName\"\r\n />\r\n <mat-error\r\n i18n\r\n *ngIf=\"\r\n firstName.hasError('required') &&\r\n (firstName.dirty || firstName.touched)\r\n \"\r\n class=\"text-danger small\"\r\n >\r\n first name required\r\n </mat-error>\r\n </mat-form-field>\r\n </div>\r\n\r\n <!-- last name -->\r\n <div>\r\n <mat-form-field>\r\n <mat-label i18n>last name</mat-label>\r\n <input\r\n matInput\r\n type=\"text\"\r\n id=\"lastName\"\r\n maxlength=\"50\"\r\n required\r\n spellcheck=\"false\"\r\n [formControl]=\"lastName\"\r\n />\r\n <mat-error\r\n i18n\r\n *ngIf=\"\r\n lastName.hasError('required') &&\r\n (lastName.dirty || lastName.touched)\r\n \"\r\n class=\"text-danger small\"\r\n >\r\n last name required\r\n </mat-error>\r\n </mat-form-field>\r\n </div>\r\n\r\n <!-- <div [formGroup]=\"passwords\"> -->\r\n <!-- password -->\r\n <div>\r\n <mat-form-field>\r\n <mat-label i18n>password</mat-label>\r\n <input\r\n matInput\r\n type=\"password\"\r\n name=\"password\"\r\n autocomplete=\"new-password\"\r\n maxlength=\"50\"\r\n required\r\n spellcheck=\"false\"\r\n [formControl]=\"password\"\r\n />\r\n <auth-jwt-password-strength-bar [passwordToCheck]=\"password.value\">\r\n </auth-jwt-password-strength-bar>\r\n <mat-error\r\n i18n\r\n *ngIf=\"\r\n $any(password).errors?.required &&\r\n (password.dirty || password.touched)\r\n \"\r\n >password required</mat-error\r\n >\r\n <mat-error\r\n i18n\r\n *ngIf=\"\r\n $any(password).errors?.passwordtooshort &&\r\n (password.dirty || password.touched)\r\n \"\r\n >at least 8 characters</mat-error\r\n >\r\n <mat-error\r\n i18n\r\n *ngIf=\"\r\n $any(password).errors?.noupperinpassword &&\r\n (password.dirty || password.touched)\r\n \"\r\n >at least 1 uppercase letter</mat-error\r\n >\r\n <mat-error\r\n i18n\r\n *ngIf=\"\r\n $any(password).errors?.nolowerinpassword &&\r\n (password.dirty || password.touched)\r\n \"\r\n >at least 1 lowercase letter</mat-error\r\n >\r\n <mat-error\r\n i18n\r\n *ngIf=\"\r\n $any(password).errors?.nosymbolinpassword &&\r\n (password.dirty || password.touched)\r\n \"\r\n >at least 1 punctuation/symbol</mat-error\r\n >\r\n </mat-form-field>\r\n </div>\r\n\r\n <!-- confirm password -->\r\n <div>\r\n <mat-form-field>\r\n <mat-label i18n>confirm password</mat-label>\r\n <input\r\n matInput\r\n type=\"password\"\r\n name=\"confirmPassword\"\r\n maxlength=\"50\"\r\n required\r\n spellcheck=\"false\"\r\n [formControl]=\"confirmPassword\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n <div\r\n i18n\r\n *ngIf=\"form.errors?.areequal && confirmPassword.touched\"\r\n style=\"color: red\"\r\n >\r\n password differs from confirmation password\r\n </div>\r\n\r\n <button i18n\r\n mat-raised-button\r\n type=\"submit\"\r\n color=\"primary\"\r\n [disabled]=\"\r\n form.invalid || form.pristine || busy || name.pending || email.pending\r\n \"\r\n >\r\n register\r\n </button>\r\n <mat-progress-spinner diameter=\"20\" *ngIf=\"busy\"></mat-progress-spinner>\r\n </fieldset>\r\n </form>\r\n\r\n <details>\r\n <summary i18n>Hints</summary>\r\n <p i18n>\r\n To register a new user, you must provide his email address, choose a\r\n password, and choose a username, which must be unique (you will be\r\n notified if another user has already taken that name). The username must\r\n include only letters/digits, start with a letter, and be no shorter than 3\r\n characters, nor longer than 50.\r\n </p>\r\n <p i18n>\r\n To promote a decent security level, the password must include at least 8\r\n characters, uppercase and lowercase letters, digits, and punctuation (like\r\n dashes, stops, parentheses, etc.).\r\n </p>\r\n <p i18n>\r\n Once registered, if messaging is enabled on the server side the user will\r\n receive an email message to the email address you specified; he will have\r\n to click on the provided link to complete the registration process.\r\n Otherwise, you should edit the newly created user and confirm the email\r\n registration.\r\n </p>\r\n </details>\r\n</div>\r\n", styles: ["mat-form-field{width:400px}fieldset{border:1px solid silver;border-radius:8px;padding:16px}.form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}details{margin:8px}\n"] }]
490
+ }], ctorParameters: function () { return [{ type: i1$1.FormBuilder }, { type: i2$1.MatSnackBar }, { type: AuthJwtAccountService }]; }, propDecorators: { registered: [{
491
+ type: Output
492
+ }] } });
493
+
494
+ class UserFilterComponent {
495
+ get filter() {
496
+ return this._filter;
497
+ }
498
+ set filter(value) {
499
+ if (this._filter === value) {
500
+ return;
501
+ }
502
+ this._filter = value || undefined;
503
+ this.updateForm(this._filter);
504
+ }
505
+ constructor(formBuilder) {
506
+ // form
507
+ this.name = formBuilder.control(null);
508
+ this.form = formBuilder.group({
509
+ name: this.name,
510
+ });
511
+ // event
512
+ this.filterChange = new EventEmitter();
513
+ }
514
+ updateForm(filter) {
515
+ if (!filter) {
516
+ this.form.reset();
517
+ return;
518
+ }
519
+ this.name.setValue(filter.name || null);
520
+ this.form.markAsPristine();
521
+ }
522
+ getFilter() {
523
+ return {
524
+ name: this.name.value?.trim(),
525
+ };
526
+ }
527
+ reset() {
528
+ this.form.reset();
529
+ this._filter = {};
530
+ this.filterChange.emit(this._filter);
531
+ }
532
+ apply() {
533
+ this._filter = this.getFilter();
534
+ this.filterChange.emit(this._filter);
535
+ }
536
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: UserFilterComponent, deps: [{ token: i1$1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
537
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.7", type: UserFilterComponent, selector: "auth-jwt-user-filter", inputs: { filter: "filter", disabled: "disabled" }, outputs: { filterChange: "filterChange" }, ngImport: i0, template: "<form [formGroup]=\"form\" (submit)=\"apply()\" ng-disabled=\"disabled\">\n <div class=\"form-row\">\n <mat-form-field>\n <mat-label i18n>name or ID</mat-label>\n <input matInput [formControl]=\"name\" />\n <button\n mat-icon-button\n matSuffix\n type=\"button\"\n (click)=\"reset()\"\n color=\"warn\"\n i18n-matTooltip\n matTooltip=\"Reset filters\"\n [disabled]=\"disabled\"\n >\n <mat-icon>clear</mat-icon>\n </button>\n </mat-form-field>\n\n <button\n id=\"apply\"\n type=\"submit\"\n mat-icon-button\n color=\"primary\"\n [disabled]=\"disabled\"\n i18n-matTooltip\n matTooltip=\"Apply filters\"\n >\n <mat-icon>check_circle</mat-icon>\n </button>\n </div>\n</form>\n", styles: [".form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}#apply{margin-top:-20px}\n"], dependencies: [{ kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$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]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i2$2.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i7.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i8.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i8.MatLabel, selector: "mat-label" }, { kind: "directive", type: i8.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i6$1.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }] }); }
538
+ }
539
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: UserFilterComponent, decorators: [{
540
+ type: Component,
541
+ args: [{ selector: 'auth-jwt-user-filter', template: "<form [formGroup]=\"form\" (submit)=\"apply()\" ng-disabled=\"disabled\">\n <div class=\"form-row\">\n <mat-form-field>\n <mat-label i18n>name or ID</mat-label>\n <input matInput [formControl]=\"name\" />\n <button\n mat-icon-button\n matSuffix\n type=\"button\"\n (click)=\"reset()\"\n color=\"warn\"\n i18n-matTooltip\n matTooltip=\"Reset filters\"\n [disabled]=\"disabled\"\n >\n <mat-icon>clear</mat-icon>\n </button>\n </mat-form-field>\n\n <button\n id=\"apply\"\n type=\"submit\"\n mat-icon-button\n color=\"primary\"\n [disabled]=\"disabled\"\n i18n-matTooltip\n matTooltip=\"Apply filters\"\n >\n <mat-icon>check_circle</mat-icon>\n </button>\n </div>\n</form>\n", styles: [".form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}#apply{margin-top:-20px}\n"] }]
542
+ }], ctorParameters: function () { return [{ type: i1$1.FormBuilder }]; }, propDecorators: { filter: [{
543
+ type: Input
544
+ }], disabled: [{
545
+ type: Input
546
+ }], filterChange: [{
547
+ type: Output
548
+ }] } });
549
+
550
+ class UserListRepository {
551
+ get activeUser$() {
552
+ return this._activeUser$.asObservable();
553
+ }
554
+ get filter$() {
555
+ return this._store.filter$;
556
+ }
557
+ get page$() {
558
+ return this._store.page$;
559
+ }
560
+ get loading$() {
561
+ return this._loading$.asObservable();
562
+ }
563
+ get saving$() {
564
+ return this._saving$.asObservable();
565
+ }
566
+ constructor(_accService) {
567
+ this._accService = _accService;
568
+ this._store = new PagedListStore(this);
569
+ this._activeUser$ = new BehaviorSubject(undefined);
570
+ this._loading$ = new BehaviorSubject(false);
571
+ this._saving$ = new BehaviorSubject(false);
572
+ this._store.reset();
573
+ }
574
+ loadPage(pageNumber, pageSize, filter) {
575
+ this._loading$.next(true);
576
+ return this._accService.getUsers(filter, pageNumber, pageSize).pipe(tap({
577
+ next: () => this._loading$.next(false),
578
+ error: () => this._loading$.next(false),
579
+ }));
580
+ }
581
+ async reset() {
582
+ this._loading$.next(true);
583
+ try {
584
+ await this._store.reset();
585
+ }
586
+ catch (error) {
587
+ throw error;
588
+ }
589
+ finally {
590
+ this._loading$.next(false);
591
+ }
592
+ }
593
+ async setFilter(filter) {
594
+ this._loading$.next(true);
595
+ try {
596
+ await this._store.setFilter(filter);
597
+ }
598
+ catch (error) {
599
+ throw error;
600
+ }
601
+ finally {
602
+ this._loading$.next(false);
603
+ }
604
+ }
605
+ getFilter() {
606
+ return this._store.getFilter();
607
+ }
608
+ async setPage(pageNumber, pageSize) {
609
+ this._loading$.next(true);
610
+ try {
611
+ await this._store.setPage(pageNumber, pageSize);
612
+ }
613
+ catch (error) {
614
+ throw error;
615
+ }
616
+ finally {
617
+ this._loading$.next(false);
618
+ }
619
+ }
620
+ setActiveUser(user) {
621
+ this._activeUser$.next(user || undefined);
622
+ }
623
+ updateActiveUser(user) {
624
+ const promise = new Promise((resolve, reject) => {
625
+ this._saving$.next(true);
626
+ this._accService.updateUser(user).subscribe({
627
+ next: (_) => {
628
+ this._saving$.next(false);
629
+ this._store.reset();
630
+ resolve(true);
631
+ },
632
+ error: (error) => {
633
+ this._saving$.next(false);
634
+ console.error(`Error updating user ${user.userName}: ` +
635
+ JSON.stringify(error || {}));
636
+ resolve(false);
637
+ },
638
+ });
639
+ });
640
+ return promise;
641
+ }
642
+ deleteUser(name) {
643
+ const promise = new Promise((resolve, reject) => {
644
+ if (this._activeUser$.value?.userName === name) {
645
+ this._activeUser$.next(undefined);
646
+ }
647
+ this._saving$.next(true);
648
+ this._accService.deleteUser(name).subscribe({
649
+ next: (_) => {
650
+ this._saving$.next(false);
651
+ this._store.reset();
652
+ resolve(true);
653
+ },
654
+ error: (error) => {
655
+ this._saving$.next(false);
656
+ console.error(`Error deleting user ${name}: ` + JSON.stringify(error || {}));
657
+ reject(error);
658
+ },
659
+ });
660
+ });
661
+ return promise;
662
+ }
663
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: UserListRepository, deps: [{ token: AuthJwtAccountService }], target: i0.ɵɵFactoryTarget.Injectable }); }
664
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: UserListRepository, providedIn: 'root' }); }
665
+ }
666
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: UserListRepository, decorators: [{
667
+ type: Injectable,
668
+ args: [{ providedIn: 'root' }]
669
+ }], ctorParameters: function () { return [{ type: AuthJwtAccountService }]; } });
670
+
671
+ // https://medium.com/@tarik.nzl/making-use-of-dialogs-in-material-2-mddialog-7533d27df41
672
+ class ConfirmDialogComponent {
673
+ constructor(dialogRef, data) {
674
+ this.dialogRef = dialogRef;
675
+ this.data = data;
676
+ this.title = $localize `Confirm`;
677
+ this.prompt = $localize `Confirm operation?`;
678
+ this.ok = $localize `yes`;
679
+ this.cancel = $localize `no`;
680
+ }
681
+ ngOnInit() { }
682
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: ConfirmDialogComponent, deps: [{ token: i1$2.MatDialogRef }, { token: MAT_DIALOG_DATA, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
683
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.7", type: ConfirmDialogComponent, selector: "ng-component", ngImport: i0, 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: [""], dependencies: [{ kind: "component", type: i2$2.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i1$2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1$2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i1$2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }] }); }
684
+ }
685
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: ConfirmDialogComponent, decorators: [{
686
+ type: Component,
687
+ args: [{ 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" }]
688
+ }], ctorParameters: function () { return [{ type: i1$2.MatDialogRef }, { type: undefined, decorators: [{
689
+ type: Optional
690
+ }, {
691
+ type: Inject,
692
+ args: [MAT_DIALOG_DATA]
693
+ }] }]; } });
694
+
695
+ // https://medium.com/@tarik.nzl/making-use-of-dialogs-in-material-2-mddialog-7533d27df41
696
+ /**
697
+ * This service acts as a wrapper for MatDialog to simplify the process of calling
698
+ * the dialog and subscribing to it. What it will do is create an Instance of
699
+ * MatDialog with our custom component (ConfirmDialogComponent). Then it will set
700
+ * any public properties it needs to by setting the properties on the
701
+ * componentInstance object. It will return the observable afterClosed()
702
+ * to the caller so they can subscribe to it. This will emit an event whenever
703
+ * the dialog is closed.
704
+ */
705
+ class DialogService {
706
+ constructor(dialog) {
707
+ this.dialog = dialog;
708
+ }
709
+ confirm(title, prompt, ok = $localize `yes`, cancel = $localize `no`) {
710
+ let dialogRef;
711
+ dialogRef = this.dialog.open(ConfirmDialogComponent);
712
+ dialogRef.componentInstance.title = title;
713
+ dialogRef.componentInstance.prompt = prompt;
714
+ dialogRef.componentInstance.ok = ok;
715
+ dialogRef.componentInstance.cancel = cancel;
716
+ return dialogRef.afterClosed();
717
+ }
718
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: DialogService, deps: [{ token: i1$2.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable }); }
719
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: DialogService, providedIn: 'root' }); }
720
+ }
721
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: DialogService, decorators: [{
722
+ type: Injectable,
723
+ args: [{
724
+ providedIn: 'root'
725
+ }]
726
+ }], ctorParameters: function () { return [{ type: i1$2.MatDialog }]; } });
727
+
728
+ class UserEditorComponent {
729
+ set user(value) {
730
+ this._user = value;
731
+ this.updateForm(value);
732
+ }
733
+ get user() {
734
+ return this._user;
735
+ }
736
+ constructor(formBuilder, _authService) {
737
+ this._authService = _authService;
738
+ // events
739
+ this.userChange = new EventEmitter();
740
+ this.editorClose = new EventEmitter();
741
+ // form
742
+ this.email = formBuilder.control(null, [
743
+ Validators.required,
744
+ Validators.email,
745
+ ]);
746
+ this.emailConfirmed = formBuilder.control(false);
747
+ this.lockoutEnabled = formBuilder.control(false);
748
+ this.firstName = formBuilder.control(null, [
749
+ Validators.required,
750
+ Validators.maxLength(50),
751
+ ]);
752
+ this.lastName = formBuilder.control(null, [
753
+ Validators.required,
754
+ Validators.maxLength(50),
755
+ ]);
756
+ this.roles = formBuilder.control(null, Validators.maxLength(200));
757
+ this.form = formBuilder.group({
758
+ email: this.email,
759
+ emailConfirmed: this.emailConfirmed,
760
+ lockoutEnabled: this.lockoutEnabled,
761
+ firstName: this.firstName,
762
+ lastName: this.lastName,
763
+ roles: this.roles,
764
+ });
765
+ }
766
+ ngOnInit() { }
767
+ updateForm(user) {
768
+ if (!user) {
769
+ this.form.reset();
770
+ }
771
+ else {
772
+ this.email.setValue(user.email);
773
+ this.emailConfirmed.setValue(user.emailConfirmed);
774
+ this.lockoutEnabled.setValue(user.lockoutEnabled);
775
+ this.firstName.setValue(user.firstName);
776
+ this.lastName.setValue(user.lastName);
777
+ if (user.roles?.length > 0) {
778
+ this.roles.setValue(user.roles.join(' '));
779
+ }
780
+ else {
781
+ this.roles.setValue(null);
782
+ }
783
+ }
784
+ }
785
+ getUserFromForm() {
786
+ return {
787
+ userName: this._user?.userName || '',
788
+ email: this.email.value,
789
+ emailConfirmed: this.emailConfirmed.value,
790
+ lockoutEnabled: this.lockoutEnabled.value,
791
+ firstName: this.firstName.value,
792
+ lastName: this.lastName.value,
793
+ roles: this.roles.value
794
+ ? this.roles.value.split(' ').filter((s) => s)
795
+ : [],
796
+ };
797
+ }
798
+ endLockout() {
799
+ if (this.unlocked) {
800
+ return;
801
+ }
802
+ this._user.lockoutEnd = this._authService.getUTCDate();
803
+ this.unlocked = true;
804
+ }
805
+ close() {
806
+ this.editorClose.emit();
807
+ }
808
+ save() {
809
+ if (this.form.invalid) {
810
+ return;
811
+ }
812
+ this.userChange.emit(this.getUserFromForm());
813
+ }
814
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: UserEditorComponent, deps: [{ token: i1$1.UntypedFormBuilder }, { token: i2$3.AuthJwtService }], target: i0.ɵɵFactoryTarget.Component }); }
815
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.7", type: UserEditorComponent, selector: "auth-jwt-user-editor", inputs: { user: "user" }, outputs: { userChange: "userChange", editorClose: "editorClose" }, ngImport: i0, template: "<form [formGroup]=\"form\" (submit)=\"save()\">\n <div class=\"form-row\">\n <!-- email -->\n <mat-form-field>\n <mat-label i18n>email</mat-label>\n <input type=\"text\" matInput [formControl]=\"email\" />\n <mat-error\n i18n\n *ngIf=\"email.hasError('required') && (email.dirty || email.touched)\"\n >\n email address required\n </mat-error>\n <mat-error\n i18n\n *ngIf=\"email.hasError('pattern') && (email.dirty || email.touched)\"\n >\n invalid email address\n </mat-error>\n </mat-form-field>\n\n <!-- emailConfirmed -->\n <mat-checkbox [formControl]=\"emailConfirmed\" i18n\n >email address confirmed</mat-checkbox\n >\n </div>\n\n <!-- lockoutEnabled -->\n <div class=\"form-row\">\n <mat-checkbox [formControl]=\"lockoutEnabled\" i18n\n >lockout enabled</mat-checkbox\n >\n <button\n mat-icon-button\n color=\"primary\"\n (click)=\"endLockout()\"\n [disabled]=\"unlocked\"\n i18n-matTooltip\n matTooltip=\"Unlock this user if locked\"\n >\n <mat-icon>lock_open</mat-icon>\n </button>\n </div>\n\n <div class=\"form-row\">\n <!-- firstName -->\n <mat-form-field>\n <mat-label i18n>first name</mat-label>\n <input type=\"text\" matInput [formControl]=\"firstName\" />\n <mat-error\n i18n\n *ngIf=\"\n firstName.hasError('required') &&\n (firstName.dirty || firstName.touched)\n \"\n >\n first name required\n </mat-error>\n <mat-error\n i18n\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\n <!-- lastName -->\n <mat-form-field>\n <mat-label i18n>last name</mat-label>\n <input type=\"text\" matInput [formControl]=\"lastName\" />\n <mat-error\n i18n\n *ngIf=\"\n lastName.hasError('required') && (lastName.dirty || lastName.touched)\n \"\n >\n last name required\n </mat-error>\n <mat-error\n i18n\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 style=\"width: 16em\">\n <mat-label i18n>roles</mat-label>\n <input type=\"text\" matInput [formControl]=\"roles\" />\n <mat-error\n i18n\n *ngIf=\"roles.hasError('maxlength') && (roles.dirty || roles.touched)\"\n >\n too long\n </mat-error>\n <mat-hint i18n>roles (separated by space)</mat-hint>\n </mat-form-field>\n </div>\n\n <!-- buttons -->\n <br />\n <div>\n <button\n type=\"button\"\n mat-icon-button\n color=\"warn\"\n i18n-matTooltip\n matTooltip=\"Close\"\n (click)=\"close()\"\n >\n <mat-icon>cancel</mat-icon>\n </button>\n <button\n type=\"submit\"\n mat-icon-button\n color=\"primary\"\n [disabled]=\"form.invalid\"\n i18n-matTooltip\n matTooltip=\"Save user\"\n >\n <mat-icon>check_circle</mat-icon>\n </button>\n </div>\n</form>\n", styles: [".form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$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]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i2$2.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i5.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "component", type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i7.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i8.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i8.MatLabel, selector: "mat-label" }, { kind: "directive", type: i8.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i8.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i6$1.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }] }); }
816
+ }
817
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: UserEditorComponent, decorators: [{
818
+ type: Component,
819
+ args: [{ selector: 'auth-jwt-user-editor', template: "<form [formGroup]=\"form\" (submit)=\"save()\">\n <div class=\"form-row\">\n <!-- email -->\n <mat-form-field>\n <mat-label i18n>email</mat-label>\n <input type=\"text\" matInput [formControl]=\"email\" />\n <mat-error\n i18n\n *ngIf=\"email.hasError('required') && (email.dirty || email.touched)\"\n >\n email address required\n </mat-error>\n <mat-error\n i18n\n *ngIf=\"email.hasError('pattern') && (email.dirty || email.touched)\"\n >\n invalid email address\n </mat-error>\n </mat-form-field>\n\n <!-- emailConfirmed -->\n <mat-checkbox [formControl]=\"emailConfirmed\" i18n\n >email address confirmed</mat-checkbox\n >\n </div>\n\n <!-- lockoutEnabled -->\n <div class=\"form-row\">\n <mat-checkbox [formControl]=\"lockoutEnabled\" i18n\n >lockout enabled</mat-checkbox\n >\n <button\n mat-icon-button\n color=\"primary\"\n (click)=\"endLockout()\"\n [disabled]=\"unlocked\"\n i18n-matTooltip\n matTooltip=\"Unlock this user if locked\"\n >\n <mat-icon>lock_open</mat-icon>\n </button>\n </div>\n\n <div class=\"form-row\">\n <!-- firstName -->\n <mat-form-field>\n <mat-label i18n>first name</mat-label>\n <input type=\"text\" matInput [formControl]=\"firstName\" />\n <mat-error\n i18n\n *ngIf=\"\n firstName.hasError('required') &&\n (firstName.dirty || firstName.touched)\n \"\n >\n first name required\n </mat-error>\n <mat-error\n i18n\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\n <!-- lastName -->\n <mat-form-field>\n <mat-label i18n>last name</mat-label>\n <input type=\"text\" matInput [formControl]=\"lastName\" />\n <mat-error\n i18n\n *ngIf=\"\n lastName.hasError('required') && (lastName.dirty || lastName.touched)\n \"\n >\n last name required\n </mat-error>\n <mat-error\n i18n\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 style=\"width: 16em\">\n <mat-label i18n>roles</mat-label>\n <input type=\"text\" matInput [formControl]=\"roles\" />\n <mat-error\n i18n\n *ngIf=\"roles.hasError('maxlength') && (roles.dirty || roles.touched)\"\n >\n too long\n </mat-error>\n <mat-hint i18n>roles (separated by space)</mat-hint>\n </mat-form-field>\n </div>\n\n <!-- buttons -->\n <br />\n <div>\n <button\n type=\"button\"\n mat-icon-button\n color=\"warn\"\n i18n-matTooltip\n matTooltip=\"Close\"\n (click)=\"close()\"\n >\n <mat-icon>cancel</mat-icon>\n </button>\n <button\n type=\"submit\"\n mat-icon-button\n color=\"primary\"\n [disabled]=\"form.invalid\"\n i18n-matTooltip\n matTooltip=\"Save user\"\n >\n <mat-icon>check_circle</mat-icon>\n </button>\n </div>\n</form>\n", styles: [".form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}\n"] }]
820
+ }], ctorParameters: function () { return [{ type: i1$1.UntypedFormBuilder }, { type: i2$3.AuthJwtService }]; }, propDecorators: { user: [{
821
+ type: Input
822
+ }], userChange: [{
823
+ type: Output
824
+ }], editorClose: [{
825
+ type: Output
826
+ }] } });
827
+
828
+ class UserListComponent {
829
+ constructor(_repository, _dialogService, _gravatarService) {
830
+ this._repository = _repository;
831
+ this._dialogService = _dialogService;
832
+ this._gravatarService = _gravatarService;
833
+ this.filter$ = _repository.filter$;
834
+ this.page$ = _repository.page$;
835
+ this.active$ = _repository.activeUser$;
836
+ this.loading$ = _repository.loading$;
837
+ }
838
+ reset() {
839
+ this._repository.reset();
840
+ }
841
+ onFilterChange(filter) {
842
+ this._repository.setFilter(filter);
843
+ }
844
+ onPageChange(event) {
845
+ this._repository.setPage(event.pageIndex + 1, event.pageSize);
846
+ }
847
+ deleteUser(user) {
848
+ this._dialogService
849
+ .confirm($localize `Confirm`, $localize `Delete user ${user.userName}?`)
850
+ .subscribe((yes) => {
851
+ if (yes) {
852
+ this._repository.deleteUser(user.userName);
853
+ }
854
+ });
855
+ }
856
+ setActiveUser(user) {
857
+ this._repository.setActiveUser(user);
858
+ }
859
+ resetActiveUser() {
860
+ this._repository.setActiveUser(null);
861
+ }
862
+ saveActiveUser(user) {
863
+ this._repository.updateActiveUser(user);
864
+ this._repository.setActiveUser(null);
865
+ }
866
+ onUserEditorClose() {
867
+ this._repository.setActiveUser(null);
868
+ }
869
+ getGravatarUrl(email, size = 80) {
870
+ return this._gravatarService.buildGravatarUrl(email, size);
871
+ }
872
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: UserListComponent, deps: [{ token: UserListRepository }, { token: DialogService }, { token: i2$3.GravatarService }], target: i0.ɵɵFactoryTarget.Component }); }
873
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.7", type: UserListComponent, selector: "auth-jwt-user-list", ngImport: i0, template: "<div id=\"container\">\n <div>\n <!-- filters -->\n <div id=\"filters\">\n <auth-jwt-user-filter\n [filter]=\"filter$ | async\"\n (filterChange)=\"onFilterChange($event)\"\n ></auth-jwt-user-filter>\n </div>\n\n <!-- list -->\n <div id=\"list\" *ngIf=\"page$ | async as page\">\n <div *ngIf=\"loading$ | async\">\n <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\n </div>\n <table>\n <thead>\n <td></td>\n <td></td>\n <th i18n>name</th>\n <th i18n class=\"noif-lt-md\">first</th>\n <th i18n class=\"noif-lt-md\">last</th>\n <th i18n class=\"noif-lt-md\">email</th>\n <th i18n>roles</th>\n <th i18n class=\"noif-lt-md\">lock end</th>\n </thead>\n <tbody>\n <tr *ngFor=\"let user of page.items\">\n <td class=\"fit-width\">\n <button\n mat-icon-button\n type=\"button\"\n i18n-matTooltip\n matTooltip=\"Edit this user\"\n color=\"primary\"\n (click)=\"setActiveUser(user)\"\n >\n <mat-icon>mode_edit</mat-icon>\n </button>\n <button\n mat-icon-button\n type=\"button\"\n i18n-matTooltip\n matTooltip=\"Delete this user\"\n color=\"warn\"\n (click)=\"deleteUser(user)\"\n >\n <mat-icon>remove_circle</mat-icon>\n </button>\n </td>\n <td class=\"fit-width\">\n <img\n alt=\"avatar\"\n [src]=\"getGravatarUrl(user.email, 32)\"\n [alt]=\"user.userName\"\n />\n </td>\n <td>{{ user.userName }}</td>\n <td class=\"noif-lt-md\">{{ user.firstName }}</td>\n <td class=\"noif-lt-md\">{{ user.lastName }}</td>\n <td class=\"noif-lt-md\">\n <a [href]=\"'mailto:' + user.email\">{{ user.email }}</a>\n </td>\n <td>{{ user.roles.join(\" \") }}</td>\n <td class=\"noif-lt-md\">{{ user.lockoutEnd }}</td>\n </tr>\n </tbody>\n </table>\n\n <!-- paginator -->\n <div class=\"form-row\">\n <button\n type=\"button\"\n mat-icon-button\n color=\"warn\"\n i18n-matmatTooltip\n matTooltip=\"Refresh list\"\n (click)=\"reset()\"\n >\n <mat-icon>autorenew</mat-icon>\n </button>\n\n <mat-paginator\n [length]=\"page.total\"\n [pageIndex]=\"page.pageNumber - 1\"\n [pageSize]=\"page.pageSize\"\n [pageSizeOptions]=\"[5, 10, 20, 50, 100]\"\n (page)=\"onPageChange($event)\"\n [showFirstLastButtons]=\"true\"\n ></mat-paginator>\n </div>\n </div>\n </div>\n\n <!-- editor -->\n <mat-expansion-panel\n id=\"editor\"\n [expanded]=\"active$ | async\"\n [disabled]=\"!(active$ | async)\"\n >\n <div *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 </mat-expansion-panel>\n</div>\n", styles: ["tr:nth-child(odd){background-color:#f8f8f8}th{padding:0 8px;text-align:left;color:silver;font-weight:400}td{padding:0 8px}td.fit-width{width:1px;white-space:nowrap}table{width:100%;border-collapse:collapse}fieldset{border:1px solid silver;border-radius:8px;padding:16px}.form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}div#filters{grid-area:filters}div#list{grid-area:list}div#editor{grid-area:editor}div#container{display:grid;grid-template-rows:auto 1fr auto;grid-template-columns:1fr;grid-template-areas:\"filters\" \"list\" \"editor\";gap:8px}@media only screen and (max-width: 959px){.noif-lt-md{display:none}}@media only screen and (min-width: 1920px){div#container{grid-template-rows:auto 1fr;grid-template-columns:1fr auto;grid-template-areas:\"filters filters\" \"list editor\"}}\n"], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2$2.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i6$2.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["disabled", "expanded", "hideToggle", "togglePosition"], outputs: ["opened", "closed", "expandedChange", "afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i6.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i8$1.MatPaginator, selector: "mat-paginator", inputs: ["disabled"], exportAs: ["matPaginator"] }, { kind: "component", type: i9$1.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "directive", type: i6$1.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: UserFilterComponent, selector: "auth-jwt-user-filter", inputs: ["filter", "disabled"], outputs: ["filterChange"] }, { kind: "component", type: UserEditorComponent, selector: "auth-jwt-user-editor", inputs: ["user"], outputs: ["userChange", "editorClose"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }] }); }
874
+ }
875
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: UserListComponent, decorators: [{
876
+ type: Component,
877
+ args: [{ selector: 'auth-jwt-user-list', template: "<div id=\"container\">\n <div>\n <!-- filters -->\n <div id=\"filters\">\n <auth-jwt-user-filter\n [filter]=\"filter$ | async\"\n (filterChange)=\"onFilterChange($event)\"\n ></auth-jwt-user-filter>\n </div>\n\n <!-- list -->\n <div id=\"list\" *ngIf=\"page$ | async as page\">\n <div *ngIf=\"loading$ | async\">\n <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\n </div>\n <table>\n <thead>\n <td></td>\n <td></td>\n <th i18n>name</th>\n <th i18n class=\"noif-lt-md\">first</th>\n <th i18n class=\"noif-lt-md\">last</th>\n <th i18n class=\"noif-lt-md\">email</th>\n <th i18n>roles</th>\n <th i18n class=\"noif-lt-md\">lock end</th>\n </thead>\n <tbody>\n <tr *ngFor=\"let user of page.items\">\n <td class=\"fit-width\">\n <button\n mat-icon-button\n type=\"button\"\n i18n-matTooltip\n matTooltip=\"Edit this user\"\n color=\"primary\"\n (click)=\"setActiveUser(user)\"\n >\n <mat-icon>mode_edit</mat-icon>\n </button>\n <button\n mat-icon-button\n type=\"button\"\n i18n-matTooltip\n matTooltip=\"Delete this user\"\n color=\"warn\"\n (click)=\"deleteUser(user)\"\n >\n <mat-icon>remove_circle</mat-icon>\n </button>\n </td>\n <td class=\"fit-width\">\n <img\n alt=\"avatar\"\n [src]=\"getGravatarUrl(user.email, 32)\"\n [alt]=\"user.userName\"\n />\n </td>\n <td>{{ user.userName }}</td>\n <td class=\"noif-lt-md\">{{ user.firstName }}</td>\n <td class=\"noif-lt-md\">{{ user.lastName }}</td>\n <td class=\"noif-lt-md\">\n <a [href]=\"'mailto:' + user.email\">{{ user.email }}</a>\n </td>\n <td>{{ user.roles.join(\" \") }}</td>\n <td class=\"noif-lt-md\">{{ user.lockoutEnd }}</td>\n </tr>\n </tbody>\n </table>\n\n <!-- paginator -->\n <div class=\"form-row\">\n <button\n type=\"button\"\n mat-icon-button\n color=\"warn\"\n i18n-matmatTooltip\n matTooltip=\"Refresh list\"\n (click)=\"reset()\"\n >\n <mat-icon>autorenew</mat-icon>\n </button>\n\n <mat-paginator\n [length]=\"page.total\"\n [pageIndex]=\"page.pageNumber - 1\"\n [pageSize]=\"page.pageSize\"\n [pageSizeOptions]=\"[5, 10, 20, 50, 100]\"\n (page)=\"onPageChange($event)\"\n [showFirstLastButtons]=\"true\"\n ></mat-paginator>\n </div>\n </div>\n </div>\n\n <!-- editor -->\n <mat-expansion-panel\n id=\"editor\"\n [expanded]=\"active$ | async\"\n [disabled]=\"!(active$ | async)\"\n >\n <div *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 </mat-expansion-panel>\n</div>\n", styles: ["tr:nth-child(odd){background-color:#f8f8f8}th{padding:0 8px;text-align:left;color:silver;font-weight:400}td{padding:0 8px}td.fit-width{width:1px;white-space:nowrap}table{width:100%;border-collapse:collapse}fieldset{border:1px solid silver;border-radius:8px;padding:16px}.form-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.form-row *{flex:0 0 auto}div#filters{grid-area:filters}div#list{grid-area:list}div#editor{grid-area:editor}div#container{display:grid;grid-template-rows:auto 1fr auto;grid-template-columns:1fr;grid-template-areas:\"filters\" \"list\" \"editor\";gap:8px}@media only screen and (max-width: 959px){.noif-lt-md{display:none}}@media only screen and (min-width: 1920px){div#container{grid-template-rows:auto 1fr;grid-template-columns:1fr auto;grid-template-areas:\"filters filters\" \"list editor\"}}\n"] }]
878
+ }], ctorParameters: function () { return [{ type: UserListRepository }, { type: DialogService }, { type: i2$3.GravatarService }]; } });
879
+
880
+ class AuthJwtAdminModule {
881
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: AuthJwtAdminModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
882
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.7", ngImport: i0, type: AuthJwtAdminModule, declarations: [AuthJwtRegistrationComponent,
883
+ PasswordStrengthBarComponent,
884
+ UserFilterComponent,
885
+ UserListComponent,
886
+ ConfirmDialogComponent,
887
+ UserEditorComponent], imports: [CommonModule,
888
+ HttpClientModule,
889
+ FormsModule,
890
+ RouterModule,
891
+ ReactiveFormsModule,
892
+ // material
893
+ MatButtonModule,
894
+ MatCardModule,
895
+ MatCheckboxModule,
896
+ MatDialogModule,
897
+ MatExpansionModule,
898
+ MatIconModule,
899
+ MatInputModule,
900
+ MatPaginatorModule,
901
+ MatProgressBarModule,
902
+ MatProgressSpinnerModule,
903
+ MatSnackBarModule,
904
+ MatTooltipModule,
905
+ AuthJwtLoginModule,
906
+ NgToolsModule], exports: [AuthJwtRegistrationComponent,
907
+ PasswordStrengthBarComponent,
908
+ UserFilterComponent,
909
+ UserListComponent] }); }
910
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: AuthJwtAdminModule, imports: [CommonModule,
911
+ HttpClientModule,
912
+ FormsModule,
913
+ RouterModule,
914
+ ReactiveFormsModule,
915
+ // material
916
+ MatButtonModule,
917
+ MatCardModule,
918
+ MatCheckboxModule,
919
+ MatDialogModule,
920
+ MatExpansionModule,
921
+ MatIconModule,
922
+ MatInputModule,
923
+ MatPaginatorModule,
924
+ MatProgressBarModule,
925
+ MatProgressSpinnerModule,
926
+ MatSnackBarModule,
927
+ MatTooltipModule,
928
+ AuthJwtLoginModule,
929
+ NgToolsModule] }); }
930
+ }
931
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.7", ngImport: i0, type: AuthJwtAdminModule, decorators: [{
932
+ type: NgModule,
933
+ args: [{
934
+ declarations: [
935
+ AuthJwtRegistrationComponent,
936
+ PasswordStrengthBarComponent,
937
+ UserFilterComponent,
938
+ UserListComponent,
939
+ ConfirmDialogComponent,
940
+ UserEditorComponent,
941
+ ],
942
+ imports: [
943
+ CommonModule,
944
+ HttpClientModule,
945
+ FormsModule,
946
+ RouterModule,
947
+ ReactiveFormsModule,
948
+ // material
949
+ MatButtonModule,
950
+ MatCardModule,
951
+ MatCheckboxModule,
952
+ MatDialogModule,
953
+ MatExpansionModule,
954
+ MatIconModule,
955
+ MatInputModule,
956
+ MatPaginatorModule,
957
+ MatProgressBarModule,
958
+ MatProgressSpinnerModule,
959
+ MatSnackBarModule,
960
+ MatTooltipModule,
961
+ AuthJwtLoginModule,
962
+ NgToolsModule
963
+ ],
964
+ exports: [
965
+ AuthJwtRegistrationComponent,
966
+ PasswordStrengthBarComponent,
967
+ UserFilterComponent,
968
+ UserListComponent
969
+ ],
970
+ }]
971
+ }] });
972
+
973
+ /*
974
+ * Public API Surface of auth-jwt-admin
975
+ */
976
+
977
+ /**
978
+ * Generated bundle index. Do not edit.
979
+ */
980
+
981
+ export { AuthJwtAccountService, AuthJwtAdminModule, AuthJwtRegistrationComponent, PasswordStrengthBarComponent, PasswordValidators, UserFilterComponent, UserListComponent, UserListRepository };
982
+ //# sourceMappingURL=myrmidon-auth-jwt-admin.mjs.map