authen-express
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -14,5 +14,11 @@ "use strict"; | ||
var user = req.body; | ||
if (!user.username || user.username.length === 0 || !user.password || user.password.length === 0) { | ||
res.status(401).end('username and password cannot be empty'); | ||
if (!user.username || user.username.length === 0) { | ||
return res.status(401).end('username cannot be empty'); | ||
} | ||
if (!user.password || user.password.length === 0) { | ||
return res.status(401).end('password cannot be empty'); | ||
} | ||
if (user.step && user.step > 1 && (!user.passcode || user.passcode.length === 0)) { | ||
return res.status(401).end('passcode cannot be empty'); | ||
} | ||
if (this.decrypt) { | ||
@@ -19,0 +25,0 @@ var p = this.decrypt(user.password); |
{ | ||
"name": "authen-express", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "authen-express", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -57,5 +57,11 @@ import { Request, Response } from 'express'; | ||
const user: T = req.body; | ||
if (!user.username || user.username.length === 0 || !user.password || user.password.length === 0) { | ||
res.status(401).end('username and password cannot be empty'); | ||
if (!user.username || user.username.length === 0) { | ||
return res.status(401).end('username cannot be empty'); | ||
} | ||
if (!user.password || user.password.length === 0) { | ||
return res.status(401).end('password cannot be empty'); | ||
} | ||
if (user.step && user.step > 1 && (!user.passcode || user.passcode.length === 0)) { | ||
return res.status(401).end('passcode cannot be empty'); | ||
} | ||
if (this.decrypt) { | ||
@@ -62,0 +68,0 @@ const p = this.decrypt(user.password); |
7488
221