authenticat
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -0,1 +1,2 @@ | ||
var errors = {}; | ||
@@ -13,6 +14,6 @@ | ||
errors['username exists'] = function(res) { | ||
res.status(500).json({msg: 'username already exists in database'}); | ||
res.status(500).json({msg: 'username already exists in database', nameTaken: true}); | ||
}; | ||
errors['not authenticated'] = function(res) { | ||
res.status(401).json({msg: 'username or password is incorrect'}); | ||
res.status(401).json({msg: 'username or password is incorrect', wrongPassOrUser: true }); | ||
}; | ||
@@ -19,0 +20,0 @@ errors['already has role'] = function(res) { |
@@ -9,3 +9,2 @@ var urlrouter = require('urlrouter'); | ||
module.exports = function(users) { | ||
@@ -20,3 +19,2 @@ var router = urlrouter(function(app) { | ||
if (createdUser === null) { | ||
//res.json({msg: 'user name already exists'}); | ||
callback('username exists'); | ||
@@ -23,0 +21,0 @@ } else { |
{ | ||
"name": "authenticat", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "a mean stack token based authentication system", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -19,3 +19,3 @@ Authenticat! | ||
var mongoose = require('mongoose'); | ||
var connection = mongoose.conncect('mongodb://localhost/whatever'); | ||
var connection = mongoose.createConnection('mongodb://localhost/whatever'); | ||
var Authenticat = require('authenticat'); | ||
@@ -49,4 +49,4 @@ var authenticat = new Authenticat(connection); | ||
**If the user name is taken, the response object will contain a value set to true that can be used on the client side to notify the user that the name has been taken.** ```res.data.nameTaken: true``` | ||
## /signin | ||
@@ -57,2 +57,4 @@ Method: **GET** | ||
**If the user name/password combination is incorrect (i.e. wrong password for the given username), the response object will contain a value set to true that can be used on the client side to notify the username/password combination is incorrect.** ```res.data.wrongPassOrUser: true``` | ||
Example (using superagent-cli and the server above): | ||
@@ -59,0 +61,0 @@ ``` |
@@ -60,5 +60,7 @@ var chai = require('chai'); | ||
expect(res.body.msg).to.eql('username already exists in database'); | ||
expect(res.body.nameTaken).to.eql(true); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
@@ -87,2 +89,3 @@ describe('the signin route', function() { | ||
expect(res.body.msg).to.eql('username or password is incorrect'); | ||
expect(res.body.wrongPassOrUser).to.eql(true); | ||
done(); | ||
@@ -89,0 +92,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42438
1030
153