@saltcorn/server 0.9.3-beta.2 → 0.9.3-beta.4

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/auth/routes.js CHANGED
@@ -56,7 +56,7 @@ const Table = require("@saltcorn/data/models/table");
56
56
  const {
57
57
  getForm,
58
58
  } = require("@saltcorn/data/base-plugin/viewtemplates/viewable_fields");
59
- const { InvalidConfiguration } = require("@saltcorn/data/utils");
59
+ const { InvalidConfiguration, getSessionId } = require("@saltcorn/data/utils");
60
60
  const Trigger = require("@saltcorn/data/models/trigger");
61
61
  const { restore_backup } = require("../markup/admin.js");
62
62
  const { restore } = require("@saltcorn/admin-models/models/backup");
@@ -710,10 +710,12 @@ const getNewUserForm = async (new_user_view_name, req, askEmail) => {
710
710
  * @param {object} res
711
711
  * @returns {void}
712
712
  */
713
- const signup_login_with_user = (u, req, res, redirUrl) =>
714
- req.login(u.session_object, function (err) {
713
+ const signup_login_with_user = (u, req, res, redirUrl) => {
714
+ const old_session_id = getSessionId(req);
715
+ return req.login(u.session_object, function (err) {
715
716
  if (!err) {
716
- Trigger.emitEvent("Login", null, u);
717
+ const session_id = getSessionId(req);
718
+ Trigger.emitEvent("Login", null, u, { old_session_id, session_id });
717
719
  if (getState().verifier) res.redirect("/auth/verification-flow");
718
720
  else if (getState().get2FApolicy(u) === "Mandatory")
719
721
  res.redirect("/auth/twofa/setup/totp");
@@ -723,7 +725,7 @@ const signup_login_with_user = (u, req, res, redirUrl) =>
723
725
  res.redirect("/auth/signup");
724
726
  }
725
727
  });
726
-
728
+ };
727
729
  /**
728
730
  * @name get/signup_final_ext
729
731
  * @function
@@ -1063,6 +1065,11 @@ const userLimiter = rateLimit({
1063
1065
  handler,
1064
1066
  });
1065
1067
 
1068
+ function setOldSessionID(req, res, next) {
1069
+ req.old_session_id = getSessionId(req);
1070
+ next();
1071
+ }
1072
+
1066
1073
  /**
1067
1074
  * POST /auth/login
1068
1075
  * @name post/login
@@ -1073,6 +1080,7 @@ router.post(
1073
1080
  "/login",
1074
1081
  ipLimiter,
1075
1082
  userLimiter,
1083
+ setOldSessionID,
1076
1084
  passport.authenticate("local", {
1077
1085
  //successRedirect: "/",
1078
1086
  failureRedirect: "/auth/login",
@@ -1095,7 +1103,12 @@ router.post(
1095
1103
  if (setDur) req.session.cookie.maxAge = setDur * 60 * 60 * 1000;
1096
1104
  else req.session.cookie.expires = false;
1097
1105
  }
1098
- Trigger.emitEvent("Login", null, req.user);
1106
+ const session_id = getSessionId(req);
1107
+
1108
+ Trigger.emitEvent("Login", null, req.user, {
1109
+ session_id,
1110
+ old_session_id: req.old_session_id,
1111
+ });
1099
1112
  res?.cookie?.("loggedin", "true");
1100
1113
  req.flash("success", req.__("Welcome, %s!", req.user.email));
1101
1114
  if (req.smr) {
package/locales/en.json CHANGED
@@ -1287,5 +1287,12 @@
1287
1287
  "Configure action": "Configure action",
1288
1288
  "No changes detected, snapshot skipped": "No changes detected, snapshot skipped",
1289
1289
  "Cannot remove module: views %s depend on it": "Cannot remove module: views %s depend on it",
1290
- "The view name is part of the URL when it is shown alone.": "The view name is part of the URL when it is shown alone."
1290
+ "The view name is part of the URL when it is shown alone.": "The view name is part of the URL when it is shown alone.",
1291
+ "Exclusion relations": "Exclusion relations",
1292
+ "Do not include row if this relation has a match": "Do not include row if this relation has a match",
1293
+ "Exclusion where": "Exclusion where",
1294
+ "Hoverable rows": "Hoverable rows",
1295
+ "Highlight row under cursor": "Highlight row under cursor",
1296
+ "Striped rows": "Striped rows",
1297
+ "Add zebra stripes to rows": "Add zebra stripes to rows"
1291
1298
  }
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@saltcorn/server",
3
- "version": "0.9.3-beta.2",
3
+ "version": "0.9.3-beta.4",
4
4
  "description": "Server app for Saltcorn, open-source no-code platform",
5
5
  "homepage": "https://saltcorn.com",
6
6
  "main": "index.js",
7
7
  "license": "MIT",
8
8
  "dependencies": {
9
9
  "@aws-sdk/client-s3": "^3.451.0",
10
- "@saltcorn/base-plugin": "0.9.3-beta.2",
11
- "@saltcorn/builder": "0.9.3-beta.2",
12
- "@saltcorn/data": "0.9.3-beta.2",
13
- "@saltcorn/admin-models": "0.9.3-beta.2",
14
- "@saltcorn/filemanager": "0.9.3-beta.2",
15
- "@saltcorn/markup": "0.9.3-beta.2",
16
- "@saltcorn/sbadmin2": "0.9.3-beta.2",
10
+ "@saltcorn/base-plugin": "0.9.3-beta.4",
11
+ "@saltcorn/builder": "0.9.3-beta.4",
12
+ "@saltcorn/data": "0.9.3-beta.4",
13
+ "@saltcorn/admin-models": "0.9.3-beta.4",
14
+ "@saltcorn/filemanager": "0.9.3-beta.4",
15
+ "@saltcorn/markup": "0.9.3-beta.4",
16
+ "@saltcorn/sbadmin2": "0.9.3-beta.4",
17
17
  "@socket.io/cluster-adapter": "^0.2.1",
18
18
  "@socket.io/sticky": "^1.0.1",
19
19
  "adm-zip": "0.5.10",
@@ -54,7 +54,7 @@
54
54
  "pg": "^8.2.1",
55
55
  "pluralize": "^8.0.0",
56
56
  "qrcode": "1.5.1",
57
- "resize-with-sharp-or-jimp": "0.1.6",
57
+ "resize-with-sharp-or-jimp": "0.1.7",
58
58
  "socket.io": "4.6.0",
59
59
  "systeminformation": "^5.21.7",
60
60
  "thirty-two": "1.0.2",
@@ -513,7 +513,7 @@ function applyViewConfig(e, url, k, event) {
513
513
  complete: () => {},
514
514
  });
515
515
 
516
- return false;
516
+ //return false;
517
517
  }
518
518
 
519
519
  function updateViewPreview() {