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 " +
|
||||
"uid AS username,displayName,mailVerified,authenticated,memberSince AS name,mail " +
|
||||
"FROM users WHERE id=:id";
|
||||
|
||||
return userDB.sequelize.query(query, {
|
||||
replacements: {
|
||||
id: req.session.userId
|
||||
@ -224,14 +223,17 @@ const getSessionUser = function(req) {
|
||||
throw "Invalid account.";
|
||||
}
|
||||
|
||||
req.user = results[0];
|
||||
if (!req.user.authenticated) {
|
||||
let user = results[0];
|
||||
req.user = user;
|
||||
if (!user.authenticated) {
|
||||
throw "Accout not authenticated.";
|
||||
}
|
||||
|
||||
if (!req.user.mailVerified) {
|
||||
if (!user.mailVerified) {
|
||||
throw "Account mail not verified.";
|
||||
}
|
||||
|
||||
return user;
|
||||
});
|
||||
}).then(function(user) {
|
||||
if (!config.has("restrictions")) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user