feathers-authentication
Advanced tools
Comparing version 1.0.0-beta-1 to 1.0.0-beta-2
@@ -197,3 +197,3 @@ # Migrating to 1.0 | ||
console.log('JWT Payload', payload); | ||
return app.service('users').get(payload.id); | ||
return app.service('users').get(payload.userId); | ||
}) | ||
@@ -200,0 +200,0 @@ .then(user => { |
@@ -27,6 +27,6 @@ 'use strict'; | ||
if (req.hook && req.hook.redirect) { | ||
var _req$hook$redirect = req.hook.redirect, | ||
url = _req$hook$redirect.url, | ||
status = _req$hook$redirect.status; | ||
if (res.hook && res.hook.data && res.hook.data.__redirect) { | ||
var _res$hook$data$__redi = res.hook.data.__redirect, | ||
url = _res$hook$data$__redi.url, | ||
status = _res$hook$data$__redi.status; | ||
@@ -33,0 +33,0 @@ debug('Redirecting to ' + url + ' after failed authentication.'); |
@@ -20,6 +20,6 @@ 'use strict'; | ||
return function (req, res, next) { | ||
if (req.hook && req.hook.redirect) { | ||
var _req$hook$redirect = req.hook.redirect, | ||
url = _req$hook$redirect.url, | ||
status = _req$hook$redirect.status; | ||
if (res.hook && res.hook.data && res.hook.data.__redirect) { | ||
var _res$hook$data$__redi = res.hook.data.__redirect, | ||
url = _res$hook$data$__redi.url, | ||
status = _res$hook$data$__redi.status; | ||
@@ -26,0 +26,0 @@ debug('Redirecting to ' + url + ' after successful authentication.'); |
@@ -63,7 +63,5 @@ 'use strict'; | ||
if (options.failureRedirect) { | ||
// TODO (EK): Bypass the service? | ||
// hook.result = true | ||
hook.redirect = { | ||
status: 302, | ||
url: options.failureRedirect | ||
}; | ||
Object.defineProperty(hook.data, '__redirect', { value: { status: 302, url: options.failureRedirect } }); | ||
} | ||
@@ -86,10 +84,6 @@ | ||
hook.params = Object.assign({ authenticated: true }, hook.params, result.data); | ||
if (options.successRedirect) { | ||
// TODO (EK): Bypass the service? | ||
// hook.result = true | ||
hook.redirect = { | ||
status: 302, | ||
url: options.successRedirect | ||
}; | ||
Object.defineProperty(hook.data, '__redirect', { value: { status: 302, url: options.successRedirect } }); | ||
} | ||
@@ -99,6 +93,3 @@ } else if (result.redirect) { | ||
// hook.result = true | ||
hook.redirect = { | ||
status: result.status, | ||
url: result.url | ||
}; | ||
Object.defineProperty(hook.data, '__redirect', { value: { status: result.status, url: result.url } }); | ||
} | ||
@@ -105,0 +96,0 @@ |
@@ -59,4 +59,4 @@ 'use strict'; | ||
// redirect will halt the chain. | ||
if (request.strategy) { | ||
strategies = [request.strategy]; | ||
if (request.body && request.body.strategy) { | ||
strategies = [request.body.strategy]; | ||
} else if (Array.isArray(name)) { | ||
@@ -63,0 +63,0 @@ strategies = name; |
{ | ||
"name": "feathers-authentication", | ||
"description": "Add Authentication to your FeathersJS app.", | ||
"version": "1.0.0-beta-1", | ||
"version": "1.0.0-beta-2", | ||
"homepage": "https://github.com/feathersjs/feathers-authentication", | ||
@@ -67,4 +67,4 @@ "main": "lib/", | ||
"feathers": "^2.0.2", | ||
"feathers-authentication-jwt": "^0.1.0", | ||
"feathers-authentication-local": "^0.2.0", | ||
"feathers-authentication-jwt": "^0.2.0", | ||
"feathers-authentication-local": "^0.3.0", | ||
"feathers-configuration": "^0.4.1", | ||
@@ -71,0 +71,0 @@ "feathers-hooks": "^1.6.0", |
@@ -197,4 +197,4 @@ # feathers-authentication | ||
strategy: 'local', | ||
'email': 'admin@feathersjs.com', | ||
'password': 'admin' | ||
email: 'admin@feathersjs.com', | ||
password: 'admin' | ||
}).then(function(result){ | ||
@@ -201,0 +201,0 @@ console.log('Authenticated!', result); |
Sorry, the diff of this file is not supported yet
249942
1062