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

Reset password error - Uncaught Error: Match error: Expected string, got object #411

Closed
isAlmogK opened this issue May 31, 2015 · 27 comments

Comments

@isAlmogK
Copy link

I'm getting the following error message when testing out the reset password

Uncaught Error: Match error: Expected string, got objectn @ 1b6d362a6b5cf33ccf07ab04bb45f2a3d5320a98.js:21e.resetPassword @ 1b6d362a6b5cf33ccf07ab04bb45f2a3d5320a98.js:72E.atPwdFormEvents.submit #at-pwd-form @ 1b6d362a6b5cf33ccf07ab04bb45f2a3d5320a98.js:212(anonymous function) @ 1b6d362a6b5cf33ccf07ab04bb45f2a3d5320a98.js:64e._withTemplateInstanceFunc @ 1b6d362a6b5cf33ccf07ab04bb45f2a3d5320a98.js:64(anonymous function) @ 1b6d362a6b5cf33ccf07ab04bb45f2a3d5320a98.js:64(anonymous function) @ 1b6d362a6b5cf33ccf07ab04bb45f2a3d5320a98.js:63c._withCurrentView @ 1b6d362a6b5cf33ccf07ab04bb45f2a3d5320a98.js:63(anonymous function) @ 1b6d362a6b5cf33ccf07ab04bb45f2a3d5320a98.js:63(anonymous function) @ 1b6d362a6b5cf33ccf07ab04bb45f2a3d5320a98.js:63ie.event.dispatch @ 1b6d362a6b5cf33ccf07ab04bb45f2a3d5320a98.js:50g.handle

@splendido
Copy link
Member

A bit more of context, please?
...when do you get the error?
After doing what?

@isAlmogK
Copy link
Author

I land on the change password route, I fill in new password (twice) and click the button that's when I get the error

@splendido
Copy link
Member

Lets try to debug this block of code in your browser (put a bearkpoint on the first line...).
And try to see what you get on this line for AccountsTemplates.paramToken and password...

@splendido
Copy link
Member

Accounts.resetPassword requires two strings

@isAlmogK
Copy link
Author

You can see the issue here - https://xstaging.goplatfarm.com/#!forgot-password
almog[@]scoreoid.net

@isAlmogK
Copy link
Author

I'm having no luck debugging this, you can see the error here - https://xstaging.goplatfarm.com/#!reset-password/lVAjYl5iqapjQipWFWMok85CPwWifUu7H8sziI9h3HS

@splendido
Copy link
Member

I've just tried with your link...
...and it worked! :-)
I was able to see the Email sent! message for a couple of seconds then a redirect to /dashboard took place.
...I'd suggest to redirect to / thereafter, so to show the normal login form without the Must be logged in! error message.

AccountsTemplates.configureRoute('forgotPwd', {
    redirect: '/',
});

@isAlmogK
Copy link
Author

isAlmogK commented Jun 1, 2015

That's not the issue, it sends the reset password email but once you get the email click on the link, go to the change password page you can't change the password you get that error in the console

@isAlmogK
Copy link
Author

isAlmogK commented Jun 1, 2015

Attached gif, not sure how to make it any clearer
password_issue

@splendido
Copy link
Member

Sorry I got lost...

@splendido splendido reopened this Jun 1, 2015
@splendido
Copy link
Member

the problem is AccountsTemplates.paramToken is undefined!

if you head to https://useraccounts-bootstrap.meteor.com/reset-password/lVAjYl5iqapjQipWFWMok85CPwWifUu7H8sziI9h3HS open up browser's console and type AccountsTemplates.paramToken you'll see to token taken from the URL.

if instead you head to https://xstaging.goplatfarm.com/#!reset-password/lVAjYl5iqapjQipWFWMok85CPwWifUu7H8sziI9h3HS and do the same, you'll get undefined...

...the curious thing is that Router.current().params.paramToken works fine in both cases!

@splendido
Copy link
Member

this must be a problem with the route path which is defined here as /reset-password/:paramToken.
The paramToken value is the picked up here.

Please try to debug this considering you're using appcache which changes the URLs...

@splendido
Copy link
Member

I tried your settings with my changes within a local app, also adding appcache.
And everything seems to work for me...

@isAlmogK
Copy link
Author

isAlmogK commented Jun 1, 2015

Just tested your changes still not working you can test it https://xstaging.goplatfarm.com/

@isAlmogK
Copy link
Author

isAlmogK commented Jun 1, 2015

Just tested it locally again still getting the same console error

Uncaught Error: Match error: Expected string, got object

@isAlmogK
Copy link
Author

isAlmogK commented Jun 1, 2015

When I test it by AccountsTemplates.paramToken I'm getting null

@isAlmogK
Copy link
Author

isAlmogK commented Jun 1, 2015

I'm thinking it might be better to use "Router.current().params.paramToken" as this seems to work on my end when I test.

I think something is causing a conflict with the URL not sure what it is maybe a package I checked all the routes I don't have reset-password router set anywhere.

Is there way for me to hardcode or set a workaround that would use "Router.current().params.paramToken"

@splendido
Copy link
Member

Lets try this:

  1. go to your app folder
  2. mkdir packages && cd packages
  3. git clone https://github.com/meteor-useraccounts/core.git
  4. cd..
  5. put a console.log('setting paramToken to ' + this.params.paramToken); just before this line
  6. put a console.log('clearing paramToken!!!'); just before this line
  7. meteor
  8. test the reset-password form...

I bet there's something with your IR configuration that causes the onStop callback to be called...

@isAlmogK
Copy link
Author

isAlmogK commented Jun 2, 2015

I did the following and run meteor add useraccounts:core and run meteor remove useraccounts:bootsstrap

But now I get -
Couldn't find a template named "fullPageAtForm" or "fullPageAtForm". Are you sure you defined it?

If I leave useraccounts:bootstrap I'm not seeing the console logs

@isAlmogK
Copy link
Author

isAlmogK commented Jun 2, 2015

I added the bootstrap package locally, and tested still getting the console log. It seems the error hits before the log.

@isAlmogK
Copy link
Author

isAlmogK commented Jun 2, 2015

I'm running a test before the error hits, at at_pwd_forms.js

before
return Accounts.resetPassword(AccountsTemplates.paramToken, password, function(error) {

I'm seeing that console.log(AccountsTemplates); has no object or paramToken or anything with hash

@isAlmogK
Copy link
Author

isAlmogK commented Jun 2, 2015

Been testing it some more it seems that the onRun in core.js (

AccountsTemplates.paramToken = this.params.paramToken;
)

is never being run, if I move / add AccountsTemplates.paramToken = this.params.paramToken; to the onBefore hook it's fine and works. Still not sure why it's happing. Will do a pull request

@isAlmogK
Copy link
Author

isAlmogK commented Jun 2, 2015

Never mind can't create a pull request, it's not open. Here is a gist with the fix https://gist.github.com/almogdesign/15d770ee2873f2d525b2

@isAlmogK
Copy link
Author

isAlmogK commented Jun 2, 2015

Same issue as here - #410 (comment) onRun hook not firing

@isAlmogK
Copy link
Author

isAlmogK commented Jun 3, 2015

@splendido hi have you had a chance to check the onRun hook issue?

@splendido
Copy link
Member

pushing out 1.11.1 right now, let me know if it works!

tnx!

@isAlmogK
Copy link
Author

isAlmogK commented Jun 4, 2015

Tested works perfect thanks for the great support

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

2 participants