aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDennis Eriksen <dennis.se@gmail.com>2013-05-15 13:40:06 +0200
committerDennis Eriksen <dennis.se@gmail.com>2013-05-15 13:40:06 +0200
commit6fc27dcf4276060aab9646ab052fe538e6af4b00 (patch)
tree488c0365da1080ea8af9192ef94c1908ba723041
parenttweaked the random token generator (diff)
downloadDivid-6fc27dcf4276060aab9646ab052fe538e6af4b00.tar.gz
added route for claimInvite
-rw-r--r--controllers/users.js15
-rw-r--r--routes.js5
2 files changed, 19 insertions, 1 deletions
diff --git a/controllers/users.js b/controllers/users.js
index fe47cac..bd8c2b4 100644
--- a/controllers/users.js
+++ b/controllers/users.js
@@ -170,6 +170,7 @@ exports.postProjectParticipants = function(req, res) {
newUser.email = mailAddress;
newUser.status = 1;
newUser.password = newUser.generateRandomToken(32);
+ newUser.randomToken = newUser.generateRandomToken(10);
newUser.save(function(err) {
if (err) return res.render('projectParticipants', { title: 'Nytt prosjekt - en feil oppstod', loggedin: true });
console.log('made new user ' + newUser._id);
@@ -226,3 +227,17 @@ exports.postProjectParticipants = function(req, res) {
}
+/**
+ * claimInvite
+ * So users can use their inviteEmail
+ */
+
+exports.claimInvite = function(req, res) {
+
+}
+
+
+exports.postClaimInvite = function(req, res) {
+
+}
+
diff --git a/routes.js b/routes.js
index 81d9da1..071d3d0 100644
--- a/routes.js
+++ b/routes.js
@@ -32,7 +32,6 @@ module.exports = function(app, passport, auth) {
app.post('/signup', users.create);
-
app.post('/test', users.signin);
app.get('/auth/facebook', passport.authenticate('facebook', { failureRedirect: '/test' }), users.signin);
@@ -41,6 +40,10 @@ module.exports = function(app, passport, auth) {
app.get('/auth/twitter', passport.authenticate('twitter', { failureRedirect: '/test' }), users.signin);
app.get('/auth/twitter/callback', passport.authenticate('twitter', { failureRedirect: '/test' }), users.authCallback);
+ app.get('/invite/:randomToken', users.claimInvite);
+
+ app.post('/invite/:randomToken', users.postClaimInvite);
+
app.get('/logout', users.logout);