Fix login via DB; user wasn't being passed down promise chain
This commit is contained in:
parent
0d687cd2d0
commit
2c28dde0bf
@ -212,7 +212,6 @@ const getSessionUser = function(req) {
|
|||||||
let query = "SELECT " +
|
let query = "SELECT " +
|
||||||
"uid AS username,displayName,mailVerified,authenticated,memberSince AS name,mail " +
|
"uid AS username,displayName,mailVerified,authenticated,memberSince AS name,mail " +
|
||||||
"FROM users WHERE id=:id";
|
"FROM users WHERE id=:id";
|
||||||
|
|
||||||
return userDB.sequelize.query(query, {
|
return userDB.sequelize.query(query, {
|
||||||
replacements: {
|
replacements: {
|
||||||
id: req.session.userId
|
id: req.session.userId
|
||||||
@ -224,14 +223,17 @@ const getSessionUser = function(req) {
|
|||||||
throw "Invalid account.";
|
throw "Invalid account.";
|
||||||
}
|
}
|
||||||
|
|
||||||
req.user = results[0];
|
let user = results[0];
|
||||||
if (!req.user.authenticated) {
|
req.user = user;
|
||||||
|
if (!user.authenticated) {
|
||||||
throw "Accout not authenticated.";
|
throw "Accout not authenticated.";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!req.user.mailVerified) {
|
if (!user.mailVerified) {
|
||||||
throw "Account mail not verified.";
|
throw "Account mail not verified.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return user;
|
||||||
});
|
});
|
||||||
}).then(function(user) {
|
}).then(function(user) {
|
||||||
if (!config.has("restrictions")) {
|
if (!config.has("restrictions")) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user