aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/controllers/users.js
diff options
context:
space:
mode:
authorDennis Eriksen <dennis.se@gmail.com>2013-05-24 13:00:19 +0200
committerDennis Eriksen <dennis.se@gmail.com>2013-05-24 13:00:19 +0200
commitcb1f1f31340642d28b18a19b7a48ed913ab50a5b (patch)
tree364aeae8dfd5f270f49c6974e7db179bc9936fe3 /controllers/users.js
parentfixes bug introduced in 4b63a89 (diff)
downloadDivid-cb1f1f31340642d28b18a19b7a48ed913ab50a5b.tar.gz
fixed issue #21
Diffstat (limited to 'controllers/users.js')
-rw-r--r--controllers/users.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/controllers/users.js b/controllers/users.js
index b6a9bcf..6d5ecaa 100644
--- a/controllers/users.js
+++ b/controllers/users.js
@@ -188,7 +188,7 @@ exports.postProjectParticipants = function(req, res) {
access.user = newUser._id;
access.creator = req.user._id;
access.project = project._id;
- access.randomToken = newUser.generateRandomToken(15, true);
+ access.randomToken = access.generateRandomToken(15);
access.save(function(err) {
if (err) {
console.log(err.errors);
@@ -212,6 +212,13 @@ exports.postProjectParticipants = function(req, res) {
access.user = user._id;
access.creator = req.user._id;
access.project = project._id;
+ message.text = 'Du ble lagt til projektet "' + project.name + '"';
+ console.log('user.status = '+ user.status);
+ if (Number(user.status) < 3) {
+ console.log('DAFUQ MANN! ER JO INNI IFFEN FFS!');
+ access.randomToken = access.generateRandomToken(15);
+ message.text += '.\nDu kan få direkte tilgang til dette prosjektet her: https://divid.no/login/' + access.randomToken + ' \nDu kan bruke denne linken for å registrere deg, for å få tilgang til flere funksjoner: https://divid.no/invite/' + user.randomToken;
+ }
access.save(function(err) {
if (err) {
console.log(err.errors);
@@ -219,7 +226,6 @@ exports.postProjectParticipants = function(req, res) {
}
console.log('made new access for user ' + user.username);
message.to = user.email;
- message.text = 'Du ble lagt til projektet "' + project.name + '"';
server.send(message, function(err, message) { console.log(err || message);});
});
}