@semapps/auth 0.4.0-alpha.12 → 0.4.0-alpha.13
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/mixins/auth.js +8 -0
- package/package.json +4 -4
- package/services/account.js +2 -1
- package/services/auth.local.js +5 -4
package/mixins/auth.js
CHANGED
@@ -11,6 +11,7 @@ const AuthMixin = {
|
|
11
11
|
registrationAllowed: true,
|
12
12
|
reservedUsernames: [],
|
13
13
|
webIdSelection: [],
|
14
|
+
accountSelection: [],
|
14
15
|
accountsDataset: 'settings'
|
15
16
|
},
|
16
17
|
dependencies: ['api', 'webid'],
|
@@ -111,6 +112,13 @@ const AuthMixin = {
|
|
111
112
|
} else {
|
112
113
|
return data;
|
113
114
|
}
|
115
|
+
},
|
116
|
+
pickAccountData(data) {
|
117
|
+
if (this.settings.accountSelection.length > 0) {
|
118
|
+
return Object.fromEntries(this.settings.accountSelection.filter(key => key in data).map(key => [key, data[key]]));
|
119
|
+
} else {
|
120
|
+
return data || {};
|
121
|
+
}
|
114
122
|
}
|
115
123
|
}
|
116
124
|
};
|
package/package.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "@semapps/auth",
|
3
|
-
"version": "0.4.0-alpha.
|
3
|
+
"version": "0.4.0-alpha.13",
|
4
4
|
"description": "Authentification module for SemApps",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"author": "Virtual Assembly",
|
7
7
|
"dependencies": {
|
8
|
-
"@semapps/mime-types": "0.4.0-alpha.
|
9
|
-
"@semapps/triplestore": "0.4.0-alpha.
|
8
|
+
"@semapps/mime-types": "0.4.0-alpha.13",
|
9
|
+
"@semapps/triplestore": "0.4.0-alpha.13",
|
10
10
|
"bcrypt": "^5.0.1",
|
11
11
|
"express-session": "^1.17.0",
|
12
12
|
"jsonwebtoken": "^8.5.1",
|
@@ -22,5 +22,5 @@
|
|
22
22
|
"publishConfig": {
|
23
23
|
"access": "public"
|
24
24
|
},
|
25
|
-
"gitHead": "
|
25
|
+
"gitHead": "8d9719359c3e791abe17a1c3e615fb138a0edf33"
|
26
26
|
}
|
package/services/account.js
CHANGED
@@ -13,7 +13,7 @@ module.exports = {
|
|
13
13
|
dependencies: ['triplestore'],
|
14
14
|
actions: {
|
15
15
|
async create(ctx) {
|
16
|
-
let { uuid, username, password, email, webId } = ctx.params;
|
16
|
+
let { uuid, username, password, email, webId, ...rest } = ctx.params;
|
17
17
|
const hashedPassword = password ? await this.hashPassword(password) : undefined;
|
18
18
|
|
19
19
|
email = email.toLowerCase();
|
@@ -38,6 +38,7 @@ module.exports = {
|
|
38
38
|
}
|
39
39
|
|
40
40
|
return await this._create(ctx, {
|
41
|
+
...rest,
|
41
42
|
uuid,
|
42
43
|
username,
|
43
44
|
email,
|
package/services/auth.local.js
CHANGED
@@ -11,18 +11,19 @@ const AuthLocalService = {
|
|
11
11
|
jwtPath: null,
|
12
12
|
registrationAllowed: true,
|
13
13
|
reservedUsernames: [],
|
14
|
-
webIdSelection: []
|
14
|
+
webIdSelection: [],
|
15
|
+
accountSelection: [],
|
15
16
|
},
|
16
17
|
created() {
|
17
18
|
this.passportId = 'local';
|
18
19
|
},
|
19
20
|
actions: {
|
20
21
|
async signup(ctx) {
|
21
|
-
const { username, email, password, ...
|
22
|
+
const { username, email, password, ...rest } = ctx.params;
|
22
23
|
|
23
|
-
let accountData = await ctx.call('auth.account.create', { username, email, password });
|
24
|
+
let accountData = await ctx.call('auth.account.create', { username, email, password, ...this.pickAccountData(rest) });
|
24
25
|
|
25
|
-
const profileData = { nick: username, email, ...
|
26
|
+
const profileData = { nick: username, email, ...rest };
|
26
27
|
const webId = await ctx.call('webid.create', this.pickWebIdData(profileData));
|
27
28
|
|
28
29
|
// Link the webId with the account
|