skapi-js 1.0.12 → 1.0.14

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/js/main/skapi.js CHANGED
@@ -22,7 +22,7 @@ export default class Skapi {
22
22
  set user(value) {
23
23
  }
24
24
  constructor(service, owner, options) {
25
- this.version = '1.0.12';
25
+ this.version = '1.0.14';
26
26
  this.session = null;
27
27
  this.connection = null;
28
28
  this.host = 'skapi';
@@ -369,7 +369,7 @@ export async function signup(form, option) {
369
369
  params.owner = this.__user.user_id;
370
370
  }
371
371
  else {
372
- if (params.access_group) {
372
+ if (!is_admin && params.access_group) {
373
373
  throw new SkapiError('Only admins can set "access_group" parameter.', { code: 'INVALID_PARAMETER' });
374
374
  }
375
375
  await this.logout();
@@ -419,20 +419,20 @@ export async function signup(form, option) {
419
419
  delete params.service;
420
420
  delete params.owner;
421
421
  }
422
- let resp = await request.bind(this)("signup", params, { auth: admin_creating_account });
423
- if (signup_confirmation) {
424
- let u = await authentication.bind(this)().createCognitoUser(params.username || params.email);
425
- cognitoUser = u.cognitoUser;
426
- this.__request_signup_confirmation = u.cognitoUsername;
427
- return "SUCCESS: The account has been created. User's signup confirmation is required.";
428
- }
429
- if (logUser && !admin_creating_account) {
430
- return login.bind(this)({ email: params.username || params.email, password: params.password });
431
- }
432
- if (admin_creating_account) {
433
- return resp;
422
+ let resp = await request.bind(this)("signup", params, { auth: is_admin });
423
+ if (!is_admin) {
424
+ if (signup_confirmation) {
425
+ let u = await authentication.bind(this)().createCognitoUser(params.username || params.email);
426
+ cognitoUser = u.cognitoUser;
427
+ this.__request_signup_confirmation = u.cognitoUsername;
428
+ return "SUCCESS: The account has been created. User's signup confirmation is required.";
429
+ }
430
+ if (logUser) {
431
+ return login.bind(this)({ email: params.username || params.email, password: params.password });
432
+ }
433
+ return 'SUCCESS: The account has been created.';
434
434
  }
435
- return 'SUCCESS: The account has been created.';
435
+ return resp;
436
436
  }
437
437
  export async function disableAccount() {
438
438
  await this.__connection;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skapi-js",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "description": "Javascript library for Skapi: Complete JAM Stack, front-end driven serverless backend API service.",
5
5
  "main": "./dist/skapi.module.js",
6
6
  "types": "./js/Main.d.ts",