Merge branch 'fix-org-lock' into 'master'
fix: org based locking See merge request uxf/vnc-hybridauth2!21
This commit is contained in:
+12
-7
@@ -256,17 +256,21 @@ 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 += "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;"
|
||||
|
||||
query = "SELECT users.login AS uid, users.firstname AS givenName, users.lastname AS sn, 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 and organization_users.user_id=users.id and organizations.id=organization_users.organization_id and organizations.active";
|
||||
|
||||
|
||||
// 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) {
|
||||
if (derr == null) {
|
||||
if (dres.rowCount > 0) {
|
||||
/*
|
||||
console.log("isValidRedmine query: ", query);
|
||||
console.log("isValidRedmine queryparams: ", queryparams);
|
||||
console.log("isValidRedmine dres.rows: ", dres.rows);
|
||||
*/
|
||||
var redmineUser = {
|
||||
id: dres.rows[0].uid,
|
||||
firstname: dres.rows[0].givenname,
|
||||
@@ -450,7 +454,7 @@ app.get('/', async function (req, res) {
|
||||
if (userProfile) {
|
||||
validRedmineUser = true;
|
||||
}
|
||||
console.log(moment().format("LTS") + ' username ' + username +' - IsValidRedmineUser: ', validRedmineUser);
|
||||
console.log(moment().format("LTS") + ' username ' + username +' - IsValidRedmineUser: ', validRedmineUser, userProfile);
|
||||
if (config.debug) {
|
||||
console.log(moment().format("LTS") + ' username ' + username +' - password: ', password);
|
||||
}
|
||||
@@ -569,6 +573,7 @@ app.get('/login2fa', async function (req, res) {
|
||||
validRedmineUser = true;
|
||||
}
|
||||
console.log(moment().format("LTS") + ' username ' + username +' - IsValidRedmineUser: ', validRedmineUser);
|
||||
console.log(moment().format("LTS") + ' username ' + username +' - userProfile: ', userProfile);
|
||||
if (config.debug) {
|
||||
console.log(moment().format("LTS") + ' username ' + username +' - password: ', password);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user