skapi-js 0.2.2 → 0.2.3

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_id, owner, options) {
25
- this.version = '0.2.2';
25
+ this.version = '0.2.3';
26
26
  this.__disabledAccount = null;
27
27
  this.__cached_requests = {};
28
28
  this.__startKeyHistory = {};
@@ -26,9 +26,7 @@ export declare function recoverAccount(redirect?: boolean | string): Promise<"SU
26
26
  export declare function login(form: Form<{
27
27
  email: string;
28
28
  password: string;
29
- }>, option?: FormSubmitCallback & {
30
- logout: boolean;
31
- }): Promise<User>;
29
+ }>, option?: FormSubmitCallback): Promise<User>;
32
30
  export declare function signup(form: Form<UserAttributes & {
33
31
  email: String;
34
32
  password: String;
@@ -312,19 +312,7 @@ export async function recoverAccount(redirect = false) {
312
312
  return 'SUCCESS: Recovery e-mail has been sent.';
313
313
  }
314
314
  export async function login(form, option) {
315
- await this.__connection;
316
- if (option?.logout === false) {
317
- let to_be_erased = {
318
- '__startKeyHistory': {},
319
- '__cached_requests': {}
320
- };
321
- for (let k in to_be_erased) {
322
- this[k] = to_be_erased[k];
323
- }
324
- }
325
- else {
326
- await logout.bind(this)();
327
- }
315
+ await logout.bind(this)();
328
316
  let params = validator.Params(form, {
329
317
  email: (v) => validator.Email(v),
330
318
  password: (v) => validator.Password(v)
@@ -60,7 +60,7 @@ function Email(email, paramName = 'email') {
60
60
  else if (email.length < 5) {
61
61
  throw new SkapiError(`"${paramName}" should be at least 5 characters.`, { code: 'INVALID_PARAMETER' });
62
62
  }
63
- else if (/^[a-zA-Z0-9.!#$%&'+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z]+[a-zA-Z0-9-]+)$/.test(email)) {
63
+ else if (/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(email)) {
64
64
  email = email.trim();
65
65
  let splitAt = email.split('@');
66
66
  let tld = splitAt[1].split('.');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skapi-js",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
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",