Fixed issue with troublesome redirect in React Router when clicking link to reset password.

This commit is contained in:
Tim Brandin 2017-01-07 11:10:52 +01:00
parent 171270376b
commit 0461d046c7
6 changed files with 31 additions and 12 deletions

View file

@ -50,7 +50,7 @@ session@1.1.5
softwarerero:accounts-t9n@1.3.3
spacebars@1.0.11
spacebars-compiler@1.0.11
std:accounts-ui@1.2.13
std:accounts-ui@1.2.14
tmeasday:check-npm-versions@0.3.0
tracker@1.0.13
ui@1.0.11

View file

@ -1,5 +1,11 @@
# ChangeLog
### v1.2.14
7-January-2017
* Fixed issue with troublesome redirect in React Router when clicking link to
reset password.
### v1.2.13
6-January-2017
@ -15,7 +21,9 @@
18-December-2016
* #61 - BUG: Error «Need to set a username or email» when email is set
* Solved #61 by adding functionality to remember entered values in localStorage, which also makes it possible to remember values between routes (i.e. when switching between /login and /register).
* Solved #61 by adding functionality to remember entered values in localStorage,
which also makes it possible to remember values between routes (i.e. when
switching between /login and /register).
### v1.2.10
14-December-2016
@ -41,7 +49,8 @@
### v1.2.7
19-October-2016
* Make sure `nextProps.formState` actually exists before overwriting `state.formState`.
* Make sure `nextProps.formState` actually exists before overwriting
`state.formState`.
### v1.2.6
2-June-2016
@ -72,7 +81,8 @@
### v1.1.19
* Improving hooks for server side rendered pages.
* Improving so that browser pre-filled input values are pushed back to the form state.
* Improving so that browser pre-filled input values are pushed back to the form
state.
### v1.1.18
@ -92,9 +102,12 @@
### v1.1.14
* @SachaG added tmeasday:check-npm-versions to check for the correct version of npm packages.
* @ArthurPai updated T9n, which adds the Chinese language for accounts, so we can update it to v1.3.3
* @ArthurPai fixed a forgotten update T9n translation in the PasswordOrService component.
* @SachaG added tmeasday:check-npm-versions to check for the correct version of
npm packages.
* @ArthurPai updated T9n, which adds the Chinese language for accounts, so we
can update it to v1.3.3
* @ArthurPai fixed a forgotten update T9n translation in the PasswordOrService
component.
* @PolGuixe fixed the faulty meteor-developer account integration.
### v1.1.13
@ -162,7 +175,9 @@ https://github.com/studiointeract/accounts-ui/issues/16
### v1.0.19
* Added defaultValue to fields, so that when switching formState the form keeps the value it had from the other form. Which has always been a really great experience with Meteor accounts-ui.
* Added defaultValue to fields, so that when switching formState the form keeps
the value it had from the other form. Which has always been a really great
experience with Meteor accounts-ui.
### v1.0.18

View file

@ -1,6 +1,6 @@
# React Accounts UI
Current version 1.2.13
Current version 1.2.14
## Features

View file

@ -30,7 +30,7 @@ Accounts.ui._options = {
onPreSignUpHook: () => new Promise(resolve => resolve()),
onPostSignUpHook: () => {},
onEnrollAccountHook: () => redirect(`${Accounts.ui._options.loginPath}`),
onResetPasswordHook: () => redirect(`${Accounts.ui._options.loginPath}`),
onResetPasswordHook: () => redirect(`${Accounts.ui._options.resetPasswordPath}`),
onVerifyEmailHook: () => redirect(`${Accounts.ui._options.profilePath}`),
onSignedInHook: () => redirect(`${Accounts.ui._options.homeRoutePath}`),
onSignedOutHook: () => redirect(`${Accounts.ui._options.homeRoutePath}`),

View file

@ -1,3 +1,4 @@
try { import { browserHistory } from 'react-router'; } catch(e) {}
export const loginButtonsSession = Accounts._loginButtonsSession;
export const STATES = {
SIGN_IN: Symbol('SIGN_IN'),
@ -91,15 +92,18 @@ export function validateUsername(username, showMessage, clearMessage) {
export function redirect(redirect) {
if (Meteor.isClient) {
if (window.history) {
// Run after all app specific redirects, i.e. to the login screen.
Meteor.setTimeout(() => {
if (Package['kadira:flow-router']) {
Package['kadira:flow-router'].FlowRouter.go(redirect);
} else if (Package['kadira:flow-router-ssr']) {
Package['kadira:flow-router-ssr'].FlowRouter.go(redirect);
} else if (browserHistory) {
browserHistory.push(redirect);
} else {
window.history.pushState( {} , 'redirect', redirect );
}
}, 500);
}, 100);
}
}
}

View file

@ -1,6 +1,6 @@
Package.describe({
name: 'std:accounts-ui',
version: '1.2.13',
version: '1.2.14',
summary: 'Accounts UI for React in Meteor 1.3+',
git: 'https://github.com/studiointeract/accounts-ui',
documentation: 'README.md'