aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--routes/transactions.js4
-rw-r--r--routes/users.js2
-rw-r--r--src/routes/transactions.coffee4
-rw-r--r--src/routes/users.coffee2
4 files changed, 10 insertions, 2 deletions
diff --git a/routes/transactions.js b/routes/transactions.js
index 28fd2418..759ec14a 100644
--- a/routes/transactions.js
+++ b/routes/transactions.js
@@ -25,6 +25,10 @@
};
return db.lrange("" + user + ":transactions", 0, -1, function(err, transactions) {
var cb, i, txid;
+ if (err || !transactions.length) {
+ res.write(JSON.stringify(r));
+ return res.end();
+ }
txid = function() {
var x;
x = transactions[i++];
diff --git a/routes/users.js b/routes/users.js
index 37ce9774..46a8f8f8 100644
--- a/routes/users.js
+++ b/routes/users.js
@@ -121,7 +121,7 @@
if (host === 'localhost') {
host += ':3000';
}
- url = "" + req.protocol + "://" + req.hostname + ":3000/verify/" + token;
+ url = "" + req.protocol + "://" + host + "/verify/" + token;
return res.render('users/welcome', {
user: req.params.user,
layout: 'mail',
diff --git a/src/routes/transactions.coffee b/src/routes/transactions.coffee
index 4578a7d8..25ccbbc9 100644
--- a/src/routes/transactions.coffee
+++ b/src/routes/transactions.coffee
@@ -15,6 +15,10 @@ module.exports =
r = 'transactions': []
db.lrange("#{user}:transactions", 0, -1, (err, transactions) ->
+ if err or not transactions.length
+ res.write(JSON.stringify(r))
+ return res.end()
+
txid = ->
x = transactions[i++]
return x if x.match(/[a-z]/i)
diff --git a/src/routes/users.coffee b/src/routes/users.coffee
index 307f7ab6..838ef631 100644
--- a/src/routes/users.coffee
+++ b/src/routes/users.coffee
@@ -88,7 +88,7 @@ module.exports = (sessions) ->
db.set("token:#{token}", req.body.username)
host = req.hostname
host += ':3000' if host is 'localhost'
- url = "#{req.protocol}://#{req.hostname}:3000/verify/#{token}"
+ url = "#{req.protocol}://#{host}/verify/#{token}"
res.render('users/welcome',
user: req.params.user,