skapi-js 1.0.11 → 1.0.12
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/dist/skapi.js +1 -1
- package/dist/skapi.js.map +1 -1
- package/dist/skapi.module.js +1 -1
- package/dist/skapi.module.js.map +1 -1
- package/js/main/skapi.js +1 -1
- package/js/methods/user.js +8 -2
- package/package.json +1 -1
package/js/main/skapi.js
CHANGED
package/js/methods/user.js
CHANGED
|
@@ -364,8 +364,11 @@ export async function signup(form, option) {
|
|
|
364
364
|
access_group: 'number',
|
|
365
365
|
misc: 'string'
|
|
366
366
|
}, is_admin ? ['email'] : ['email', 'password']);
|
|
367
|
-
let admin_creating_account = is_admin;
|
|
368
|
-
if (
|
|
367
|
+
let admin_creating_account = is_admin && params.service && this.service !== params.service;
|
|
368
|
+
if (admin_creating_account) {
|
|
369
|
+
params.owner = this.__user.user_id;
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
369
372
|
if (params.access_group) {
|
|
370
373
|
throw new SkapiError('Only admins can set "access_group" parameter.', { code: 'INVALID_PARAMETER' });
|
|
371
374
|
}
|
|
@@ -404,6 +407,9 @@ export async function signup(form, option) {
|
|
|
404
407
|
});
|
|
405
408
|
let logUser = option?.login || false;
|
|
406
409
|
let signup_confirmation = option?.signup_confirmation || false;
|
|
410
|
+
if (admin_creating_account && signup_confirmation && params?.password) {
|
|
411
|
+
throw new SkapiError('Admins cannot create an account with "option.signup_confirmation" option.', { code: 'INVALID_PARAMETER' });
|
|
412
|
+
}
|
|
407
413
|
if (params.email_public && !signup_confirmation) {
|
|
408
414
|
throw new SkapiError('"option.signup_confirmation" should be true if "email_public" is set to true.', { code: 'INVALID_PARAMETER' });
|
|
409
415
|
}
|
package/package.json
CHANGED