Commit 8bedc51f authored by Wolfgang Knopki's avatar Wolfgang Knopki
Browse files

cleanup merge

parent 7b175bf4
Pipeline #558 passed with stage
in 18 seconds
......@@ -9,7 +9,7 @@ const salt = 64; // salt length
// forgot pwd
const async = require('async')
const crypto = require('crypto')
const nodemailer = require('nodemailer')
const nodemailer = require('./mailer')
module.exports = function (app, config, passport, i18n) {
......@@ -75,27 +75,6 @@ module.exports = function (app, config, passport, i18n) {
}
);
// ======== NODEMAILER ====================
var smtpTransport = nodemailer.createTransport({
host: config.mailer.host,
secureConnection: config.mailer.secureConnection,
port: config.mailer.port,
auth: {
user: config.mailer.authUser,
pass: config.mailer.authPass
},
tls: {
ciphers: config.mailer.tlsCiphers
}
});
var mailOptions = {
to: "",
from: config.mailer.from,
subject: "",
text: ""
};
var updatePasswordMailSubject = "Ihr Passwort für das Transferportal wurde gespeichert."
var mailSignature = "Mit den besten Grüßen,\ndas Transferportal-Team der HFT Stuttgart\n\n"+
"Transferportal der Hochschule für Technik Stuttgart\n"+
......@@ -274,7 +253,7 @@ module.exports = function (app, config, passport, i18n) {
else {
req.flash('success', 'Profile updated!');
}
res.redirect('lang+/account/profile');
res.redirect('/account/profile');
})
}
} else {
......@@ -313,7 +292,7 @@ module.exports = function (app, config, passport, i18n) {
else {
if ( newPwd != retypePwd ) {
req.flash('error', "Passwords do no match. Please make sure you re-type your new password correctly.")
res.redirect(lang+'/account/security')
res.redirect('/account/security')
}
else {
// update password
......@@ -551,146 +530,5 @@ module.exports = function (app, config, passport, i18n) {
}
})
})
app.get('/mailinglists', function (req, res) {
async.waterfall([
function(done) {
methods.getAllMailinglists(function(mailinglistOverview, err) {
if (!err) {
done(err, mailinglistOverview)
}
})
},
// create JSON object of mailinglists for front-end
function(mailinglistOverview, done) {
var allMailingLists = [] // JSON object
for (let i = 0; i < mailinglistOverview.length; i++) {
// add data to JSON object
allMailingLists.push({
id: mailinglistOverview[i].id,
name: mailinglistOverview[i].name,
src: mailinglistOverview[i].src,
projectstatus: mailinglistOverview[i].projectstatus,
project_title: mailinglistOverview[i].project_title
});
}
res.render(lang+'/mailinglists', {
isUserAuthenticated: req.isAuthenticated(),
user: req.user,
mailinglists: allMailingLists
});
}
])
});
// ======== APP ROUTES - PROJECT ====================
app.get('/project', function (req, res) {
async.waterfall([
// get all projects from projectdb
function(done) {
methods.getAllProjects(function(projectsOverview, err) {
if (!err) {
done(err, projectsOverview)
}
})
},
// create JSON object for front-end
function(projectsOverview, done) {
var activeProjects = []
var nonActiveProjects = []
for (var i = 0; i < projectsOverview.length; i++) {
var project = {
id: projectsOverview[i].id,
logo: projectsOverview[i].logo,
akronym: projectsOverview[i].pname,
title: projectsOverview[i].title,
summary: projectsOverview[i].onelinesummary,
category: projectsOverview[i].category,
cp: projectsOverview[i].contact_email,
gitlab: projectsOverview[i].gitlab
}
if (projectsOverview[i].projectstatus == 0) {
nonActiveProjects.push(project)
}
else if (projectsOverview[i].projectstatus == 1) {
activeProjects.push(project)
}
}
// render the page
if (req.isAuthenticated()) {
res.render(lang+'/project/projects', {
isUserAuthenticated: true,
nonActive: nonActiveProjects,
active: activeProjects
});
}
else {
res.render(lang+'/project/projects', {
isUserAuthenticated: false,
nonActive: nonActiveProjects,
active: activeProjects
});
}
}
])
})
app.get('/addprojectoverview', function (req, res) {
if (req.isAuthenticated()) {
res.render(lang+'/project/addProjectOverview')
}
else {
res.redirect('/account/login')
}
})
app.post('/addprojectoverview', function (req, res) {
if (req.isAuthenticated()) {
var wiki = 0
if (req.body.wiki)
wiki = 1
var projectOverviewData = {
pname: req.body.pname,
title: req.body.title,
onelinesummary: req.body.summary,
category: req.body.category,
logo: req.body.logo,
gitlab: req.body.gitlabURL,
wiki: wiki,
overview: req.body.overview,
question: req.body.question,
approach: req.body.approach,
result: req.body.result,
keywords: req.body.keywords,
announcement: req.body.announcement,
term: req.body.term,
further_details: req.body.furtherDetails,
website: req.body.website,
src: req.body.src,
caption: req.body.caption,
contact_firstname: req.body.contactFirstname,
contact_lastname: req.body.contactLastname,
contact_email: req.body.contactEmail,
leader_firstname: req.body.leaderFirstname,
leader_lastname: req.body.leaderLastname,
leader_email: req.body.leaderEmail
}
methods.addProjectOverview(projectOverviewData, function(err){
if (err) {
//req.flash('error', "Failed")
req.flash('error', "Fehlgeschlagen")
res.redirect('/account/addProjectOverview');
}
else {
req.flash('success', 'Your project has been created.')
res.redirect('/account/project');
}
})
}
})
};
\ No newline at end of file
......@@ -100,7 +100,7 @@ module.exports = function (app) {
}
})
app.post('/addprojectoverview', function (req, res) {
app.post('/addprojectoverview__', function (req, res) {
if (req.isAuthenticated()) {
var wiki = 0
if (req.body.wiki)
......@@ -136,7 +136,7 @@ module.exports = function (app) {
if (err) {
//req.flash('error', "Failed")
req.flash('error', "Fehlgeschlagen")
res.redirect('/addProjectOverview');
res.redirect('/account/addProjectOverview');
}
else {
req.flash('success', 'Your project has been created.')
......@@ -211,7 +211,7 @@ module.exports = function (app) {
if (err) {
//req.flash('error', "Failed")
req.flash('error', "Fehlgeschlagen")
res.redirect('/addProjectOverview');
res.redirect('/account/addProjectOverview');
}
else {
req.flash('success', 'Your project has been created.')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment