Skip to content

Commit

Permalink
Bugfix: accessing user before declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
nzalev committed Jun 23, 2021
1 parent c39cd2b commit e4c08de
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion webserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -6287,6 +6287,8 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
// A user/pass is provided in URL arguments
obj.authenticate(req.query.user, req.query.pass, domain, function (err, userid, passhint, loginOptions) {

var user = obj.users[userid];

// Check if user as the "notools" site right. If so, deny this connection as tools are not allowed to connect.
if ((user != null) && (user.siteadmin != 0xFFFFFFFF) && (user.siteadmin & SITERIGHT_NOMESHCMD)) {
// No tools allowed, close the websocket connection
Expand All @@ -6299,7 +6301,6 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
var twoFactorCookieDays = 30;
if (typeof domain.twofactorcookiedurationdays == 'number') { twoFactorCookieDays = domain.twofactorcookiedurationdays; }

var user = obj.users[userid];
if ((err == null) && (user)) {
// Check if a 2nd factor is needed
if (checkUserOneTimePasswordRequired(domain, user, req, loginOptions) == true) {
Expand Down

0 comments on commit e4c08de

Please sign in to comment.