mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-27 16:54:04 +00:00
Added check for blank password.
This commit is contained in:
parent
945288f0c0
commit
edcdedcaae
3 changed files with 11 additions and 1 deletions
1
package-lock.json
generated
1
package-lock.json
generated
|
@ -53,6 +53,7 @@
|
||||||
"notp": "~2.0.3",
|
"notp": "~2.0.3",
|
||||||
"password-hash": "~1.2.2",
|
"password-hash": "~1.2.2",
|
||||||
"pg": "^8.7.3",
|
"pg": "^8.7.3",
|
||||||
|
"pg-connection-string": "^2.5.0",
|
||||||
"postcss-rtlcss": "~3.4.1",
|
"postcss-rtlcss": "~3.4.1",
|
||||||
"postcss-scss": "~4.0.3",
|
"postcss-scss": "~4.0.3",
|
||||||
"prismjs": "^1.27.0",
|
"prismjs": "^1.27.0",
|
||||||
|
|
|
@ -105,6 +105,7 @@
|
||||||
"notp": "~2.0.3",
|
"notp": "~2.0.3",
|
||||||
"password-hash": "~1.2.2",
|
"password-hash": "~1.2.2",
|
||||||
"pg": "^8.7.3",
|
"pg": "^8.7.3",
|
||||||
|
"pg-connection-string": "^2.5.0",
|
||||||
"postcss-rtlcss": "~3.4.1",
|
"postcss-rtlcss": "~3.4.1",
|
||||||
"postcss-scss": "~4.0.3",
|
"postcss-scss": "~4.0.3",
|
||||||
"prismjs": "^1.27.0",
|
"prismjs": "^1.27.0",
|
||||||
|
|
|
@ -12,6 +12,7 @@ const chroma = require("chroma-js");
|
||||||
const { badgeConstants } = require("./config");
|
const { badgeConstants } = require("./config");
|
||||||
const mssql = require("mssql");
|
const mssql = require("mssql");
|
||||||
const { Client } = require("pg");
|
const { Client } = require("pg");
|
||||||
|
const postgresConParse = require("pg-connection-string").parse;
|
||||||
const { NtlmClient } = require("axios-ntlm");
|
const { NtlmClient } = require("axios-ntlm");
|
||||||
|
|
||||||
// From ping-lite
|
// From ping-lite
|
||||||
|
@ -265,11 +266,18 @@ exports.postgresQuery = function (connectionString, query) {
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|
||||||
|
const config = postgresConParse(connectionString);
|
||||||
|
|
||||||
|
if (config.password === "") {
|
||||||
|
// See https://github.com/brianc/node-postgres/issues/1927
|
||||||
|
return reject(new Error("Password is undefined."));
|
||||||
|
}
|
||||||
|
|
||||||
const client = new Client({ connectionString });
|
const client = new Client({ connectionString });
|
||||||
|
|
||||||
client.connect();
|
client.connect();
|
||||||
|
|
||||||
client.query(query)
|
return client.query(query)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
resolve(res);
|
resolve(res);
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue