user555
user555

Reputation: 1529

override reset password with accounts-ui installed

I want to override and use my own form for reset password

I have installed accounts-ui package installed I tried following

Router.route( '/reset-password', {
    path      : '/#/reset-password/:slug',
    name      : 'forgot-password',
    template  : 'ResetPassword',
    waitOn: function(){
        console.log("reset link");
    },
    controller: MainRouteController
});

in HTML

    {{#if resetPassword}}
    <form  id="resetPasswordForm" method="post">
        <input id="resetPasswordPassword" name="password" placeholder="New Password" type="password" >
        <input id="resetPasswordPasswordConfirm" name="password-confirm" placeholder="Confirm" type="password" >
        <input class="btn-submit" type="submit" value="Reset">
    </form>
    {{/if}}

</template>

In .js file

if (Accounts._resetPasswordToken) {
  Session.set('resetPassword', Accounts._resetPasswordToken);
}

Template.ResetPassword.helpers({
 resetPassword: function(){
  return Session.get('resetPassword');
 }
});

But it still showing resetpassword dialog of accounts-ui

Upvotes: 1

Views: 780

Answers (1)

Sasikanth
Sasikanth

Reputation: 3043

Best solution for this is change the url for resetPassword by using following code

Accounts.urls.resetPassword = function (token) {
        return Meteor.absoluteUrl('resetPassword/' + token);
    };

In Iron-router use your link

Router.route( '/resetPassword', {
    path      : '/resetPassword/:slug',
    name      : 'forgot-password',
    template  : 'ResetPassword',
    waitOn: function(){
        console.log("reset link");
    },
    controller: MainRouteController
});

Upvotes: 4

Related Questions