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