Skip to content

Error on verification: size must be a number >= 0 #70

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

Closed
lfernando-silva opened this issue Sep 12, 2017 · 1 comment
Closed

Error on verification: size must be a number >= 0 #70

lfernando-silva opened this issue Sep 12, 2017 · 1 comment

Comments

@lfernando-silva
Copy link

Hey guys, I've followed the example to make password reset and account verification. It's kind out of date, but I could build the password reset flux with some changes.

But in the case of verification, I got this error.

Steps to reproduce

  1. Set authManagement's Notifer object
  app.configure(authManagement({
    service: 'users',
    path: '/recovery',
    notifier: Notifier,
    identifyUserProps: ["email"],
    longTokenLen: 30,
    shortTokenLen: 30
  }))
  1. Set the authentication before hook
    before: {
      create: [
        common.iff(isAction('passwordChange',
                            'identityChange', 
                            'verifySignup', 
                            'resendVerifySignup',
                             'resetPwd', 
                             'sendResetPwd'),
         authentication.hooks.authenticate('jwt')),
        authentication.hooks.authenticate(config.strategies)
      ],
  1. Set the verification on users before and after create hook
const verifyHooks = require('feathers-authentication-management').hooks
//... before
create: [ hashPassword(), verifyHooks.addVerification('authentication') ],
//...after
create: [AfterHooks.onCreate, verifyHooks.removeVerification()],

Where AfterHooks.onCreate calls the email service using the hook.result object.

Expected behavior

To receive the hook object at the AfterHooks.onCreate function and send the verification e-mail.

Actual behavior

I get error at this part of library:

module.exports.addVerification = function (path) {
 //...
      return Promise.all([options, getLongToken(options.longTokenLen), getShortToken(options.shortTokenLen, options.shortTokenDigits)]);
    }).then(function (_ref) {
      ..//

because "options" is a response of "authentication" service, that is just {accessToken: 'generatedToken'} and doesn't contains the properties shortTokenLen, longTokenLen and shortTokenDigits. And I don't know how to fill it.

System configuration

Tell us about the applicable parts of your setup.

Module versions (especially the part that's not working):
"feathers": "^2.2.0",
"feathers-authentication": "^1.2.7",
"feathers-authentication-hooks": "^0.1.4",
"feathers-authentication-jwt": "^0.3.2",
"feathers-authentication-local": "^0.4.4",
"feathers-authentication-management": "^0.7.0",

NodeJS version:
6.x LTS

Operating System:
Linux Fedora 25

Browser Version:
Postman App 5.2

React Native Version:
Not using

Module Loader:
Default

@lfernando-silva
Copy link
Author

After a time trying, I realized it must to be verifyHooks.addVerification('recovery') (my recovery service) and not verifyHooks.addVerification('authentication').

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