Commit f6b48076 authored by Wolfgang Knopki's avatar Wolfgang Knopki
Browse files

merging new features

parents 0b885ec3 e32c0fcc
......@@ -54,15 +54,37 @@ module.exports = function (app, config, passport) {
passport.use(samlStrategy);
// ============================
/*
app.all('/', function(req, res){
req.flash('test', 'it worked');
res.redirect('/test')
});
app.all('/test', function(req, res){
res.send(JSON.stringify(req.flash('test')));
});
*/
app.get('/', function (req, res) {
res.redirect('/account/profile')
});
app.get('/login',
passport.authenticate(config.passport.strategy,
{
successRedirect: '/account/',
failureRedirect: '/account/login'
})
);
// ============= SAML ==============
app.post(config.passport.saml.path,
passport.authenticate(config.passport.strategy,
{
failureRedirect: '/',
failureRedirect: '/account/',
failureFlash: true
}),
function (req, res) {
res.redirect('/');
res.redirect('/account/');
}
);
......@@ -399,7 +421,7 @@ module.exports = function (app, config, passport) {
if (user) {
// encrypt password
bcrypt.genSalt(saltRounds, function(err, salt) {
bcrypt.hash(req.body.inputNewPwd, salt, function(err, hash) {
bcrypt.hash(newPwd, salt, function(err, hash) {
var credentialData = {
password: hash,
user_id: user.user_id
......@@ -427,27 +449,9 @@ module.exports = function (app, config, passport) {
res.redirect('/account/login')
});
// todo: user registration with captcha
app.get('/registration', function(req, res) {
res.render('registration')
})
app.post('/registration', function(req, res) {
// TODO:
// create gitlab account?
// send email to activate profile?
// user data
var curDate = new Date()
var userData = {
title: req.body.inputTitle,
firstname: req.body.inputFirstname,
lastname: req.body.inputLastname,
email: req.body.inputEmail,
organisation: req.body.inputOrganisation,
industry: req.body.inputIndustry,
speciality: req.body.inputSpeciality,
createdDate: curDate.toISOString().slice(0,10)
app.get('/logout', function (req, res) {
if (req.user == null) {
return res.redirect('/account/');
}
// encrypt password
bcrypt.genSalt(saltRounds, function(err, salt) {
......
......@@ -87,5 +87,4 @@ html(lang="en")
// 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="/account/js/account.js")
script(src="/js/headfoot.js")
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