diff --git a/_chapters/redirect-on-login.md b/_chapters/redirect-on-login.md index 8d8cb17ad..0fba81186 100644 --- a/_chapters/redirect-on-login.md +++ b/_chapters/redirect-on-login.md @@ -15,9 +15,7 @@ Let's start by adding a method to read the `redirect` URL from the querystring. ``` coffee function querystring(name, url = window.location.href) { - name = name.replace(/[[]]/g, "\\$&"); - - const regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)", "i"); + const regex = new RegExp("[?&]" + name + "(=([^&#]*))", "i"); const results = regex.exec(url); if (!results) { @@ -27,7 +25,7 @@ function querystring(name, url = window.location.href) { return ""; } - return decodeURIComponent(results[2].replace(/\+/g, " ")); + return decodeURI(results[2].replace(/\+/g, " ")); } ``` @@ -54,7 +52,7 @@ export default ({ component: C, props: cProps, ...rest }) => { }; ``` -And remove the following from the `handleSubmit` method in `src/containers/Login.js`. +And remove the following from the `handleSubmit` method in `src/containers/Login.js` and from the `handleConfirmationSubmit` method in `src/containers/Signup.js`. ``` coffee this.props.history.push("/");