Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using verifyHooks.addVerification() #128

Closed
OnePunchMan007 opened this issue Sep 27, 2019 · 1 comment
Closed

using verifyHooks.addVerification() #128

OnePunchMan007 opened this issue Sep 27, 2019 · 1 comment

Comments

@OnePunchMan007
Copy link

Using verifyHooks.addVerification()
with "feathers-authentication-management": "^2.0.1", and "@feathersjs/authentication": "^4.3.0",

i have got : GeneralError: The "size" argument must be of type number. Received type undefined

user hook :

const { authenticate } = require('@feathersjs/authentication').hooks;
const verifyHooks = require('feathers-authentication-management').hooks;
const accountService = require('../authManagement/notifier');
const commonHooks = require('feathers-hooks-common');

const {
hashPassword,
protect
} = require('@feathersjs/authentication-local').hooks;

module.exports = {
before: {
all: [],
find: [authenticate('jwt')],
get: [authenticate('jwt')],
create: [hashPassword('userPassword'), verifyHooks.addVerification()],
update: [
commonHooks.disallow('external'),
hashPassword('userPassword'),
authenticate('jwt')
],
patch: [
commonHooks.iff(
commonHooks.isProvider('external'),
commonHooks.preventChanges(true, [
'userEmail',
'isVerified',
'verifyToken',
'verifyShortToken',
'verifyExpires',
'verifyChanges',
'resetToken',
'resetShortToken',
'resetExpires'
])
),
hashPassword('userPassword'),
authenticate('jwt')
],
remove: [authenticate('jwt')]
},

after: {
all: [

  protect('userPassword')
],
find: [],
get: [],
create: [
  context => {
    accountService(context.app).notifier(
      'resendVerifySignup',
      context.result
    );
  },
  verifyHooks.removeVerification()
],
update: [],
patch: [],
remove: []

},

error: {
all: [],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
}
};

service :
// Initializes the authmanagement service on path /authmanagement

const authMan = require('feathers-authentication-management'); // initialement feathers-authentication-management or authentication-local-management-v4
const { Authmanagement } = require('./authmanagement.class');
const hooks = require('./authmanagement.hooks');
const notifier = require('./notifier');

module.exports = function(app) {
// Initialize our service with any options it requires
app.configure(
authMan({
service: 'users',
notifier,
identifyUserProps: ['userEmail']
})
);
app.use('/authManagement', new Authmanagement(app));
// Get our initialized service so that we can register hooks
const service = app.service('authManagement');

service.hooks(hooks);
};

@OnePunchMan007
Copy link
Author

my bad
service :
// Initializes the authmanagement service on path /authmanagement

const authMan = require('feathers-authentication-management'); // initialement feathers-authentication-management or authentication-local-management-v4
const { Authmanagement } = require('./authmanagement.class');
const hooks = require('./authmanagement.hooks');
const notifier = require('./notifier');

module.exports = function(app) {
// Initialize our service with any options it requires
app.use('/authManagement', new Authmanagement(app));

app.configure(
authMan({
service: 'users',
notifier,
identifyUserProps: ['userEmail']
})
);

// Get our initialized service so that we can register hooks
const service = app.service('authManagement');

service.hooks(hooks);
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant