Commit 218128d9 authored by Wolfgang Knopki's avatar Wolfgang Knopki
Browse files

merged devel

parents b4d292f2 31690d1b
......@@ -58,12 +58,24 @@ app.use(function(req, res, next) {
next();
});
//require('./routes/routes')(app, config, passport, i18n);
require('./routes/routes-account')(app, config, passport, i18n);
require('./routes/routes-project')(app, config, passport);
//require('./routes/dbconn')(app, config);
require('./routes/api')(app, config, passport);
// Handle 404
app.use(function (req, res, next) {
//res.status(404).send('404: Page not Found', 404)
res.status(404).render('./DE/404')
})
// Handle 500 - any server error
app.use(function (err, req, res, next) {
console.error(err.stack)
res.status(500).render('./DE/500', {
error: err
})
})
app.listen(app.get('port'), function () {
console.log('Express server listening on port ' + app.get('port'));
});
\ No newline at end of file
......@@ -165,9 +165,10 @@ var methods = {
},
addProjectOverview: function(data, callback) {
dbconn.project.query('INSERT INTO project_overview SET ?', data, function (err, results, fields){
if (err) throw err;
//console.log(results.insertId)
callback(results.insertId, err);
if (err) {
console.error(err);
}
callback(results, err);
})
}
};
......
......@@ -9,7 +9,7 @@ const salt = 64; // salt length
// forgot pwd
const async = require('async')
const crypto = require('crypto')
const nodemailer = require('./mailer')
const mailer = require('./mailer')
module.exports = function (app, config, passport, i18n) {
......@@ -75,25 +75,25 @@ module.exports = function (app, config, passport, i18n) {
}
);
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"+
"Schellingstr. 24\n"+
"70174 Stuttgart\n"+
"m4lab@hft-stuttgart.de\n"+
"https://transfer.hft-stuttgart.de"
var updatePasswordMailContent = "Lieber Nutzer,\n\n"+"Ihr Passwort wurde erfolgreich geändert.\n\n"+mailSignature
// ================ test i18n ==================
i18n.setLocale('de');
app.get('/de', function(req, res) {
var greeting = i18n.__('Hello World')
res.send(greeting)
});
var lang = 'DE'
// ======== APP ROUTES - ACCOUNT ====================
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"+
"Schellingstr. 24\n"+
"70174 Stuttgart\n"+
"m4lab@hft-stuttgart.de\n"+
"https://transfer.hft-stuttgart.de"
var updatePasswordMailContent = "Lieber Nutzer,\n\n"+"Ihr Passwort wurde erfolgreich geändert.\n\n"+mailSignature
app.get('/', function (req, res) {
if (req.isAuthenticated()) {
methods.getUserByEmail(req.user.email, function(data, err){
......@@ -108,10 +108,6 @@ module.exports = function (app, config, passport, i18n) {
}
});
app.get('/error', function (req, res) {
res.render(lang+'/error')
});
app.get('/login',
passport.authenticate(config.passport.strategy,
{
......@@ -251,7 +247,8 @@ module.exports = function (app, config, passport, i18n) {
req.flash('error', "Failed");
}
else {
req.flash('success', 'Profile updated!');
//req.flash('success', 'Profile updated!');
req.flash('success', 'Ihr Benutzerprofil wurde aktualisiert!');
}
res.redirect('/account/profile');
})
......@@ -272,7 +269,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
......@@ -280,7 +277,7 @@ 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) {
......@@ -311,11 +308,11 @@ module.exports = function (app, config, passport, i18n) {
else {
//req.flash('success', "Pasword updated!")
req.flash('success', "Passwort aktualisiert!")
mailOptions.to = req.user.email
mailer.options.to = req.user.email
//mailOptions.subject = "Your M4_LAB Password has been updated."
mailOptions.subject = updatePasswordMailSubject
mailOptions.text = updatePasswordMailContent
smtpTransport.sendMail(mailOptions, function(err) {
mailer.options.subject = updatePasswordMailSubject
mailer.options.text = updatePasswordMailContent
mailer.transport.sendMail(mailer.options, function(err) {
if (err) {
console.log(err)
}
......@@ -386,10 +383,10 @@ module.exports = function (app, config, passport, i18n) {
});
// send email
mailOptions.to = emailAddress;
mailOptions.subject = emailSubject;
mailOptions.text = emailContent;
smtpTransport.sendMail(mailOptions, function(err) {
mailer.options.to = emailAddress;
mailer.options.subject = emailSubject;
mailer.options.text = emailContent;
mailer.transport.sendMail(mailer.options, function(err) {
done(err, 'done');
});
}
......@@ -449,10 +446,10 @@ module.exports = function (app, config, passport, i18n) {
//req.flash('success', "Your pasword has been updated.")
req.flash('success', "Passwort aktualisiert!")
// send notifiaction email
mailOptions.to = user.email
mailOptions.subject = updatePasswordMailSubject
mailOptions.text = updatePasswordMailContent
smtpTransport.sendMail(mailOptions, function(err) {
mailer.options.to = user.email
mailer.options.subject = updatePasswordMailSubject
mailer.options.text = updatePasswordMailContent
mailer.transport.sendMail(mailer.options, function(err) {
if (err) {
console.log(err)
}
......
......@@ -39,7 +39,7 @@ module.exports = function (app) {
])
});
app.get('/project', function (req, res) {
app.get('/project_', function (req, res) {
async.waterfall([
// get all projects from projectdb
function(done) {
......@@ -92,6 +92,10 @@ module.exports = function (app) {
])
})
app.get('/project', function (req, res) {
res.render(lang+'/project/project-simplified');
})
app.get('/addprojectoverview', function (req, res) {
if (req.isAuthenticated()) {
res.render(lang+'/project/addProjectOverview')
......@@ -195,9 +199,14 @@ module.exports = function (app) {
},
// add project overview
function(done) {
methods.addProjectOverview(projectOverviewData, function(projectOverviewId, err){
if (!err) {
done(err, projectOverviewId)
methods.addProjectOverview(projectOverviewData, function(data, err){
if (err) {
res.status(500).render(lang+'/500', {
error: err
})
}
else {
done(err, data.insertId)
}
})
},
......
extends error
block content
h2 Cannot find #{url}
\ No newline at end of file
doctype html
html(lang="de")
head
title= "404 - Page not found"
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")
style.
.container {
height: 400px;
position: relative;
}
.center {
margin: 0;
position: absolute;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
body
div(class="container")
div(class="center", align="center")
a(href="https://m4lab.hft-stuttgart.de")
img(src="https://transfer.hft-stuttgart.de/images/demo/m4lab_logo.jpg", class="img-responsive center-block", width="185", height="192")
br
br
p(class="h5") 404. The requested URL was not found.
// Bootstrap
script(src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous")
\ No newline at end of file
extends error
block content
h1 Error: #{error.message}
if settings['verbose errors']
pre= error.stack
else
p An error ocurred!
\ No newline at end of file
doctype html
html(lang="de")
head
title= "500 - Internal Server Error"
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")
style.
.container {
height: 400px;
position: relative;
}
.center {
margin: 0;
position: absolute;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
body
div(class="container")
div(class="center", align="center")
a(href="https://m4lab.hft-stuttgart.de")
img(src="https://transfer.hft-stuttgart.de/images/demo/m4lab_logo.jpg", class="img-responsive center-block", width="185", height="192")
br
br
p(class="h5") 500. Unexpected Error :(
p #{ error }
// Bootstrap
script(src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous")
\ No newline at end of file
......@@ -68,7 +68,6 @@ html(lang="de")
option(value="Prof.") Prof.
option(value="Dr.") Dr.
option(value="Dipl.-Ing.") Dipl.-Ing.
option(value="etc.") etc.
script.
var titleOptions = document.getElementById('inputTitle').options;
for (i=0; i < titleOptions.length; i++) {
......
......@@ -68,7 +68,6 @@ html(lang="de")
option(value="Prof.") Prof.
option(value="Dr.") Dr.
option(value="Dipl.-Ing.") Dipl.-Ing.
option(value="etc.") etc.
div(class='form-group col-md-4')
input#inputFirstname(name="inputFirstname", type="text", class="form-control", placeholder="Vorname*", maxlength="45" required)
div(class='form-group col-md-4')
......
......@@ -49,7 +49,7 @@ html(lang="de")
for error, i in errors
div.alert.alert-danger.alert-dismissible.fade.show #{ error }
a(class="close", href="#", data-dismiss="alert", aria-label="close") &times;
form(class="needs-validation", method="post", action="/account/changePwd" novalidate)
form(class="needs-validation", method="post", action="/changePwd" novalidate)
div(class="form-group row")
label(for="currPwd") Aktuelles Passwort
input(id="inputCurrPwd", name="inputCurrPwd", type="password", class="form-control" required)
......
html
head
title Error
body
h1 An error occurred!
block content
\ No newline at end of file
include project.html
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<title>Project List</title>
<meta charset="UTF-8">
<meta name="viewport", content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="stylesheet" href="https://transfer.hft-stuttgart.de/css/bootstrap/bootstrap.css" type="text/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;}
</style>
</head>
<body>
<div class="container">
<hr />
<!-- text: Zweck dieser Seite / purpose of this page -->
<i class="fas fa-info-circle"></i> Diese Seite bietet den Einstieg zu den unterschiedlichen Projekten, die in unserem Portal für die Öffentlichkeit bereitgestellt werden.
Für diesen Zweck steht zur Zeit ein Dienst bereit: eine von der HFT selbst verwaltete Gitlab-Instanz.
Alle der in diesem Gitlab erfassten Projektinhalte unterliegen einer Open Source bzw. Open Data Lizenz.
<p>Hinweis: Die Nutzeroberfläche von GitLab ist in Englisch.</p>
<!-- link: Gitlab Projekte / Gitlab project list -->
<h2> Direkteinstieg </h2>
<a href="https://transfer.hft-stuttgart.de/gitlab/explore/projects"> <i class="fas fa-chevron-right">Gitlab Projects</i></a>
<!-- text: Hilfestellung zu Gitlab / short help about Gitlab -->
<hr />
<h2> Hilfestellung zu GitLab </h2>
<h3> <i class="fas fa-question-circle"></i> Möchten Sie die Projektinhalte ansehen oder herunterladen? </h3>
<p>
Dann klicken Sie auf diesen <a href="https://transfer.hft-stuttgart.de/gitlab/explore/projects"> <i class="fas fa-chevron-right">Link zu den Gitlab-Projekten</i></a> um die Liste aller im Gitlab erfassten Projekte zu sehen.
Vor dort können Sie dann auf die einzelnen Projekte zugreifen.
Ein Anmelden am Portal ist dazu nicht nötig.
</p>
<h3> <i class="fas fa-question-circle"></i> Möchten Sie zu einem Projekt beitragen? </h3>
<p>
Wenn Sie dem Projekteigentümer eine Rückmeldung bzw. einen Fehler melden wollen, navigieren Sie im Gitlab zunächst zum entsprechenden Projekt.
Anschließend können Sie dann dort die Möglichkeit nutzen, ein neues "Issues" einzureichen.
Ein Anmelden am Portal ist dazu nicht nötig.
</p>
<p>
Wenn Sie darüberhinaus beitragen wollen, befolgen Sie bitte folgende Schritte:
</p>
<ol>
<li>
Melden Sie sich bitte im Portal an. <br>
Sofern Sie noch nicht als Nutzer im Portal eingetragen sind, wird das System Sie durch die Registrierung leiten. <br>
Zur Anmeldung bzw. Registrierung gelangen Sie entweder über das Menü am oberen Seitenrand oder durch Klicken auf diesen <a href="https://m4lab.hft-stuttgart.de/account/"> <i class="fas fa-chevron-right">Link zum Benutzerkonto</i></a>.
</li>
<li>
Folgen Sie dem <a href="https://transfer.hft-stuttgart.de/gitlab/explore/projects"> <i class="fas fa-chevron-right">Link zu den Gitlab-Projekten</i></a>, um zum Gitlab zu gelangen.
</li>
<li>
Fragen Sie beim Projekteigentümer um Zugang, indem Sie im Gitlab bei der entsprechende Projektseite auf den Link <em>Request Access</em> klicken. Solbald dieser ihre Anfrage bestätigt hat, können Sie loslegen.
</li>
</ol>
<h3> <i class="fas fa-question-circle"></i> Möchten Sie selbst ein Projekt anlegen, um es der Öffentlichkeit bereitzustellen? </h3>
</p>
Vorraussetzung dazu ist, dass Sie aktives oder ehemaliges Mitglied der Hochschule für Technik sind, d.h. eine (noch) gültige HFT-Emailadresse haben.
Dann befolgen Sie bitte folgende Schritte:
</p>
<ol>
<li>
Melden Sie sich bitte im Portal an. <br>
Sofern Sie noch nicht als Nutzer im Portal eingetragen sind, wird das System Sie durch die Registrierung leiten. <br>
Zur Anmeldung bzw. Registrierung gelangen Sie entweder über das Menü am oberen Seitenrand oder durch Klicken auf diesen <a href="https://m4lab.hft-stuttgart.de/account/"> <i class="fas fa-chevron-right">Link zum Benutzerkonto</i></a>.
</li>
<li>
Folgen Sie dem <a href="https://transfer.hft-stuttgart.de/gitlab/explore/projects"> <i class="fas fa-chevron-right">Link zu den Gitlab-Projekten</i></a>, um zum Gitlab zu gelangen.
</li>
<li>
Erstellen Sie dann in Gitlab ein neues Projekt durch Klicken auf den grünen <em>New Project</em>-Knopf und anschließendem Befolgen der Eingabemaske von Gitlab. <br>
Weitere Hilfestellung zum Anlegen von Projekten in Gitlab finden Sie in der <a href="https://docs.gitlab.com/ee/gitlab-basics/create-project.html"> <i class="fas fa-chevron-right">Gitlab-Dokumentation</i></a>.
</li>
</ol>
<!-- / content body -->
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<!-- M4_LAB -->
<script src="https://transfer.hft-stuttgart.de/js/headfoot.js"></script>
</body>
</html>
\ No newline at end of file
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