auth-redirect
Advanced tools
Comparing version 0.0.3 to 0.0.4
32
app.js
@@ -1,8 +0,8 @@ | ||
"use strict"; | ||
'use strict' | ||
// external modules | ||
var _ = require( 'lodash' ) | ||
var S = require( 'string' ) | ||
var _ = require('lodash') | ||
var S = require('string') | ||
module.exports = function ( opt ) { | ||
module.exports = function (opt) { | ||
var seneca = this | ||
@@ -12,3 +12,3 @@ | ||
function redirect( args, cb ) { | ||
function redirect (args, cb) { | ||
var req = this.fixedargs.req$ | ||
@@ -18,30 +18,30 @@ var kind = args.kind | ||
var shouldRedirect = false | ||
var ct = ( req.headers[ 'content-type' ] || '' ).split( ';' )[ 0 ] | ||
var ct = (req.headers['content-type'] || '').split(';')[0] | ||
if( options.always ) { | ||
if (options.always) { | ||
shouldRedirect = true | ||
} | ||
else if( options[kind] && options[kind].always ) { | ||
else if (options[kind] && options[kind].always) { | ||
shouldRedirect = true | ||
} | ||
else if( !_.isUndefined(req.query.redirect) ) { | ||
else if (!_.isUndefined(req.query.redirect)) { | ||
shouldRedirect = S(req.query.redirect).toBoolean() | ||
} | ||
else if( 'application/json' == ct ) { | ||
else if ('application/json' === ct) { | ||
shouldRedirect = false | ||
} | ||
else shouldRedirect = false; | ||
else shouldRedirect = false | ||
var redirect | ||
if( shouldRedirect ) { | ||
if (shouldRedirect) { | ||
redirect = { | ||
win: _.isString( req.query.win ) ? req.query.win : ( options[kind]? options[kind].win : undefined ) , | ||
fail: _.isString( req.query.fail ) ? req.query.fail : ( options[kind]? options[kind].fail: undefined ) | ||
win: _.isString(req.query.win) ? req.query.win : (options[kind] ? options[kind].win : undefined), | ||
fail: _.isString(req.query.fail) ? req.query.fail : (options[kind] ? options[kind].fail : undefined) | ||
} | ||
} | ||
cb( null, redirect ) | ||
cb(null, redirect) | ||
} | ||
seneca.add( {role: 'auth', cmd: 'redirect'}, redirect ) | ||
seneca.add({role: 'auth', cmd: 'redirect'}, redirect) | ||
} |
{ | ||
"name": "auth-redirect", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Seneca internal module for auth redirect", | ||
"main": "app.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "lab -r console -v -L -m 3000", | ||
"lint": "lab -dL", | ||
"coverage": "lab -s test/*test.js -r lcov | coveralls", | ||
"annotate": "docco app.js -o doc" | ||
}, | ||
@@ -16,3 +19,3 @@ "keywords": [ | ||
"type": "git", | ||
"url": "https://github.com/mirceaalexandru/auth-redirect" | ||
"url": "https://github.com/senecajs/auth-redirect" | ||
}, | ||
@@ -29,12 +32,27 @@ "files": [ | ||
}, | ||
"contributors": [ | ||
{ | ||
"name": "Cristian Kiss", | ||
"email": "kissdevel@gmail.com", | ||
"url": "https://github.com/ckiss" | ||
} | ||
], | ||
"bugs": { | ||
"url": "https://github.com/mirceaalexandru/auth-redirect" | ||
"url": "https://github.com/senecajs/auth-redirect" | ||
}, | ||
"homepage": "https://github.com/mirceaalexandru/auth-redirect", | ||
"homepage": "https://github.com/senecajs/auth-redirect", | ||
"license": "MIT", | ||
"readmeFilename": "README.md", | ||
"dependencies": { | ||
"lodash": "^3.10.0", | ||
"string": "^3.3.0" | ||
"lodash": "4.x.x", | ||
"string": "3.x.x" | ||
}, | ||
"devDependencies": { | ||
"code": "2.x.x", | ||
"docco": "0.x.x", | ||
"eslint-config-seneca": "1.x.x", | ||
"eslint-plugin-hapi": "4.x.x", | ||
"eslint-plugin-standard": "1.x.x", | ||
"lab": "8.x.x" | ||
} | ||
} |
@@ -0,8 +1,14 @@ | ||
![Seneca](http://senecajs.org/files/assets/seneca-logo.png) | ||
auth-redirect | ||
======================== | ||
[Seneca](http://senecajs.org) internal module for auth redirect. | ||
[![npm version][npm-badge]][npm-url] | ||
[![Dependency Status][david-badge]][david-url] | ||
[![Gitter chat][gitter-badge]][gitter-url] | ||
This module is used by [seneca-auth](https://www.npmjs.com/package/seneca-auth) | ||
Lead Maintainer: [Mircea Alexandru](https://github.com/mirceaalexandru) | ||
[Seneca](http://senecajs.org) internal module for auth redirect. This module is used by [seneca-auth](https://www.npmjs.com/package/seneca-auth) | ||
For a gentle introduction to Seneca itself, see the [senecajs.org](http://senecajs.org) site. | ||
@@ -14,1 +20,7 @@ | ||
[npm-badge]: https://badge.fury.io/js/auth-redirect.svg | ||
[npm-url]: https://badge.fury.io/js/auth-redirect | ||
[david-badge]: https://david-dm.org/senecajs/auth-redirect.svg | ||
[david-url]: https://david-dm.org/senecajs/auth-redirect | ||
[gitter-badge]: https://badges.gitter.im/senecajs/seneca.png | ||
[gitter-url]: https://gitter.im/senecajs/seneca |
Sorry, the diff of this file is not supported yet
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
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
4510
1
26
6
+ Addedlodash@4.17.21(transitive)
- Removedlodash@3.10.1(transitive)
Updatedlodash@4.x.x
Updatedstring@3.x.x