Skip to content

Redirect not fired on resetPwd? #20

Description

@MichaelJCole

Hi, resetPwd's redirect isn't firing for me. I've got this code:


AccountsTemplates.configure({
  sendVerificationEmail: true,

  // ,,,

  // Redirects
  homeRoutePath: '/',
  defaultLayout: 'main',

  onLogoutHook: function() {
    // Note: set this hook to override default behavior, even if there's nothing to do.
    Router.go('signIn');
  },
  onSubmitHook: function(error, state) {
    console.log('onSubmitHook', error, state);
    if (error) {
      return sweetAlert({
        title: 'An Error Occured:',
        text: error.reason,
        confirmButtonText: 'Ok, snap!',
        type: 'error',
      });
    }
    switch(state) {
      case 'forgotPwd':
        return sweetAlert({
          title: 'Password Reset Sent!',
          text: 'Check your email inbox for a link to reset your password.',
          type: 'info',
        });
      case 'changePwd':
        return sweetAlert({
          title: 'Password Changed!',
          text: 'Your password has been updated.',
          type: 'success',
        });
      case 'verifyEmail':
        return sweetAlert({
          title: 'Password Changed!',
          text: 'Your password has been updated.',
          type: 'success',
        });
    }
  }
});

AccountsTemplates.configureRoute('forgotPwd', {
  redirect: function() {
    console.log('forgotPwd redirect');
    // Message happens in onSubmitHook.  This only happens if on route.
    Router.go('home');
  }
});
AccountsTemplates.configureRoute('resetPwd', {
  redirect: function() {
    console.log('resetPwd redirect');
    // Message happens in onSubmitHook.  This only happens if on route.
    Router.go('home');
  }
});

When I do a password reset, it logs this:

onSubmitHook undefined forgotPwd
app.js:11126 forgotPwd redirect

Email opens new link. Notice redirect never fires:

onSubmitHook undefined resetPwd

Which is fine, I can put a redirect in the onSubmitHook. But seems like it's missing from the api. Did I miss something?

I just want a success message and to go 'home'. What's the simplest way?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions