@adminforth/user-soft-delete 1.2.0 → 1.2.2

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/index.js CHANGED
@@ -41,12 +41,12 @@ export default class UserSoftDelete extends AdminForthPlugin {
41
41
  body: {
42
42
  allowedLogin: false,
43
43
  redirectTo: '/login',
44
- },
45
- ok: true
44
+ }
46
45
  };
47
46
  if (adminUser.dbUser[this.options.activeFieldName] === false) {
48
47
  return rejectResult;
49
48
  }
49
+ return { body: { allowedLogin: true } };
50
50
  }));
51
51
  const adminUserAuthorize = this.adminforth.config.auth.adminUserAuthorize;
52
52
  const adminUserAuthorizeArray = Array.isArray(adminUserAuthorize) ? adminUserAuthorize : [adminUserAuthorize];
@@ -58,6 +58,7 @@ export default class UserSoftDelete extends AdminForthPlugin {
58
58
  if (adminUser.dbUser[this.options.activeFieldName] === false) {
59
59
  return rejectResult;
60
60
  }
61
+ return { allowed: true };
61
62
  }));
62
63
  if (!resourceConfig.options.pageInjections) {
63
64
  resourceConfig.options.pageInjections = {};
@@ -120,7 +121,7 @@ export default class UserSoftDelete extends AdminForthPlugin {
120
121
  if (oldUser[primaryKeyColumn.name] === adminUser.dbUser[primaryKeyColumn.name]) {
121
122
  return { ok: false, error: "You cannot deactivate your own account" };
122
123
  }
123
- const newUser = Object.assign(Object.assign({}, oldUser), { [this.options.activeFieldName]: false });
124
+ const newUser = { [this.options.activeFieldName]: false };
124
125
  yield this.adminforth.updateResourceRecord({
125
126
  resource: this.resourceConfig,
126
127
  recordId: id,
package/index.ts CHANGED
@@ -35,12 +35,12 @@ export default class UserSoftDelete extends AdminForthPlugin {
35
35
  body:{
36
36
  allowedLogin: false,
37
37
  redirectTo: '/login',
38
- },
39
- ok: true
38
+ }
40
39
  };
41
40
  if (adminUser.dbUser[this.options.activeFieldName] === false) {
42
41
  return rejectResult;
43
42
  }
43
+ return { body: {allowedLogin: true} };
44
44
  }
45
45
  );
46
46
 
@@ -55,6 +55,7 @@ export default class UserSoftDelete extends AdminForthPlugin {
55
55
  if (adminUser.dbUser[this.options.activeFieldName] === false) {
56
56
  return rejectResult;
57
57
  }
58
+ return { allowed: true };
58
59
  }
59
60
  );
60
61
 
@@ -133,7 +134,7 @@ export default class UserSoftDelete extends AdminForthPlugin {
133
134
  return {ok: false, error: "You cannot deactivate your own account"}
134
135
  }
135
136
 
136
- const newUser = { ...oldUser, [this.options.activeFieldName]: false };
137
+ const newUser = { [this.options.activeFieldName]: false };
137
138
 
138
139
  await this.adminforth.updateResourceRecord({
139
140
  resource: this.resourceConfig,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/user-soft-delete",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",