]> git.example.dev Git - binbsis50.git/commitdiff
fixed deprecation warnings
authorLuigi Pinca <luigipinca@gmail.com>
Sat, 26 Jul 2014 13:13:06 +0000 (15:13 +0200)
committerLuigi Pinca <luigipinca@gmail.com>
Sat, 26 Jul 2014 13:13:06 +0000 (15:13 +0200)
routes/site.js
routes/user.js

index 90eee840c5c4203d2490b9c80bd205b0072bfe32..0b5e72d2ec03efadf0a71999d7cbc5b90e8a90a1 100644 (file)
@@ -6,6 +6,7 @@ var async = require('async')
   , Captcha = require('../lib/captcha')
   , config = require('../config')
   , db = require('../lib/redis-clients').songs
+  , http = require('http')
   , randInt = require('../lib/prng').randInt
   , randomSlogan = require('../lib/utils').randomSlogan
   , rooms = require('../lib/rooms').rooms;
@@ -101,7 +102,7 @@ exports.room = function(req, res) {
       slogan: randomSlogan()
     });
   }
-  res.send(404);
+  res.status(404).send(http.STATUS_CODES[404]);
 };
 
 exports.signup = function(req, res) {
index 90e5b7a4f6241a4de3318df41ae575a1b237bfca..476d5c726dc3897b4b311a1c978cafb61df583f1 100644 (file)
@@ -4,6 +4,7 @@
 
 var crypto = require('crypto')
   , db = require('../lib/redis-clients').users
+  , http = require('http')
   , mailer = require('../lib/email/mailer')
   , rooms = require('../config').rooms
   , User = require('../lib/user')
@@ -46,7 +47,7 @@ exports.sliceLeaderboard = function(req, res, next) {
   var begin = parseInt(req.query.begin, 10)
     , by = req.query.by;
   if (isNaN(begin) || begin > 180 || (by !== 'points' && by !== 'times')) {
-    return res.send(400);
+    return res.status(400).send(http.STATUS_CODES[400]);
   }
   var end = begin + 29;
   if (by === 'points') {
@@ -73,7 +74,7 @@ exports.sliceLeaderboard = function(req, res, next) {
 exports.validateChangePasswd = function(req, res, next) {
   if (!req.session.user || req.body.oldpassword === undefined ||
     req.body.newpassword === undefined) {
-    return res.send(400);
+    return res.status(400).send(http.STATUS_CODES[400]);
   }
 
   var errors = {};
@@ -145,7 +146,7 @@ exports.changePasswd = function(req, res, next) {
 
 exports.validateLogin = function(req, res, next) {
   if (req.body.username === undefined || req.body.password === undefined) {
-    return res.send(400);
+    return res.status(400).send(http.STATUS_CODES[400]);
   }
 
   var errors = {};
@@ -223,7 +224,7 @@ exports.logout = function(req, res) {
 exports.validateSignUp = function(req, res, next) {
   if (req.body.username === undefined || req.body.email === undefined ||
     req.body.password === undefined || req.body.captcha === undefined) {
-    return res.send(400);
+    return res.status(400).send(http.STATUS_CODES[400]);
   }
 
   var errors = {};
@@ -329,7 +330,7 @@ exports.createAccount = function(req, res, next) {
 
 exports.validateRecoverPasswd = function(req, res, next) {
   if (req.body.email === undefined || req.body.captcha === undefined) {
-    return res.send(400);
+    return res.status(400).send(http.STATUS_CODES[400]);
   }
 
   var errors = {};
@@ -391,7 +392,7 @@ exports.sendEmail = function(req, res, next) {
 
 exports.resetPasswd = function(req, res, next) {
   if (req.body.password === undefined) {
-    return res.send(400);
+    return res.status(400).send(http.STATUS_CODES[400]);
   }
 
   var errors = {};
@@ -474,6 +475,6 @@ exports.profile = function(req, res, next) {
       });
       return;
     }
-    res.send(404);
+    res.status(404).send(http.STATUS_CODES[404]);
   });
 };