Skip to content

Commit

Permalink
Fixed issue with troublesome redirect in React Router when clicking l…
Browse files Browse the repository at this point in the history
…ink to reset password.
  • Loading branch information
timbrandin committed Jan 7, 2017
1 parent 1712703 commit 0461d04
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .versions
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 22 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# React Accounts UI

Current version 1.2.13
Current version 1.2.14

## Features

Expand Down
2 changes: 1 addition & 1 deletion imports/accounts_ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`),
Expand Down
6 changes: 5 additions & 1 deletion imports/helpers.js
Original file line number Diff line number Diff line change
@@ -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'),
Expand Down Expand Up @@ -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);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.js
Original file line number Diff line number Diff line change
@@ -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'
Expand Down

0 comments on commit 0461d04

Please sign in to comment.