@nymphjs/tilmeld-client 1.0.0-beta.14 → 1.0.0-beta.141
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/CHANGELOG.md +569 -0
- package/README.md +7 -4
- package/dist/Group.d.ts +79 -0
- package/dist/Group.js +80 -0
- package/dist/Group.js.map +1 -0
- package/dist/Tilmeld.types.d.ts +12 -0
- package/dist/Tilmeld.types.js +2 -0
- package/dist/Tilmeld.types.js.map +1 -0
- package/{lib → dist}/User.d.ts +141 -14
- package/{lib → dist}/User.js +106 -39
- package/dist/User.js.map +1 -0
- package/dist/helpers.d.ts +58 -0
- package/{lib → dist}/helpers.js +23 -17
- package/dist/helpers.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/index.test.d.ts +1 -0
- package/dist/index.test.js +255 -0
- package/dist/index.test.js.map +1 -0
- package/jest.config.js +31 -5
- package/package.json +37 -33
- package/src/Group.ts +78 -38
- package/src/Tilmeld.types.ts +13 -0
- package/src/User.ts +198 -85
- package/src/helpers.ts +25 -12
- package/src/index.test.ts +327 -0
- package/src/index.ts +5 -7
- package/tsconfig.json +7 -4
- package/typedoc.json +4 -0
- package/lib/Group.d.ts +0 -41
- package/lib/Group.js +0 -54
- package/lib/Group.js.map +0 -1
- package/lib/User.js.map +0 -1
- package/lib/helpers.d.ts +0 -46
- package/lib/helpers.js.map +0 -1
- package/lib/index.d.ts +0 -7
- package/lib/index.js +0 -28
- package/lib/index.js.map +0 -1
- package/webpack.config.js +0 -31
package/dist/Group.d.ts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Entity, Options, Selector } from '@nymphjs/client';
|
|
2
|
+
import type { User, CurrentUserData } from './User.js';
|
|
3
|
+
export interface GroupData {
|
|
4
|
+
/**
|
|
5
|
+
* The group's groupname.
|
|
6
|
+
*/
|
|
7
|
+
groupname?: string;
|
|
8
|
+
/**
|
|
9
|
+
* The group's name.
|
|
10
|
+
*/
|
|
11
|
+
name?: string;
|
|
12
|
+
/**
|
|
13
|
+
* The group's avatar URL. (Use getAvatar() to support Gravatar.)
|
|
14
|
+
*/
|
|
15
|
+
avatar?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The group's parent.
|
|
18
|
+
*/
|
|
19
|
+
parent?: Group;
|
|
20
|
+
/**
|
|
21
|
+
* Whether the group can be used.
|
|
22
|
+
*/
|
|
23
|
+
enabled?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Whether this group is the default primary group for new users.
|
|
26
|
+
*/
|
|
27
|
+
defaultPrimary?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Whether this group is a default secondary group for new users.
|
|
30
|
+
*/
|
|
31
|
+
defaultSecondary?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Whether this group is a default secondary group for unverified users.
|
|
34
|
+
*/
|
|
35
|
+
unverifiedSecondary?: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface CurrentGroupData extends GroupData {
|
|
38
|
+
/**
|
|
39
|
+
* The abilities granted to the group.
|
|
40
|
+
*/
|
|
41
|
+
abilities?: string[];
|
|
42
|
+
/**
|
|
43
|
+
* The group's email address.
|
|
44
|
+
*/
|
|
45
|
+
email?: string;
|
|
46
|
+
/**
|
|
47
|
+
* The group's telephone number.
|
|
48
|
+
*/
|
|
49
|
+
phone?: string;
|
|
50
|
+
/**
|
|
51
|
+
* If generatePrimary is on, this will be the user who generated this group.
|
|
52
|
+
*/
|
|
53
|
+
user?: (User & CurrentUserData) | null;
|
|
54
|
+
}
|
|
55
|
+
export interface AdminGroupData extends CurrentGroupData {
|
|
56
|
+
}
|
|
57
|
+
export interface Group extends GroupData {
|
|
58
|
+
}
|
|
59
|
+
export declare class Group extends Entity<GroupData> {
|
|
60
|
+
static class: string;
|
|
61
|
+
static factoryGroupname(groupname?: string): Promise<Group>;
|
|
62
|
+
constructor();
|
|
63
|
+
$checkGroupname(): Promise<{
|
|
64
|
+
result: boolean;
|
|
65
|
+
message: string;
|
|
66
|
+
}>;
|
|
67
|
+
$checkEmail(): Promise<{
|
|
68
|
+
result: boolean;
|
|
69
|
+
message: string;
|
|
70
|
+
}>;
|
|
71
|
+
$getAvatar(): Promise<string>;
|
|
72
|
+
$getChildren(limit?: number, offset?: number, reverse?: boolean, sort?: string): Promise<Group[]>;
|
|
73
|
+
$getDescendants(andSelf?: boolean): Promise<Group[]>;
|
|
74
|
+
$getLevel(): Promise<number>;
|
|
75
|
+
$isDescendant(givenGroup: Group | string): Promise<boolean>;
|
|
76
|
+
$getUsers(descendants?: boolean, limit?: number, offset?: number, reverse?: boolean, sort?: string, enabled?: boolean): Promise<User[]>;
|
|
77
|
+
static getPrimaryGroups(options?: Options, selectors?: Selector[]): Promise<Group[]>;
|
|
78
|
+
static getSecondaryGroups(options?: Options, selectors?: Selector[]): Promise<Group[]>;
|
|
79
|
+
}
|
package/dist/Group.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Entity } from '@nymphjs/client';
|
|
2
|
+
export class Group extends Entity {
|
|
3
|
+
// The name of the server class
|
|
4
|
+
static class = 'Group';
|
|
5
|
+
static async factoryGroupname(groupname) {
|
|
6
|
+
const entity = new this();
|
|
7
|
+
if (groupname != null) {
|
|
8
|
+
const entity = await this.nymph.getEntity({
|
|
9
|
+
class: this,
|
|
10
|
+
}, {
|
|
11
|
+
type: '&',
|
|
12
|
+
ilike: ['groupname', groupname.replace(/([\\%_])/g, (s) => `\\${s}`)],
|
|
13
|
+
});
|
|
14
|
+
if (entity != null) {
|
|
15
|
+
return entity;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return entity;
|
|
19
|
+
}
|
|
20
|
+
constructor() {
|
|
21
|
+
super();
|
|
22
|
+
this.enabled = true;
|
|
23
|
+
this.abilities = [];
|
|
24
|
+
}
|
|
25
|
+
async $checkGroupname() {
|
|
26
|
+
return await this.$serverCall('$checkGroupname', [], {
|
|
27
|
+
pushState: true,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
async $checkEmail() {
|
|
31
|
+
return await this.$serverCall('$checkEmail', [], {
|
|
32
|
+
pushState: true,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
async $getAvatar() {
|
|
36
|
+
return await this.$serverCall('$getAvatar', [], {
|
|
37
|
+
pushState: true,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
async $getChildren(limit, offset, reverse, sort) {
|
|
41
|
+
return await this.$serverCall('$getChildren', [
|
|
42
|
+
limit,
|
|
43
|
+
offset,
|
|
44
|
+
reverse,
|
|
45
|
+
sort,
|
|
46
|
+
]);
|
|
47
|
+
}
|
|
48
|
+
async $getDescendants(andSelf = false) {
|
|
49
|
+
return await this.$serverCall('$getDescendants', [andSelf]);
|
|
50
|
+
}
|
|
51
|
+
async $getLevel() {
|
|
52
|
+
return await this.$serverCall('$getLevel', []);
|
|
53
|
+
}
|
|
54
|
+
async $isDescendant(givenGroup) {
|
|
55
|
+
return await this.$serverCall('$isDescendant', [givenGroup]);
|
|
56
|
+
}
|
|
57
|
+
async $getUsers(descendants = false, limit, offset, reverse, sort, enabled) {
|
|
58
|
+
return await this.$serverCall('$getUsers', [
|
|
59
|
+
descendants,
|
|
60
|
+
limit,
|
|
61
|
+
offset,
|
|
62
|
+
reverse,
|
|
63
|
+
sort,
|
|
64
|
+
enabled,
|
|
65
|
+
]);
|
|
66
|
+
}
|
|
67
|
+
static async getPrimaryGroups(options, selectors) {
|
|
68
|
+
return await this.serverCallStatic('getPrimaryGroups', [
|
|
69
|
+
{ options, class: this.class },
|
|
70
|
+
selectors,
|
|
71
|
+
]);
|
|
72
|
+
}
|
|
73
|
+
static async getSecondaryGroups(options, selectors) {
|
|
74
|
+
return await this.serverCallStatic('getSecondaryGroups', [
|
|
75
|
+
{ options, class: this.class },
|
|
76
|
+
selectors,
|
|
77
|
+
]);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
//# sour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,CAAC,kBAAkB,CACpC,OAAiB,EACjB,SAAsB;QAEtB,OAAO,MAAM,IAAI,CAAC,gBAAgB,CAAC,oBAAoB,EAAE;YACvD,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE;YAC9B,SAAS;SACV,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Group } from './Group.js';
|
|
2
|
+
import { User } from './User.js';
|
|
3
|
+
export interface AccessControlData {
|
|
4
|
+
user?: User;
|
|
5
|
+
group?: Group;
|
|
6
|
+
acUser?: number;
|
|
7
|
+
acGroup?: number;
|
|
8
|
+
acOther?: number;
|
|
9
|
+
acFull?: string[];
|
|
10
|
+
acWrite?: string[];
|
|
11
|
+
acRead?: string[];
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tilmeld.types.js","sourceRoot":"","sources":["../src/Tilmeld.types.ts"],"names":[],"mappings":""}
|
package/{lib → dist}/User.d.ts
RENAMED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Nymph, Entity } from '@nymphjs/client';
|
|
2
|
-
import type Group from './Group';
|
|
3
|
-
import type { AdminGroupData, CurrentGroupData } from './Group';
|
|
2
|
+
import type { Group, AdminGroupData, CurrentGroupData } from './Group.js';
|
|
4
3
|
export type EventType = 'register' | 'login' | 'logout';
|
|
5
4
|
export type RegisterCallback = (user: User & CurrentUserData) => void;
|
|
6
5
|
export type LoginCallback = (user: User & CurrentUserData) => void;
|
|
7
|
-
export type LogoutCallback = (user: User
|
|
6
|
+
export type LogoutCallback = (user: User) => void;
|
|
8
7
|
export type ClientConfig = {
|
|
9
8
|
regFields: string[];
|
|
10
9
|
userFields: string[];
|
|
@@ -15,36 +14,118 @@ export type ClientConfig = {
|
|
|
15
14
|
verifyEmail: boolean;
|
|
16
15
|
unverifiedAccess: boolean;
|
|
17
16
|
};
|
|
18
|
-
export
|
|
17
|
+
export interface UserData {
|
|
18
|
+
/**
|
|
19
|
+
* The user's username.
|
|
20
|
+
*/
|
|
19
21
|
username?: string;
|
|
22
|
+
/**
|
|
23
|
+
* The user's first name.
|
|
24
|
+
*/
|
|
20
25
|
nameFirst?: string;
|
|
26
|
+
/**
|
|
27
|
+
* The user's middle name.
|
|
28
|
+
*/
|
|
21
29
|
nameMiddle?: string;
|
|
30
|
+
/**
|
|
31
|
+
* The user's last name.
|
|
32
|
+
*/
|
|
22
33
|
nameLast?: string;
|
|
34
|
+
/**
|
|
35
|
+
* The user's full name.
|
|
36
|
+
*/
|
|
23
37
|
name?: string;
|
|
38
|
+
/**
|
|
39
|
+
* The user's avatar URL. (Use $getAvatar() to support Gravatar.)
|
|
40
|
+
*/
|
|
24
41
|
avatar?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Whether the user can log in.
|
|
44
|
+
*/
|
|
25
45
|
enabled?: boolean;
|
|
26
|
-
}
|
|
27
|
-
export
|
|
46
|
+
}
|
|
47
|
+
export interface CurrentUserData extends UserData {
|
|
48
|
+
/**
|
|
49
|
+
* The abilities granted to the user.
|
|
50
|
+
*/
|
|
28
51
|
abilities?: string[];
|
|
52
|
+
/**
|
|
53
|
+
* The user's email address.
|
|
54
|
+
*/
|
|
29
55
|
email?: string;
|
|
56
|
+
/**
|
|
57
|
+
* The user's telephone number.
|
|
58
|
+
*/
|
|
30
59
|
phone?: string;
|
|
60
|
+
/**
|
|
61
|
+
* The user's primary group.
|
|
62
|
+
*/
|
|
31
63
|
group?: Group & CurrentGroupData;
|
|
64
|
+
/**
|
|
65
|
+
* The user's secondary groups.
|
|
66
|
+
*/
|
|
32
67
|
groups?: (Group & CurrentGroupData)[];
|
|
68
|
+
/**
|
|
69
|
+
* Whether the user should inherit the abilities of his groups.
|
|
70
|
+
*/
|
|
33
71
|
inheritAbilities?: boolean;
|
|
34
|
-
|
|
35
|
-
|
|
72
|
+
/**
|
|
73
|
+
* If the user has changed their email address, this is the new one, awaiting
|
|
74
|
+
* verification.
|
|
75
|
+
*/
|
|
76
|
+
newEmailAddress?: string;
|
|
77
|
+
}
|
|
78
|
+
export interface AdminUserData extends CurrentUserData {
|
|
79
|
+
/**
|
|
80
|
+
* The user's primary group.
|
|
81
|
+
*/
|
|
36
82
|
group?: Group & AdminGroupData;
|
|
83
|
+
/**
|
|
84
|
+
* The user's secondary groups.
|
|
85
|
+
*/
|
|
37
86
|
groups?: (Group & AdminGroupData)[];
|
|
87
|
+
/**
|
|
88
|
+
* A verification secret.
|
|
89
|
+
*/
|
|
38
90
|
secret?: string;
|
|
91
|
+
/**
|
|
92
|
+
* The timestamp of when the email address was last changed.
|
|
93
|
+
*/
|
|
39
94
|
emailChangeDate?: number;
|
|
95
|
+
/**
|
|
96
|
+
* An email change proceed secret.
|
|
97
|
+
*/
|
|
40
98
|
newEmailSecret?: string;
|
|
99
|
+
/**
|
|
100
|
+
* The new email address.
|
|
101
|
+
*/
|
|
41
102
|
newEmailAddress?: string;
|
|
103
|
+
/**
|
|
104
|
+
* An email change cancellation secret.
|
|
105
|
+
*/
|
|
42
106
|
cancelEmailSecret?: string;
|
|
107
|
+
/**
|
|
108
|
+
* The old email address.
|
|
109
|
+
*/
|
|
43
110
|
cancelEmailAddress?: string;
|
|
111
|
+
/**
|
|
112
|
+
* A recovery secret.
|
|
113
|
+
*/
|
|
44
114
|
recoverSecret?: string;
|
|
115
|
+
/**
|
|
116
|
+
* The timestamp of when the recovery secret was issued.
|
|
117
|
+
*/
|
|
45
118
|
recoverSecretDate?: number;
|
|
119
|
+
/**
|
|
120
|
+
* Used by admins to change a user's password. Not saved to the database.
|
|
121
|
+
*/
|
|
46
122
|
passwordTemp?: string;
|
|
47
|
-
|
|
123
|
+
/**
|
|
124
|
+
* If set, this timestamp is the cutoff point for JWT issue dates. Any token
|
|
125
|
+
* issued before this date will not authenticate the user.
|
|
126
|
+
*/
|
|
127
|
+
revokeTokenDate?: number;
|
|
128
|
+
}
|
|
48
129
|
type InstanceStore = {
|
|
49
130
|
registerCallbacks: RegisterCallback[];
|
|
50
131
|
loginCallbacks: LoginCallback[];
|
|
@@ -52,15 +133,23 @@ type InstanceStore = {
|
|
|
52
133
|
clientConfig?: ClientConfig;
|
|
53
134
|
clientConfigPromise?: Promise<ClientConfig>;
|
|
54
135
|
removeNymphResponseListener?: () => void;
|
|
136
|
+
currentToken?: string;
|
|
137
|
+
switchToken?: string;
|
|
55
138
|
};
|
|
56
|
-
export
|
|
139
|
+
export interface User extends UserData {
|
|
140
|
+
}
|
|
141
|
+
export declare class User extends Entity<UserData> {
|
|
57
142
|
protected static stores: WeakMap<Nymph, InstanceStore>;
|
|
58
143
|
static class: string;
|
|
59
144
|
static init(nymph: Nymph): void;
|
|
60
|
-
|
|
61
|
-
static
|
|
62
|
-
|
|
63
|
-
|
|
145
|
+
static factoryUsername(username?: string): Promise<User>;
|
|
146
|
+
static getDomainUsers(domain: string, options?: {
|
|
147
|
+
limit?: number;
|
|
148
|
+
offset?: number;
|
|
149
|
+
sort?: string;
|
|
150
|
+
reverse?: boolean;
|
|
151
|
+
}): Promise<User[]>;
|
|
152
|
+
constructor();
|
|
64
153
|
$checkUsername(): Promise<{
|
|
65
154
|
result: boolean;
|
|
66
155
|
message: string;
|
|
@@ -84,6 +173,14 @@ export default class User extends Entity<UserData> {
|
|
|
84
173
|
loggedin: boolean;
|
|
85
174
|
message: string;
|
|
86
175
|
}>;
|
|
176
|
+
$switchUser(data?: {
|
|
177
|
+
additionalData?: {
|
|
178
|
+
[k: string]: any;
|
|
179
|
+
};
|
|
180
|
+
}): Promise<{
|
|
181
|
+
result: boolean;
|
|
182
|
+
message: string;
|
|
183
|
+
}>;
|
|
87
184
|
$logout(): Promise<{
|
|
88
185
|
result: boolean;
|
|
89
186
|
message: string;
|
|
@@ -92,6 +189,34 @@ export default class User extends Entity<UserData> {
|
|
|
92
189
|
$changePassword(data: {
|
|
93
190
|
newPassword: string;
|
|
94
191
|
currentPassword: string;
|
|
192
|
+
revokeCurrentTokens?: boolean;
|
|
193
|
+
}): Promise<{
|
|
194
|
+
result: boolean;
|
|
195
|
+
message: string;
|
|
196
|
+
}>;
|
|
197
|
+
$revokeCurrentTokens(data?: {
|
|
198
|
+
password: string;
|
|
199
|
+
}): Promise<{
|
|
200
|
+
result: boolean;
|
|
201
|
+
message: string;
|
|
202
|
+
}>;
|
|
203
|
+
$hasTOTPSecret(): Promise<boolean>;
|
|
204
|
+
$getNewTOTPSecret(): Promise<{
|
|
205
|
+
uri: string;
|
|
206
|
+
qrcode: string;
|
|
207
|
+
secret: string;
|
|
208
|
+
}>;
|
|
209
|
+
$saveTOTPSecret(data: {
|
|
210
|
+
password: string;
|
|
211
|
+
secret: string;
|
|
212
|
+
code: string;
|
|
213
|
+
}): Promise<{
|
|
214
|
+
result: boolean;
|
|
215
|
+
message: string;
|
|
216
|
+
}>;
|
|
217
|
+
$removeTOTPSecret(data?: {
|
|
218
|
+
password: string;
|
|
219
|
+
code: string;
|
|
95
220
|
}): Promise<{
|
|
96
221
|
result: boolean;
|
|
97
222
|
message: string;
|
|
@@ -101,12 +226,14 @@ export default class User extends Entity<UserData> {
|
|
|
101
226
|
static loginUser(data: {
|
|
102
227
|
username: string;
|
|
103
228
|
password: string;
|
|
229
|
+
code?: string;
|
|
104
230
|
additionalData?: {
|
|
105
231
|
[k: string]: any;
|
|
106
232
|
};
|
|
107
233
|
}): Promise<{
|
|
108
234
|
result: boolean;
|
|
109
235
|
message: string;
|
|
236
|
+
needTOTP?: true;
|
|
110
237
|
user?: User & CurrentUserData;
|
|
111
238
|
}>;
|
|
112
239
|
static sendRecovery(data: {
|
package/{lib → dist}/User.js
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class User
|
|
1
|
+
import { Entity } from '@nymphjs/client';
|
|
2
|
+
export class User extends Entity {
|
|
3
|
+
static stores = new WeakMap();
|
|
4
|
+
// The name of the server class
|
|
5
|
+
static class = 'User';
|
|
6
6
|
static init(nymph) {
|
|
7
7
|
let store = {
|
|
8
8
|
registerCallbacks: [],
|
|
@@ -22,18 +22,6 @@ class User extends client_1.Entity {
|
|
|
22
22
|
store.removeNymphResponseListener = nymph.on('response', (response) => this.handleToken(response));
|
|
23
23
|
this.handleToken();
|
|
24
24
|
}
|
|
25
|
-
constructor(guid) {
|
|
26
|
-
super(guid);
|
|
27
|
-
if (guid == null) {
|
|
28
|
-
this.$data.enabled = true;
|
|
29
|
-
this.$data.abilities = [];
|
|
30
|
-
this.$data.groups = [];
|
|
31
|
-
this.$data.inheritAbilities = true;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
static async factory(guid) {
|
|
35
|
-
return (await super.factory(guid));
|
|
36
|
-
}
|
|
37
25
|
static async factoryUsername(username) {
|
|
38
26
|
const entity = new this();
|
|
39
27
|
if (username != null) {
|
|
@@ -49,27 +37,45 @@ class User extends client_1.Entity {
|
|
|
49
37
|
}
|
|
50
38
|
return entity;
|
|
51
39
|
}
|
|
52
|
-
static
|
|
53
|
-
return
|
|
40
|
+
static async getDomainUsers(domain, options) {
|
|
41
|
+
return await this.serverCallStatic('getDomainUsers', [domain, options]);
|
|
42
|
+
}
|
|
43
|
+
constructor() {
|
|
44
|
+
super();
|
|
45
|
+
this.enabled = true;
|
|
46
|
+
this.abilities = [];
|
|
47
|
+
this.groups = [];
|
|
48
|
+
this.inheritAbilities = true;
|
|
54
49
|
}
|
|
55
50
|
async $checkUsername() {
|
|
56
|
-
return await this.$serverCall('$checkUsername', [],
|
|
51
|
+
return await this.$serverCall('$checkUsername', [], {
|
|
52
|
+
pushState: true,
|
|
53
|
+
});
|
|
57
54
|
}
|
|
58
55
|
async $checkEmail() {
|
|
59
|
-
return await this.$serverCall('$checkEmail', [],
|
|
56
|
+
return await this.$serverCall('$checkEmail', [], {
|
|
57
|
+
pushState: true,
|
|
58
|
+
});
|
|
60
59
|
}
|
|
61
60
|
async $checkPhone() {
|
|
62
|
-
return await this.$serverCall('$checkPhone', [],
|
|
61
|
+
return await this.$serverCall('$checkPhone', [], {
|
|
62
|
+
pushState: true,
|
|
63
|
+
});
|
|
63
64
|
}
|
|
64
65
|
async $getAvatar() {
|
|
65
|
-
return await this.$serverCall('$getAvatar', [],
|
|
66
|
+
return await this.$serverCall('$getAvatar', [], {
|
|
67
|
+
pushState: true,
|
|
68
|
+
});
|
|
66
69
|
}
|
|
67
70
|
async $register(data) {
|
|
68
71
|
const store = User.stores.get(this.$nymph);
|
|
69
72
|
if (store == null) {
|
|
70
73
|
throw new Error('This user class was never initialized with an instance of Nymph');
|
|
71
74
|
}
|
|
72
|
-
const response = await this.$serverCall('$register', [data]
|
|
75
|
+
const response = await this.$serverCall('$register', [data], {
|
|
76
|
+
pushState: true,
|
|
77
|
+
pullState: true,
|
|
78
|
+
});
|
|
73
79
|
if (response.result) {
|
|
74
80
|
for (let i = 0; i < store.registerCallbacks.length; i++) {
|
|
75
81
|
store.registerCallbacks[i] && store.registerCallbacks[i](this);
|
|
@@ -83,6 +89,20 @@ class User extends client_1.Entity {
|
|
|
83
89
|
}
|
|
84
90
|
return response;
|
|
85
91
|
}
|
|
92
|
+
async $switchUser(data) {
|
|
93
|
+
const store = User.stores.get(this.$nymph);
|
|
94
|
+
if (store == null) {
|
|
95
|
+
throw new Error('This user class was never initialized with an instance of Nymph');
|
|
96
|
+
}
|
|
97
|
+
const response = await this.$serverCall('$switchUser', [data]);
|
|
98
|
+
if (response.result) {
|
|
99
|
+
this.constructor.handleToken();
|
|
100
|
+
for (let i = 0; i < store.loginCallbacks.length; i++) {
|
|
101
|
+
store.loginCallbacks[i] && store.loginCallbacks[i](this);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return response;
|
|
105
|
+
}
|
|
86
106
|
async $logout() {
|
|
87
107
|
const store = User.stores.get(this.$nymph);
|
|
88
108
|
if (store == null) {
|
|
@@ -98,10 +118,33 @@ class User extends client_1.Entity {
|
|
|
98
118
|
return response;
|
|
99
119
|
}
|
|
100
120
|
async $gatekeeper(ability) {
|
|
101
|
-
return await this.$serverCall('$gatekeeper', [ability]
|
|
121
|
+
return await this.$serverCall('$gatekeeper', [ability]);
|
|
102
122
|
}
|
|
103
123
|
async $changePassword(data) {
|
|
104
|
-
return await this.$serverCall('$changePassword', [data]
|
|
124
|
+
return await this.$serverCall('$changePassword', [data], {
|
|
125
|
+
pullState: true,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
async $revokeCurrentTokens(data) {
|
|
129
|
+
return await this.$serverCall('$revokeCurrentTokens', [data], {
|
|
130
|
+
pullState: true,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
async $hasTOTPSecret() {
|
|
134
|
+
return await this.$serverCall('$hasTOTPSecret', []);
|
|
135
|
+
}
|
|
136
|
+
async $getNewTOTPSecret() {
|
|
137
|
+
return await this.$serverCall('$getNewTOTPSecret', []);
|
|
138
|
+
}
|
|
139
|
+
async $saveTOTPSecret(data) {
|
|
140
|
+
return await this.$serverCall('$saveTOTPSecret', [data], {
|
|
141
|
+
pullState: true,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
async $removeTOTPSecret(data) {
|
|
145
|
+
return await this.$serverCall('$removeTOTPSecret', [...(data ? [data] : [])], {
|
|
146
|
+
pullState: true,
|
|
147
|
+
});
|
|
105
148
|
}
|
|
106
149
|
static async current(returnObjectIfNotExist) {
|
|
107
150
|
const currentUser = await this.serverCallStatic('current', [false]);
|
|
@@ -148,40 +191,64 @@ class User extends client_1.Entity {
|
|
|
148
191
|
return await store.clientConfigPromise;
|
|
149
192
|
}
|
|
150
193
|
static handleToken(response) {
|
|
194
|
+
const store = User.stores.get(this.nymph);
|
|
195
|
+
if (store == null) {
|
|
196
|
+
throw new Error('This user class was never initialized with an instance of Nymph');
|
|
197
|
+
}
|
|
151
198
|
let token = null;
|
|
199
|
+
let switchToken = null;
|
|
200
|
+
let hasNoCookie = typeof document === 'undefined' || typeof document.cookie === 'undefined';
|
|
152
201
|
const authCookiePattern = /(?:(?:^|.*;\s*)TILMELDAUTH\s*=\s*([^;]*).*$)|^.*$/;
|
|
202
|
+
const switchCookiePattern = /(?:(?:^|.*;\s*)TILMELDSWITCH\s*=\s*([^;]*).*$)|^.*$/;
|
|
153
203
|
if (response && response.headers.has('X-TILMELDAUTH')) {
|
|
154
204
|
token = response.headers.get('X-TILMELDAUTH');
|
|
205
|
+
switchToken = response.headers.get('X-TILMELDSWITCH');
|
|
155
206
|
}
|
|
156
207
|
else if (typeof document !== 'undefined' &&
|
|
157
208
|
document.cookie.match(authCookiePattern)) {
|
|
158
209
|
token = document.cookie.replace(authCookiePattern, '$1');
|
|
210
|
+
switchToken = document.cookie.replace(switchCookiePattern, '$1');
|
|
159
211
|
}
|
|
160
212
|
else {
|
|
161
213
|
return;
|
|
162
214
|
}
|
|
163
|
-
if (currentToken
|
|
215
|
+
if (store.currentToken != token || store.switchToken != switchToken) {
|
|
164
216
|
if (token == null || token === '') {
|
|
165
|
-
if (currentToken != null) {
|
|
166
|
-
this.nymph.
|
|
217
|
+
if (store.currentToken != null) {
|
|
218
|
+
delete this.nymph.headers['X-Xsrf-Token'];
|
|
219
|
+
delete this.nymph.headers['X-TILMELDAUTH'];
|
|
220
|
+
delete this.nymph.headers['X-TILMELDSWITCH'];
|
|
167
221
|
if (this.nymph.pubsub) {
|
|
168
|
-
this.nymph.pubsub.
|
|
222
|
+
this.nymph.pubsub.authenticate(null);
|
|
169
223
|
}
|
|
170
|
-
|
|
224
|
+
// Make sure entities requested under a previous user are not reused.
|
|
225
|
+
this.nymph.clearCaches();
|
|
226
|
+
delete store.currentToken;
|
|
227
|
+
delete store.switchToken;
|
|
171
228
|
}
|
|
172
229
|
}
|
|
173
230
|
else {
|
|
174
231
|
const base64Url = token.split('.')[1];
|
|
175
232
|
const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
|
|
176
233
|
const json = typeof atob === 'undefined'
|
|
177
|
-
? Buffer.from(base64, 'base64').toString('binary')
|
|
178
|
-
: atob(base64);
|
|
234
|
+
? Buffer.from(base64, 'base64').toString('binary') // node
|
|
235
|
+
: atob(base64); // browser
|
|
179
236
|
const jwt = JSON.parse(json);
|
|
180
|
-
this.nymph.
|
|
237
|
+
this.nymph.headers['X-Xsrf-Token'] = jwt.xsrfToken;
|
|
238
|
+
if (hasNoCookie) {
|
|
239
|
+
this.nymph.headers['X-TILMELDAUTH'] = token;
|
|
240
|
+
delete this.nymph.headers['X-TILMELDSWITCH'];
|
|
241
|
+
if (switchToken != null) {
|
|
242
|
+
this.nymph.headers['X-TILMELDSWITCH'] = switchToken;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
181
245
|
if (this.nymph.pubsub) {
|
|
182
|
-
this.nymph.pubsub.
|
|
246
|
+
this.nymph.pubsub.authenticate(token, switchToken);
|
|
183
247
|
}
|
|
184
|
-
|
|
248
|
+
// Make sure entities requested under a previous user are not reused.
|
|
249
|
+
this.nymph.clearCaches();
|
|
250
|
+
store.currentToken = token;
|
|
251
|
+
store.switchToken = switchToken ?? undefined;
|
|
185
252
|
}
|
|
186
253
|
}
|
|
187
254
|
}
|
|
@@ -194,6 +261,7 @@ class User extends client_1.Entity {
|
|
|
194
261
|
if (!(prop in store)) {
|
|
195
262
|
throw new Error('Invalid event type.');
|
|
196
263
|
}
|
|
264
|
+
// @ts-ignore: The callback should always be the right type here.
|
|
197
265
|
store[prop].push(callback);
|
|
198
266
|
return () => this.off(event, callback);
|
|
199
267
|
}
|
|
@@ -206,14 +274,13 @@ class User extends client_1.Entity {
|
|
|
206
274
|
if (!(prop in store)) {
|
|
207
275
|
return false;
|
|
208
276
|
}
|
|
277
|
+
// @ts-ignore: The callback should always be the right type here.
|
|
209
278
|
const i = store[prop].indexOf(callback);
|
|
210
279
|
if (i > -1) {
|
|
280
|
+
// @ts-ignore: The callback should always be the right type here.
|
|
211
281
|
store[prop].splice(i, 1);
|
|
212
282
|
}
|
|
213
283
|
return true;
|
|
214
284
|
}
|
|
215
285
|
}
|
|
216
|
-
exports.default = User;
|
|
217
|
-
User.stores = new WeakMap();
|
|
218
|
-
User.class = 'User';
|
|
219
286
|
//# sourceMappingURL=User.js.map
|
package/dist/User.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"User.js","sourceRoot":"","sources":["../src/User.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAqJhD,MAAM,OAAO,IAAK,SAAQ,MAAgB;IAC9B,MAAM,CAAC,MAAM,GAAG,IAAI,OAAO,EAAwB,CAAC;IAE9D,+BAA+B;IACxB,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC;IAEtB,MAAM,CAAC,IAAI,CAAC,KAAY;QAC7B,IAAI,KAAK,GAAkB;YACzB,iBAAiB,EAAE,EAAE;YACrB,cAAc,EAAE,EAAE;YAClB,eAAe,EAAE,EAAE;SACpB,CAAC;QAEF,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YAC3B,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAExC,IAAI,QAAQ,EAAE,CAAC;gBACb,KAAK,GAAG,QAAQ,CAAC;YACnB,CAAC;QACH,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAE9B,IAAI,KAAK,CAAC,2BAA2B,EAAE,CAAC;YACtC,KAAK,CAAC,2BAA2B,EAAE,CAAC;QACtC,CAAC;QACD,KAAK,CAAC,2BAA2B,GAAG,KAAK,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,EAAE,CACpE,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAC3B,CAAC;QACF,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,QAAiB;QAC5C,MAAM,MAAM,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