Fix auth email sending
Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
parent
13f1fe3233
commit
17678350fc
@ -23,13 +23,12 @@ const picturesPath = config.get("picturesPath").replace(/\/$/, "") + "/",
|
|||||||
serverConfig = config.get("server");
|
serverConfig = config.get("server");
|
||||||
|
|
||||||
let basePath = config.get("basePath");
|
let basePath = config.get("basePath");
|
||||||
|
|
||||||
let photoDB = null, userDB = null;
|
|
||||||
|
|
||||||
basePath = "/" + basePath.replace(/^\/+/, "").replace(/\/+$/, "") + "/";
|
basePath = "/" + basePath.replace(/^\/+/, "").replace(/\/+$/, "") + "/";
|
||||||
if (basePath == "//") {
|
if (basePath == "//") {
|
||||||
basePath = "/";
|
basePath = "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let photoDB = null, userDB = null;
|
||||||
console.log("Loading pictures out of: " + picturesPath);
|
console.log("Loading pictures out of: " + picturesPath);
|
||||||
console.log("Hosting server from: " + basePath);
|
console.log("Hosting server from: " + basePath);
|
||||||
|
|
||||||
@ -178,8 +177,8 @@ app.use(basePath, function(req, res, next) {
|
|||||||
if (results.length == 0) {
|
if (results.length == 0) {
|
||||||
throw "DB mis-match between authentications and users table";
|
throw "DB mis-match between authentications and users table";
|
||||||
}
|
}
|
||||||
|
const transporter = app.get("transporter");
|
||||||
if (!app.get("transporter")) {
|
if (!transporter) {
|
||||||
console.log("Not sending VERIFIED email; SMTP not configured.");
|
console.log("Not sending VERIFIED email; SMTP not configured.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ const express = require("express"),
|
|||||||
config = require("config"),
|
config = require("config"),
|
||||||
LdapAuth = require("ldapauth-fork"),
|
LdapAuth = require("ldapauth-fork"),
|
||||||
crypto = require("crypto"),
|
crypto = require("crypto"),
|
||||||
createTransport = require("nodemailer").createTransport,
|
|
||||||
hb = require("handlebars");
|
hb = require("handlebars");
|
||||||
|
|
||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
@ -139,7 +138,7 @@ router.post("/create", function(req, res) {
|
|||||||
throw error;
|
throw error;
|
||||||
});
|
});
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
const transporter = app.get("transporter");
|
const transporter = req.app.get("transporter");
|
||||||
if (!transporter) {
|
if (!transporter) {
|
||||||
console.log("Not sending VERIFY email; SMTP not configured.");
|
console.log("Not sending VERIFY email; SMTP not configured.");
|
||||||
return;
|
return;
|
||||||
@ -186,11 +185,11 @@ router.post("/create", function(req, res) {
|
|||||||
}).then(function() {
|
}).then(function() {
|
||||||
return getSessionUser(req).then(function(user) {
|
return getSessionUser(req).then(function(user) {
|
||||||
return res.status(200).send(user);
|
return res.status(200).send(user);
|
||||||
|
}).catch(function(error) {
|
||||||
|
console.log("Error creating account: ", error);
|
||||||
|
return res.status(401).send(error);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}).catch(function(error) {
|
|
||||||
console.log("Error creating account: ", error);
|
|
||||||
return res.status(401).send(error);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -338,6 +337,8 @@ router.post("/login", function(req, res) {
|
|||||||
return getSessionUser(req).then(function(user) {
|
return getSessionUser(req).then(function(user) {
|
||||||
return res.status(200).send(user);
|
return res.status(200).send(user);
|
||||||
});
|
});
|
||||||
|
}).catch(function(error) {
|
||||||
|
return res.status(403).send(error);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user