skapi-js 1.0.0-alpha.21 → 1.0.0-alpha.23

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.0-alpha.21';
25
+ this.version = '1.0.0-alpha.23';
26
26
  this.session = null;
27
27
  this.connection = null;
28
28
  this.host = 'skapi';
@@ -217,7 +217,6 @@ export function authentication() {
217
217
  if (userAttributes['custom:signup_ticket'] === 'PASS' || userAttributes['custom:signup_ticket'] === 'MEMBER') {
218
218
  initUser.cognitoUser.completeNewPasswordChallenge(password, {}, {
219
219
  onSuccess: _ => {
220
- cognitoUser = initUser.cognitoUser;
221
220
  getSession().then(session => res(this.user));
222
221
  },
223
222
  onFailure: (err) => {
@@ -230,7 +229,6 @@ export function authentication() {
230
229
  }
231
230
  },
232
231
  onSuccess: _ => getSession().then(_ => {
233
- cognitoUser = initUser.cognitoUser;
234
232
  res(this.user);
235
233
  }),
236
234
  onFailure: (err) => {
@@ -244,6 +242,12 @@ export function authentication() {
244
242
  error = ['Incorrect username or password.', 'INCORRECT_USERNAME_OR_PASSWORD'];
245
243
  }
246
244
  }
245
+ else if (err.code === "UserNotFoundException") {
246
+ error = ['Incorrect username or password.', 'INCORRECT_USERNAME_OR_PASSWORD'];
247
+ }
248
+ else if (err.code === "TooManyRequestsException" || err.code === "LimitExceededException") {
249
+ error = ['Too many attempts. Please try again later.', 'REQUEST_EXCEED'];
250
+ }
247
251
  let errCode = error[1];
248
252
  let errMsg = error[0];
249
253
  let customErr = error[0].split('#');
@@ -554,7 +558,7 @@ export async function changePassword(params) {
554
558
  else if (err?.code === "NotAuthorizedException") {
555
559
  rej(new SkapiError('Incorrect password.', { code: 'INVALID_REQUEST' }));
556
560
  }
557
- else if (err?.code === "TooManyRequestsException") {
561
+ else if (err?.code === "TooManyRequestsException" || err?.code === "LimitExceededException") {
558
562
  rej(new SkapiError('Too many attempts. Please try again later.', { code: 'REQUEST_EXCEED' }));
559
563
  }
560
564
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skapi-js",
3
- "version": "1.0.0-alpha.21",
3
+ "version": "1.0.0-alpha.23",
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",