@@ -8,6 +8,14 @@ mongoose.connect(process.env.SUBLINE_DB, {useNewUrlParser: true, useUnifiedTopol
app.set("view engine", "ejs");
+function requireHTTPS(req, res, next) {
+ if (!req.secure && req.get('x-forwarded-proto') !== 'https' && process.env.NODE_ENV !== "development") {
+ return res.redirect('https://' + req.get('host') + req.url);
+ }
+ next();
+}
+
+app.use(requireHTTPS);
app.use(session({
secret: "Super Secret Subline Subliminally Saving Secrets So Sneaky Snakes Stay Sullen",
cookie: {secure: false},
@@ -19,12 +19,14 @@ window.accountObj = {
email: document.querySelector("#accountEmail").value
}
- if(validator.isSanitary(name)){
+ if(validator.isSanitary(data.name) && validator.isSanitary(data.email)){
axios.post("/merchant/update", data)
.then((response)=>{
if(typeof(response.data) === "string"){
banner.createError(response.data);
}else{
+ document.querySelector("#title").innerText = data.name;
merchant.name = data.name;
merchant.email = data.email;
@@ -184,10 +184,11 @@ let validator = {
},
isSanitary: function(str){
- let disallowed = ["\\", "<", ">", "$"];
+ let disallowed = ["\\", "<", ">", "$", "{", "}", "(", ")"];
for(let char of disallowed){
if(str.includes(char)){
+ banner.createError("Your string contains illegal characters");
return false;