From 3acdd9fe7790ddc33939a4054e5f6ce746a20dfe Mon Sep 17 00:00:00 2001 From: Wolfgang Knopki <wolfgang.knopki@hft-stuttgart.de> Date: Fri, 6 Mar 2020 09:20:09 +0100 Subject: [PATCH] changed structure to reflect only one application on landing page -> needs apache reconfiguration --- routes/routes.js | 44 ++++++++++++------------- views/{ => DE}/mailinglists.pug | 0 views/EN/mailinglists.pug | 57 +++++++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+), 22 deletions(-) rename views/{ => DE}/mailinglists.pug (100%) create mode 100644 views/EN/mailinglists.pug diff --git a/routes/routes.js b/routes/routes.js index 0a69991c..c8f53687 100644 --- a/routes/routes.js +++ b/routes/routes.js @@ -137,13 +137,13 @@ module.exports = function (app, config, passport, i18n) { passport.authenticate(config.passport.strategy, { successRedirect: '/account/', - failureRedirect: '/account/login' + failureRedirect: '/login' }) ); app.get('/logout', function (req, res) { if (req.user == null) { - return res.redirect('/account/'); + return res.redirect('/'); } req.user.nameID = req.user.id; @@ -174,7 +174,7 @@ module.exports = function (app, config, passport, i18n) { } }) } else { - res.redirect('/account/login'); + res.redirect('/login'); } }); @@ -238,7 +238,7 @@ module.exports = function (app, config, passport, i18n) { } ]) } else { - res.redirect('/account/login'); + res.redirect('/login'); } }); @@ -248,7 +248,7 @@ module.exports = function (app, config, passport, i18n) { user: req.user // useful for view engine, useless for HTML }); } else { - res.redirect('/account/login'); + res.redirect('/login'); } }); @@ -274,11 +274,11 @@ module.exports = function (app, config, passport, i18n) { else { req.flash('success', 'Profile updated!'); } - res.redirect('/account/profile'); + res.redirect('lang+/account/profile'); }) } } else { - res.redirect('/account/login'); + res.redirect('/login'); } }); @@ -293,7 +293,7 @@ module.exports = function (app, config, passport, i18n) { // Load hashed passwd from DB dbconn.user.query('SELECT password FROM credential WHERE user_id='+userId, function (err, rows, fields) { if (err) { - res.redirect('/account/500') + res.redirect('/500') throw err } var userPwd = rows[0].password @@ -301,19 +301,19 @@ module.exports = function (app, config, passport, i18n) { // check if the password is correct bcrypt.compare(currPwd, userPwd, function(err, isMatch) { if (err) { - res.redirect('/account/500') + res.redirect('/500') throw err } else if (!isMatch) { //req.flash('error', "Sorry, your password was incorrect. Please double-check your password.") req.flash('error', "Das Passwort ist leider falsch. Bitte überprüfen Sie Ihre Eingabe.") - //res.redirect('/account/security') - res.redirect('/account/security') + //res.redirect('/security') + res.redirect('/security') } else { if ( newPwd != retypePwd ) { req.flash('error', "Passwords do no match. Please make sure you re-type your new password correctly.") - res.redirect('/account/security') + res.redirect(lang+'/account/security') } else { // update password @@ -342,7 +342,7 @@ module.exports = function (app, config, passport, i18n) { } }); } - res.redirect('/account/security') + res.redirect('/security') }) }); }); @@ -354,7 +354,7 @@ module.exports = function (app, config, passport, i18n) { }) } else { - res.redirect('/account/login'); + res.redirect('/login'); } }); @@ -429,8 +429,8 @@ module.exports = function (app, config, passport, i18n) { //req.flash('success', 'If your email is registered, an e-mail has been sent to ' + emailAddress + ' with further instructions.'); req.flash('success', 'Wenn Ihre E-Mail-Adresse registriert ist, wurde eine E-Mail mit dem weiteren Vorgehen an ' + emailAddress + ' versendet.'); } - //res.redirect('/account/forgotPwd'); // deployment - res.redirect('/account/forgotPwd'); // localhost + //res.redirect('/forgotPwd'); // deployment + res.redirect('/forgotPwd'); // localhost }); }); @@ -439,8 +439,8 @@ module.exports = function (app, config, passport, i18n) { if (!user) { //req.flash('error', 'Password reset token is invalid or has expired.'); req.flash('error', 'Der Schlüssel zum zurücksetzen des Passworts ist ungültig oder abgelaufen.'); - //res.redirect('/account/forgotPwd'); // deployment - res.redirect('/account/forgotPwd'); // localhost + //res.redirect('/forgotPwd'); // deployment + res.redirect('/forgotPwd'); // localhost } else { res.render(lang+'/account/reset'); @@ -479,7 +479,7 @@ module.exports = function (app, config, passport, i18n) { } }); // redirect to login page - res.redirect('/account/login') + res.redirect('/login') } }) }); @@ -487,7 +487,7 @@ module.exports = function (app, config, passport, i18n) { } else { req.flash('error', "User not found.") - res.redirect('/account/login') + res.redirect('/login') } }); @@ -533,7 +533,7 @@ module.exports = function (app, config, passport, i18n) { //req.flash('success', 'Your account has been created. Please log in.') req.flash('success', 'Ihr Benutzerkonto wurde angelegt. Bitte melden Sie sich an.') } - res.redirect('/account/registration'); + res.redirect('/registration'); }) }); }); @@ -573,7 +573,7 @@ module.exports = function (app, config, passport, i18n) { project_title: mailinglistOverview[i].project_title }); } - res.render('mailinglists', { + res.render(lang+'mailinglists', { user: req.user, mailinglists: allMailingLists }); diff --git a/views/mailinglists.pug b/views/DE/mailinglists.pug similarity index 100% rename from views/mailinglists.pug rename to views/DE/mailinglists.pug diff --git a/views/EN/mailinglists.pug b/views/EN/mailinglists.pug new file mode 100644 index 00000000..5420eaf2 --- /dev/null +++ b/views/EN/mailinglists.pug @@ -0,0 +1,57 @@ +html(lang="de") + head + title= "Mailinglisten" + meta(charset="UTF-8") + meta(name="viewport", content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no") + link(rel="stylesheet", type="text/css", href="https://transfer.hft-stuttgart.de/css/bootstrap/bootstrap.css") + link(rel="stylesheet", type="text/css", href="https://transfer.hft-stuttgart.de/css/custom/login.css") + link(rel="stylesheet", href="https://use.fontawesome.com/releases/v5.8.2/css/all.css", integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay", crossorigin="anonymous") + style. + .collapse { + display: none; + } + .collapse.in { + display: block; + } + .collapsing { + position: relative; + height: 0; + overflow: hidden; + -webkit-transition-timing-function: ease; + -o-transition-timing-function: ease; + transition-timing-function: ease; + -webkit-transition-duration: .35s; + -o-transition-duration: .35s; + transition-duration: .35s; + -webkit-transition-property: height,visibility; + -o-transition-property: height,visibility; + transition-property: height,visibility; + } + body + <hr /> + div() + h5(align="left") Aktive Mailinglisten + div(class="flex-container" style="align-items:flex-start") + div(class="table") + table(border="0" id="Projektliste") + tr + th Name + th Link + th zugeh. Projekt + for item in mailinglists + if item.projectstatus == '1' + tr + td #{item.name} + td <a href="#{item.src}">#{item.src}</a> + td <a href='projectoverview?#{item.id}'>#{item.project_title}</a> + <hr /> + div() + h5(align="left") Eintragung in Mailingliste + p() Wenn Sie sich in eine Mailingliste eintragen wollen, folgen Sie folgender Anleitung: + // jQuery + script(src="https://code.jquery.com/jquery-3.3.1.min.js") + script(src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js", integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1", crossorigin="anonymous") + // Bootstrap + script(src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous") + // M4_LAB + script(src="https://transfer.hft-stuttgart.de/js/headfoot.js") \ No newline at end of file -- GitLab