meteor - Password Reset token is returning null, although defined -


i'm utilizing useraccounts:unstyled, accounts-base, accounts-password , trying implement password resetting feature.

i have route defined such:

flowrouter.route('/reset-password/:token',  {   name: 'reset-password',   onbeforeaction: function()     accounts._resetpasswordtoken = this.params.token;     this.next();   },   action(params){     accounts._resetpasswordtoken = params.token;     mount(mainlayout, {         content: (<forgotpassword />)     });   } }); 

my template defined such:

<template name="forgotpasswordmodal">   {{#if $not currentuser}}     <div class="forgot-modal {{$.session.get 'nav-toggle'}}" id="{{checkstate}}">         <i class="fa fa-close resetpwd"></i>         {{> atform}}     </div>   {{/if}} </template> 

and helper functions defined as:

if (meteor.isclient) {   template.forgotpasswordmodal.oncreated(function(){     if(accounts._resetpasswordtoken){       session.set('resetpasswordtoken', accounts._resetpasswordtoken);     }else{       console.log("else");     }   });    template.forgotpasswordmodal.helpers({       checkstate() {           return (accountstemplates.getstate() == 'resetpwd') ? 'forgot-modal' : '';       }   });    template.forgotpasswordmodal.events({     "submit .at-btn": (event)=>{       event.preventdefault();       console.log(event);       password = document.getelementbyid('reset-password-new-password').value;       console.log("password", password);       if(password){         accounts.resetpassword(session.get('resetpasswordtoken'), password, (error)=>{           if(error){             console.log("error: ", error);           }else{             console.log("success");             session.set('resetpasswordtoken', null);           }         });       }     }   }); } 

upon clicking submit error: match error: expected string, got null (unknown).

although if load route (with valid token) , run session.get('resetpasswordtoken') token returned validly.

please try using way: flowrouter.route('/#/reset-password/:token'); default route reset password.


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -