1- import Debug from 'debug' ;
2- import merge from 'lodash.merge' ;
3- import omit from 'lodash.omit' ;
4- import pick from 'lodash.pick' ;
5- import hooks from './hooks' ;
6- import DefaultVerifier from './verifier' ;
7- import { Strategy as LocalStrategy } from 'passport-local' ;
1+ const Debug = require ( 'debug' ) ;
2+ const merge = require ( 'lodash.merge' ) ;
3+ const omit = require ( 'lodash.omit' ) ;
4+ const pick = require ( 'lodash.pick' ) ;
5+ const hooks = require ( './hooks' ) ;
6+ const DefaultVerifier = require ( './verifier' ) ;
7+
8+ const passportLocal = require ( 'passport-local' ) ;
89
910const debug = Debug ( 'feathers-authentication-local' ) ;
1011const defaults = {
@@ -20,8 +21,8 @@ const KEYS = [
2021 'session'
2122] ;
2223
23- export default function init ( options = { } ) {
24- return function localAuth ( ) {
24+ module . exports = function init ( options = { } ) {
25+ return function localAuth ( ) {
2526 const app = this ;
2627 const _super = app . setup ;
2728
@@ -46,22 +47,22 @@ export default function init(options = {}) {
4647 let verifier = new Verifier ( app , localSettings ) ;
4748
4849 if ( ! verifier . verify ) {
49- throw new Error ( `Your verifier must implement a 'verify' function. It should have the same signature as a local passport verify callback.` )
50+ throw new Error ( `Your verifier must implement a 'verify' function. It should have the same signature as a local passport verify callback.` ) ;
5051 }
5152
5253 // Register 'local' strategy with passport
5354 debug ( 'Registering local authentication strategy with options:' , localSettings ) ;
54- app . passport . use ( localSettings . name , new LocalStrategy ( localSettings , verifier . verify . bind ( verifier ) ) ) ;
55+ app . passport . use ( localSettings . name , new passportLocal . Strategy ( localSettings , verifier . verify . bind ( verifier ) ) ) ;
5556 app . passport . options ( localSettings . name , localSettings ) ;
56-
57+
5758 return result ;
58- }
59+ } ;
5960 } ;
60- }
61+ } ;
6162
6263// Exposed Modules
63- Object . assign ( init , {
64+ Object . assign ( module . exports , {
6465 defaults,
6566 hooks,
6667 Verifier : DefaultVerifier
67- } ) ;
68+ } ) ;
0 commit comments