Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

authenticat

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

authenticat - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

5

lib/error_handler.js

@@ -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) {

2

lib/router.js

@@ -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 @@ });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc