diff --git a/routes/routes.js b/routes/routes.js index 7c0addb38550fdcdbb85a73d273ca9b1704a91a2..c40237e3cd9c6ea08a070df0b290d52c3f072aeb 100644 --- a/routes/routes.js +++ b/routes/routes.js @@ -149,7 +149,7 @@ module.exports = function (app, config, passport) { }); } - return res.redirect(uri); + return res.redirect('/'); }); }); @@ -449,9 +449,27 @@ module.exports = function (app, config, passport) { res.redirect('/account/login') }); - app.get('/logout', function (req, res) { - if (req.user == null) { - return res.redirect('/account/'); + // 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) } // encrypt password bcrypt.genSalt(saltRounds, function(err, salt) { @@ -468,12 +486,16 @@ module.exports = function (app, config, passport) { else { req.flash('success', 'Your account has been created. Please log in.'); } - res.redirect('/account/registration'); + res.redirect('/registration'); }) }); }); }) + + + + app.get('/email/:email', function(req, res) { methods.checkUserEmail(req.params.email, function(err, user){ if (!err) {