backend-plus 2.1.8 → 2.2.0

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.
@@ -332,6 +332,7 @@ export type TableDefinition = EditableDbDefinition & {
332
332
  selfRefresh?:boolean
333
333
  filterColumns?:{column:string, operator:string, value:any}[]
334
334
  gridAlias?:string /* front-end css my-table = gridAlias */
335
+ lookupFields?:string[] /* fields that should be used in lookup dialogs; if not specified, fields with isName:true are used */
335
336
  }
336
337
  export interface DetailTable { table?: string, fields: FieldsForConnectDetailTable, abr: string, label?: string, refreshParent?:boolean, refreshFromParent?:boolean, wScreen?:string, condition?:string }
337
338
  export type TableDefinitionFunction = (context: ContextForDump, opts?:any) => TableDefinition;
@@ -432,6 +433,7 @@ export interface AppConfigLogin
432
433
  forget: { // forget password configurations:
433
434
  urlPath: string // url sent by mail. default: `/new-pass`
434
435
  urlPathOk: string // confirmation page
436
+ urlComplete: string // the complete URL. To use when the proxy strips the req.hostname or shorts the path or ...
435
437
  mailFields: string[] // fields for the forget pass mail
436
438
 
437
439
  }
@@ -967,7 +967,7 @@ AppBackend.prototype.start = function start(opts){
967
967
  );
968
968
  }
969
969
  be.config.login.plus=changing(be.config.login.plus,{session:{
970
- name: 'bp'+(packagejson.name+be.config.server["base-url"]||Math.random()).replace('/','#')+'-connect.sid',
970
+ name: 'bp'+(packagejson.name+be.config.server["base-url"]||Math.random()).replace(/\//g,'#')+'-connect.sid',
971
971
  cookie:{
972
972
  path: be.config.server["base-url"]||'/',
973
973
  }
@@ -1848,10 +1848,10 @@ AppBackend.prototype.addUnloggedServices = function addUnloggedServices(mainApp,
1848
1848
  `, [req.body.email.toLowerCase()]).fetchAll();
1849
1849
  if(rows?.length>0){
1850
1850
  await client.query(
1851
- "insert into tokens(token, tokentype, date, username, useragent, due) values ($1, 'new-pass', $2, $3, $4, $5) returning token",
1851
+ "insert into his.tokens(token, tokentype, date, username, useragent, due) values ($1, 'new-pass', $2, $3, $4, $5) returning token",
1852
1852
  [token, now, rows[0].username, req.useragent, now.add({days:1})]
1853
1853
  ).fetchUniqueRow();
1854
- var chpath = req.protocol+'://' +Path.posix.join(req.hostname+baseUrl,'new-pass')+
1854
+ var chpath = (be.config.login.forget?.urlDomainAndRoot ?? req.protocol+'://' +Path.posix.join(req.hostname+baseUrl,'new-pass')) +
1855
1855
  '?token='+token+'&nueva=clave';
1856
1856
  // console.log('chpass', chpath)
1857
1857
  await be.sendMail({
@@ -1880,7 +1880,7 @@ AppBackend.prototype.addUnloggedServices = function addUnloggedServices(mainApp,
1880
1880
  var promise = be.inDbClient(req, async (client)=>{
1881
1881
  var now = bestGlobals.datetime.now();
1882
1882
  var {row} = await client.query(`select *
1883
- from tokens
1883
+ from his.tokens
1884
1884
  where tokentype = 'new-pass' and token = $1
1885
1885
  and due > $2
1886
1886
  limit 1;
@@ -1909,7 +1909,7 @@ AppBackend.prototype.addUnloggedServices = function addUnloggedServices(mainApp,
1909
1909
  var promise = be.inDbClient(req, async (client)=>{
1910
1910
  var now = bestGlobals.datetime.now();
1911
1911
  var {row} = await client.query(`select *
1912
- from tokens
1912
+ from his.tokens
1913
1913
  where tokentype = 'new-pass' and token = $1
1914
1914
  and $2 < due
1915
1915
  limit 1;
@@ -1932,7 +1932,7 @@ AppBackend.prototype.addUnloggedServices = function addUnloggedServices(mainApp,
1932
1932
  })
1933
1933
  })
1934
1934
  res.redirect(Path.posix.join(baseUrl, be.config.login.noLoggedUrlPath || '/login'));
1935
- await client.query(`update tokens set due = null
1935
+ await client.query(`update his.tokens set due = null
1936
1936
  where tokentype = 'new-pass' and token = $1;
1937
1937
  `, [req.body.token]).execute();
1938
1938
  })
@@ -613,7 +613,7 @@ ProcedureTables = [
613
613
  var be=context.be;
614
614
  return Promise.resolve().then(function(){
615
615
  return client.query(
616
- "insert into tokens(token, date, username, useragent) values (md5($1), $2, $3, $4) returning token",
616
+ "insert into his.tokens(token, date, username, useragent) values (md5($1), $2, $3, $4) returning token",
617
617
  [token, now, parameters.username, parameters.useragent]
618
618
  ).fetchUniqueRow();
619
619
  }).then(function(result){
@@ -22,7 +22,7 @@ module.exports = function(context){
22
22
  ],
23
23
  sql:{
24
24
  isTable: true,
25
- from: `(select * from tokens order by date desc)`,
25
+ from: `(select * from his.tokens order by date desc)`,
26
26
  skipEnance:true,
27
27
  },
28
28
  }, context);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "backend-plus",
3
3
  "description": "Backend for the anti Pareto rule",
4
- "version": "2.1.8",
4
+ "version": "2.2.0",
5
5
  "author": "Codenautas <codenautas@googlegroups.com>",
6
6
  "license": "MIT",
7
7
  "repository": "codenautas/backend-plus",
@@ -82,7 +82,7 @@
82
82
  "@types/js-yaml": "^4.0.9",
83
83
  "@types/mocha": "^10.0.10",
84
84
  "@types/multiparty": "~4.2.1",
85
- "@types/node": "^22.13.4",
85
+ "@types/node": "^22.13.8",
86
86
  "@types/nodemailer": "^6.4.17",
87
87
  "@types/numeral": "~2.0.5",
88
88
  "@types/session-file-store": "^1.2.5",
@@ -99,11 +99,11 @@
99
99
  "kill-9": "~0.4.3",
100
100
  "mocha": "^11.1.0",
101
101
  "nyc": "^17.1.0",
102
- "puppeteer": "^24.2.1",
102
+ "puppeteer": "^24.3.0",
103
103
  "sinon": "^19.0.2",
104
104
  "supertest": "^7.0.0",
105
105
  "types.d.ts": "~0.6.22",
106
- "typescript": "^5.7.3",
106
+ "typescript": "^5.8.2",
107
107
  "why-is-node-running": "^3.2.2"
108
108
  },
109
109
  "engines": {