diff --git a/.gitignore b/.gitignore index 49f8907c56774bbe5a165802ffbe844af6ae1241..287d7f2735eaad5f58778131a4b1be47fac703f0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /node_modules sp-account-metadata.xml +.idea diff --git a/config/config.js b/config/config.js index 077f965e1da4f7d61c6c67d220ad97a64d49da3c..5c0c2cfc56bd3d8e619413a1928de3eac06e9c9f 100644 --- a/config/config.js +++ b/config/config.js @@ -8,12 +8,10 @@ module.exports = { strategy: 'saml', saml: { path: process.env.SAML_PATH || '/saml/SSO', - //entryPoint: process.env.SAML_ENTRY_POINT || 'https://transfer.hft-stuttgart.de/idp/saml2/idp/SSOService.php', entryPoint: process.env.SAML_ENTRY_POINT || 'https://m4lab.hft-stuttgart.de/idp/saml2/idp/SSOService.php', - issuer: 'sp-account.m4lab.hft-stuttgart.de', //local metadata - //issuer: 'sp-account-test.m4lab.hft-stuttgart.de', //testing metadata + //issuer: 'sp-account.m4lab.hft-stuttgart.de', //local metadata + issuer: 'sp-account-testing.m4lab.hft-stuttgart.de', //testing metadata //issuer: 'sp-account-prod.m4lab.hft-stuttgart.de', //production metadata - //logoutUrl: 'https://transfer.hft-stuttgart.de/idp/saml2/idp/SingleLogoutService.php' logoutUrl: 'https://m4lab.hft-stuttgart.de/idp/saml2/idp/SingleLogoutService.php' } }, @@ -23,6 +21,7 @@ module.exports = { password: 'Stuttgart2019', // DB password port: 3306, // MySQL port dbUser: 'userdb', // User DB + host_project: 'm4lab.hft-stuttgart.de', // DB host project db dbProject: 'projectDB' // Project DB }, mailer: { diff --git a/routes/dbconn.js b/routes/dbconn.js index 0c3c67c4daf536439d2ab14ba8e09f711ef72c92..834eb1aaa465674e73190ffc8d8809b2d28c3274 100644 --- a/routes/dbconn.js +++ b/routes/dbconn.js @@ -51,7 +51,7 @@ var dbconn = function dbconn(query, values, next) { // ==== PROJECT DB CONNECTION ==== var projectConnection = mysql.createConnection({ - host: config.database.host, + host: config.database.host_project, user: config.database.user, password: config.database.password, port: config.database.port, diff --git a/routes/methods.js b/routes/methods.js index 3ffec7199aca4bb05665baffb054f0895c88f116..d377d61cd79360dd27609a2ab7426607901a9fc6 100644 --- a/routes/methods.js +++ b/routes/methods.js @@ -139,6 +139,12 @@ var methods = { callback(rows[0], err); }) }, + getAllMailinglists: function(callback) { + dbconn.project.query('CALL getAllLists', function (err, rows, fields){ + if (err) throw err; + callback(rows[0], err); + }) + }, addProjectOverview: function(data, callback) { dbconn.project.query('INSERT INTO project_overview SET ?', data, function (err, rows, fields){ if (err) throw err; diff --git a/routes/routes-account.js b/routes/routes-account.js index 4743725332301e00fcafbdbb69e140ee94828102..0feeb90537cb97fc2c4ffab72f22eaebca2415fb 100644 --- a/routes/routes-account.js +++ b/routes/routes-account.js @@ -62,7 +62,7 @@ module.exports = function (app, config, passport, i18n) { failureFlash: true }), function (req, res) { - res.redirect('/'); + res.redirect('/account/'); } ); @@ -104,7 +104,7 @@ module.exports = function (app, config, passport, i18n) { } }) } else { - res.redirect('/login'); // localhost + res.redirect('/account/login'); // localhost } }); @@ -122,7 +122,7 @@ module.exports = function (app, config, passport, i18n) { app.get('/logout', function (req, res) { if (req.user == null) { - return res.redirect('https://m4lab.hft-stuttgart.de'); + return res.redirect('/account/'); } req.user.nameID = req.user.id; @@ -153,7 +153,7 @@ module.exports = function (app, config, passport, i18n) { } }) } else { - res.redirect('/login'); + res.redirect('/account/login'); } }); @@ -217,7 +217,7 @@ module.exports = function (app, config, passport, i18n) { } ]) } else { - res.redirect('/login'); + res.redirect('/account/login'); } }); @@ -227,7 +227,7 @@ module.exports = function (app, config, passport, i18n) { user: req.user // useful for view engine, useless for HTML }); } else { - res.redirect('/login'); + res.redirect('/account/login'); } }); @@ -253,11 +253,11 @@ module.exports = function (app, config, passport, i18n) { else { req.flash('success', 'Profile updated!'); } - res.redirect('/profile'); + res.redirect('lang+/account/profile'); }) } } else { - res.redirect('/login'); + res.redirect('/account/login'); } }); @@ -272,7 +272,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('/500') + res.redirect('/account/500') throw err } var userPwd = rows[0].password @@ -280,21 +280,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('/500') + res.redirect('/account/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('/security') + res.redirect('/account/security') } else { if ( newPwd != retypePwd ) { - //req.flash('error', "Passwords do no match. Please make sure you re-type your new password correctly.") req.flash('error', "Passwords do no match. Please make sure you re-type your new password correctly.") - //res.redirect('/account/security') - res.redirect('/security') + res.redirect(lang+'/account/security') } else { // update password @@ -323,8 +321,7 @@ module.exports = function (app, config, passport, i18n) { } }); } - //res.redirect('/account/security') - res.redirect('/security') + res.redirect('/account/security') }) }); }); @@ -336,7 +333,7 @@ module.exports = function (app, config, passport, i18n) { }) } else { - res.redirect('/login'); + res.redirect('/account/login'); } }); @@ -412,7 +409,7 @@ module.exports = function (app, config, passport, i18n) { 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('/forgotPwd'); // localhost + res.redirect('/account/forgotPwd'); // localhost }); }); @@ -422,7 +419,7 @@ module.exports = function (app, config, passport, i18n) { //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('/forgotPwd'); // localhost + res.redirect('/account/forgotPwd'); // localhost } else { res.render(lang+'/account/reset'); @@ -461,7 +458,7 @@ module.exports = function (app, config, passport, i18n) { } }); // redirect to login page - res.redirect('/login') + res.redirect('/account/login') } }) }); @@ -469,7 +466,7 @@ module.exports = function (app, config, passport, i18n) { } else { req.flash('error', "User not found.") - res.redirect('/login') + res.redirect('/account/login') } }); @@ -515,8 +512,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'); // deployment - res.redirect('/registration'); // localhost + res.redirect('/account/registration'); }) }); }); diff --git a/views/DE/account/home.pug b/views/DE/account/home.pug index 58b2427c3063a835f93a8be4ad87515929121978..f08d9ee7937aee1b391b8cfd40bbb004173df5d6 100644 --- a/views/DE/account/home.pug +++ b/views/DE/account/home.pug @@ -34,9 +34,9 @@ html(lang="de") h5 span #{user.firstname} #{user.lastname} div(class="nav flex-column nav-pills", id="v-pills-tab", role="tablist", aria-orientation="vertical") - a(class="nav-link" href="/profile" aria-selected="true") Benutzerprofil - a(class="nav-link" href="/security" aria-selected="false") Sicherheitseinstellungen - a(class="nav-link" href="/services" aria-selected="false") Projekte und Dienste + a(class="nav-link" href="/account/profile" aria-selected="true") Benutzerprofil + a(class="nav-link" href="/account/security" aria-selected="false") Sicherheitseinstellungen + a(class="nav-link" href="/account/services" aria-selected="false") Projekte und Dienste div(class="col-sm-9") p content goes here diff --git a/views/DE/account/profile.pug b/views/DE/account/profile.pug index 32a2aff116c487f82b6c6b2bd6d50637c5cedd2f..e4d7e2609827baefef68378e4b42cdd06b84d8f9 100644 --- a/views/DE/account/profile.pug +++ b/views/DE/account/profile.pug @@ -35,8 +35,8 @@ html(lang="de") span #{user.firstname} #{user.lastname} div(class="nav flex-column nav-pills", id="v-pills-tab", role="tablist", aria-orientation="vertical") a(class="nav-link" href="#" aria-selected="true") Benutzerprofil - a(class="nav-link" href="/security" aria-selected="false") Sicherheitseinstellungen - a(class="nav-link" href="/services" aria-selected="false") Projekte und Dienste + a(class="nav-link" href="/account/security" aria-selected="false") Sicherheitseinstellungen + a(class="nav-link" href="/account/services" aria-selected="false") Projekte und Dienste div(class="col-sm-9") if successes for success in successes diff --git a/views/DE/account/security.pug b/views/DE/account/security.pug index 560d32bc554c360f2cc32783f4aeda33b546d0fe..6db09112136b41451ea1fd381e768d36282626f3 100644 --- a/views/DE/account/security.pug +++ b/views/DE/account/security.pug @@ -37,9 +37,9 @@ html(lang="de") h5 span #{user.firstName} #{user.lastName} div(class="nav flex-column nav-pills", id="v-pills-tab", role="tablist", aria-orientation="vertical") - a(class="nav-link" href="/profile" aria-selected="true") Benutzerprofil + a(class="nav-link" href="/account/profile" aria-selected="true") Benutzerprofil a(class="nav-link" href="#" aria-selected="false") Sicherheitseinstellungen - a(class="nav-link" href="/services" aria-selected="false") Projekte und Dienste + a(class="nav-link" href="/account/services" aria-selected="false") Projekte und Dienste div(class="col-sm-9") if successes for success in successes diff --git a/views/DE/account/services.pug b/views/DE/account/services.pug index 55f5a1b66458fb86a0bd9a6e2069da57a4d370ea..6ab101f30c8da9f6c5b53d526af7c4dd8178936b 100644 --- a/views/DE/account/services.pug +++ b/views/DE/account/services.pug @@ -34,8 +34,8 @@ html(lang="de") h5 span #{user.firstName} #{user.lastName} div(class="nav flex-column nav-pills", id="v-pills-tab", role="tablist", aria-orientation="vertical") - a(class="nav-link" href="/profile" aria-selected="true") Benutzerprofil - a(class="nav-link" href="/security" aria-selected="false") Sicherheitseinstellungen + a(class="nav-link" href="/account/profile" aria-selected="true") Benutzerprofil + a(class="nav-link" href="/account/security" aria-selected="false") Sicherheitseinstellungen a(class="nav-link" href="#" aria-selected="false") Projekte und Dienste div(class="col-sm-9") if successes diff --git a/views/DE/mailinglists.pug b/views/DE/mailinglists.pug new file mode 100644 index 0000000000000000000000000000000000000000..677d0f32d9ce58ecb0168f48ea42a1eab047dac9 --- /dev/null +++ b/views/DE/mailinglists.pug @@ -0,0 +1,61 @@ +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", 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="listtable" class="table table-striped") + thead + tr + th Name + th Link + th zugeh. Projekt + tbody + for item in mailinglists + if item.projectstatus == '1' + tr + td #{item.name} + td <a href="#{item.src}">#{item.src}</a> + td <a href='projectoverview?projectID=#{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") + // Header + if isUserAuthenticated + script(src="/js/headfootLogout.js") + else + script(src="https://transfer.hft-stuttgart.de/js/headfoot.js") \ No newline at end of file diff --git a/views/EN/mailinglists.pug b/views/EN/mailinglists.pug new file mode 100644 index 0000000000000000000000000000000000000000..677d0f32d9ce58ecb0168f48ea42a1eab047dac9 --- /dev/null +++ b/views/EN/mailinglists.pug @@ -0,0 +1,61 @@ +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", 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="listtable" class="table table-striped") + thead + tr + th Name + th Link + th zugeh. Projekt + tbody + for item in mailinglists + if item.projectstatus == '1' + tr + td #{item.name} + td <a href="#{item.src}">#{item.src}</a> + td <a href='projectoverview?projectID=#{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") + // Header + if isUserAuthenticated + script(src="/js/headfootLogout.js") + else + script(src="https://transfer.hft-stuttgart.de/js/headfoot.js") \ No newline at end of file