Merge branch 'fix-org-lock' into 'master'

fix: org lock

See merge request uxf/vnc-hybridauth2!19
This commit is contained in:
2024-04-24 11:50:33 +00:00
+6 -2
View File
@@ -256,9 +256,12 @@ function IsValidRedmineUser(username) {
queryparams[0] = uid;
queryparams[1] = "api";
queryparams[2] = "@" + config.domain;
queryparams[3] = true;
var query = "SELECT DISTINCT ON (uid) users.login AS uid, users.firstname AS givenName, users.lastname AS sn, ";
query += "users.login||$3 as email, tokens.value AS RedmineAPIKey FROM users, tokens ";
query += "WHERE users.status=1 AND lower(users.login)=$1 and tokens.action=$2 and tokens.user_id=users.id";
query += "organizations.name as memberOf, organizations.active as org_active, "
query += "users.login||$3 as email, tokens.value AS RedmineAPIKey FROM users, tokens, organization_users, organizations ";
query += "WHERE users.status=1 AND lower(users.login)=$1 and tokens.action=$2 and tokens.user_id=users.id ";
query += "and organizations.id=organization_users.organization_id and organizations.active=$4;"
// var query = "select SELECT DISTINCT ON (uid) users.login AS uid, users.firstname AS givenName, users.lastname AS sn, users.login||\'@talk.vnc.de\' AS mail FROM users WHERE users.status=1 AND users.login=$1 AND substring(users.hashed_password, 0, length(users.hashed_password)+1) = encode(digest(users.salt||encode(digest(:password, \'sha1\'), \'hex\'), \'sha1\'), \'hex\')";
dbpool.query(query, queryparams, function (derr, dres) {
@@ -439,6 +442,7 @@ app.get('/', async function (req, res) {
}
}
if (config.useRedmineAuth) {
let validRedmineUser = false;
var finalProfile = {};
let userProfile = await IsValidRedmineUser(username);