Commit c78063ce authored by Rosanny Sihombing's avatar Rosanny Sihombing Committed by Rosanny Sihombing
Browse files

MLAB-642: change var to let


(cherry picked from commit 2273844d)
parent 52d503e3
......@@ -15,8 +15,8 @@ export = function (app:any, config:any, lang:string) {
})
app.post('/registration', function(req:any, res:any) {
// user data
var curDate:Date = new Date()
var userData:any = {
let curDate:Date = new Date()
let userData:any = {
salutation: req.body.inputSalutation,
title: req.body.inputTitle,
firstname: req.body.inputFirstname,
......@@ -28,10 +28,10 @@ export = function (app:any, config:any, lang:string) {
createdDate: curDate.toISOString().slice(0,10)
}
var userEmail:any = userData.email
var pos:number = userEmail.indexOf('@')
var emailLength:number = userEmail.length
var emailDomain:any = userEmail.slice(pos, emailLength);
let userEmail:any = userData.email
let pos:number = userEmail.indexOf('@')
let emailLength:number = userEmail.length
let emailDomain:any = userEmail.slice(pos, emailLength);
if ( emailDomain.toLowerCase() == "@hft-stuttgart.de") {
res.flash('error', "Fehlgeschlagen: HFT-Account")
......@@ -48,7 +48,7 @@ export = function (app:any, config:any, lang:string) {
// encrypt password
bcrypt.genSalt(saltRounds, function(err, salt) {
bcrypt.hash(req.body.inputPassword, salt, function(err:any, hash:any) {
var newAccount:any = {
let newAccount:any = {
profile: userData,
password: hash,
verificationToken: token
......@@ -65,8 +65,8 @@ export = function (app:any, config:any, lang:string) {
}
else {
// send email
var emailSubject = "Bitte bestätigen Sie Ihr M4_LAB Benutzerkonto"
var emailContent = '<div>Lieber Nutzer,<br/><br/>' +
let emailSubject = "Bitte bestätigen Sie Ihr M4_LAB Benutzerkonto"
let emailContent = '<div>Lieber Nutzer,<br/><br/>' +
'<p>vielen Dank für Ihre Anmeldung am Transferportal der HFT Stuttgart. <br/>' +
'Um Ihre Anmeldung zu bestätigen, klicken Sie bitte <a href='+config.app.host+'/verifyAccount?token='+newAccount.verificationToken+'>diesen Link</a> ' +
'<br/><br/>' +
......@@ -134,23 +134,23 @@ export = function (app:any, config:any, lang:string) {
})
} else {
// send email
var emailSubject = "Herzlich willkommen"
var emailContent = '<div>Lieber Nutzer,<br/><br/>' +
'<p>herzlich willkommen beim Transferportal der HFT Stuttgart!<br/>' +
'Sie können nun alle Dienste des Portals nutzen.<p/><br/>' + constants.mailSignature;
mailer.options.to = userEmail
mailer.options.subject = emailSubject
mailer.options.html = emailContent
mailer.transporter.sendMail(mailer.options, function(err:any) {
if (err) {
console.log('cannot send email')
throw err
}
})
let emailSubject = "Herzlich willkommen";
let emailContent = '<div>Lieber Nutzer,<br/><br/>' +
'<p>herzlich willkommen beim Transferportal der HFT Stuttgart!<br/>' +
'Sie können nun alle Dienste des Portals nutzen.<p/><br/>' + constants.mailSignature;
mailer.options.to = userEmail;
mailer.options.subject = emailSubject;
mailer.options.html = emailContent;
mailer.transporter.sendMail(mailer.options, function(err:any) {
if (err) {
console.log('cannot send email');
throw err;
}
})
res.render(lang+'/account/verification', {
status: true
})
res.render(lang+'/account/verification', {
status: true
})
}
}
})
......@@ -179,13 +179,13 @@ export = function (app:any, config:any, lang:string) {
token += randomChars.charAt(Math.floor(Math.random() * randomChars.length));
}
var emailSubject = "Ihre Passwort-Anfrage an das Transferportal der HFT Stuttgart";
var emailContent = '<div>Lieber Nutzer,<br/><br/>' +
let emailSubject = "Ihre Passwort-Anfrage an das Transferportal der HFT Stuttgart";
let emailContent = '<div>Lieber Nutzer,<br/><br/>' +
'<p>wir haben Ihre Anfrage zur Erneuerung Ihres Passwortes erhalten. Falls Sie diese Anfrage nicht gesendet haben, ignorieren Sie bitte diese E-Mail.<br/><br/>' +
'Sie können Ihr Passwort mit dem Klick auf diesen Link ändern: '+config.app.host+'/reset/' + token + '<br/>' +
'Dieser Link ist aus Sicherheitsgründen nur für 1 Stunde gültig.<br/></p>' + constants.mailSignature + '</div>'
var credentialData = {
let credentialData = {
user_id: user.id,
resetPasswordToken: token,
resetPasswordExpires: Date.now() + 3600000 // 1 hour
......@@ -227,9 +227,9 @@ export = function (app:any, config:any, lang:string) {
}
})
app.post('/reset/:token', async function(req:any, res:any) {
var newPwd = req.body.inputNewPwd
let newPwd = req.body.inputNewPwd
var user = await methods.getUserByToken(req.params.token)
let user = await methods.getUserByToken(req.params.token)
if (!user) {
res.flash('error', "User not found.")
res.redirect('/login')
......@@ -267,9 +267,9 @@ export = function (app:any, config:any, lang:string) {
// ======================= CONTACT FORM ===========================
app.get('/contact', function (req:any, res:any) {
res.render(lang+'/account/contact', {
user: req.user
})
res.render(lang+'/account/contact', {
user: req.user
})
})
app.post('/contact', function(req:any, res:any, next:any) {
//methods.currentDate();
......@@ -277,8 +277,8 @@ export = function (app:any, config:any, lang:string) {
let supportAddress = "support-transfer@hft-stuttgart.de";
let inputName = req.body.name;
let inputContent = req.body.message;
let emailContent = "Es wurde eine Anfrage an das Transferportal gestellt: \n\n NAME: " + inputName + "\n NACHRICHT:\n "+ inputContent;
let emailSubject = "Ihre Anfrage an das Transferportal";
let emailContent = "Es wurde eine Anfrage an das Transferportal gestellt: \n\n NAME: " + inputName + "\n NACHRICHT:\n "+ inputContent;
async.waterfall([
function(done:any) {
// send email
......
Supports Markdown
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