diff --git a/imports/plugins/core/accounts/client/components/login.js b/imports/plugins/core/accounts/client/components/login.js index 1c1ea208cce..c86ca93f923 100644 --- a/imports/plugins/core/accounts/client/components/login.js +++ b/imports/plugins/core/accounts/client/components/login.js @@ -54,9 +54,10 @@ class Login extends Component { } render() { + const currentRoute = Router.current().route; + const isOauthFlow = currentRoute.options && currentRoute.options.meta && currentRoute.options.meta.oauthLoginFlow; + const idpFormClass = isOauthFlow ? "idp-form" : ""; if (this.state.currentView === "loginFormSignInView" || this.state.currentView === "loginFormSignUpView") { - const currentRoute = Router.current().route; - const isOauthFlow = currentRoute.options && currentRoute.options.meta && currentRoute.options.meta.oauthLoginFlow; if (isOauthFlow) { return ( +
+ +
); } } diff --git a/imports/plugins/core/accounts/client/components/updatePasswordOverlay.js b/imports/plugins/core/accounts/client/components/updatePassword.js similarity index 54% rename from imports/plugins/core/accounts/client/components/updatePasswordOverlay.js rename to imports/plugins/core/accounts/client/components/updatePassword.js index bb595cffc4e..3c64970b62a 100644 --- a/imports/plugins/core/accounts/client/components/updatePasswordOverlay.js +++ b/imports/plugins/core/accounts/client/components/updatePassword.js @@ -3,7 +3,7 @@ import PropTypes from "prop-types"; import classnames from "classnames"; import { Components } from "@reactioncommerce/reaction-components"; -class UpdatePasswordOverlay extends Component { +class UpdatePassword extends Component { static propTypes = { isDisabled: PropTypes.bool, isOpen: PropTypes.bool, @@ -93,30 +93,27 @@ class UpdatePasswordOverlay extends Component { if (type === "setPassword") { return ( -
- -
- ); - } - - return ( -
-
+ ); + } + + return ( + ); } @@ -138,7 +135,7 @@ class UpdatePasswordOverlay extends Component { } return ( - + ); } @@ -152,64 +149,42 @@ class UpdatePasswordOverlay extends Component { return (
{this.props.isOpen === true && -
-
-
-
- {showSpinner ? this.renderSpinnerOnLoad() : -
-
-

- {this.renderPasswordResetText()} -

-
- -
-
- - {this.renderFormMessages()} - -
- - {this.renderPasswordErrors()} -
- -
-
- -
- {this.renderSpinnerOnWait()} - -
- -
+
+ {showSpinner ? this.renderSpinnerOnLoad() : + +
+

+ {this.renderPasswordResetText()} +

+
+
+ + {this.renderFormMessages()} + +
+ + {this.renderPasswordErrors()}
+
- - } -
+
+ {this.renderSpinnerOnWait()} +
+ + }
-
} + }
); } } -export default UpdatePasswordOverlay; +export default UpdatePassword; diff --git a/imports/plugins/core/accounts/client/containers/passwordOverlay.js b/imports/plugins/core/accounts/client/containers/updatePassword.js similarity index 71% rename from imports/plugins/core/accounts/client/containers/passwordOverlay.js rename to imports/plugins/core/accounts/client/containers/updatePassword.js index 5cc3e42ae52..5ce089f9f1c 100644 --- a/imports/plugins/core/accounts/client/containers/passwordOverlay.js +++ b/imports/plugins/core/accounts/client/containers/updatePassword.js @@ -5,17 +5,16 @@ import Random from "@reactioncommerce/random"; import { Accounts } from "meteor/accounts-base"; import { Meteor } from "meteor/meteor"; import { Components, registerComponent } from "@reactioncommerce/reaction-components"; -import { Reaction } from "/client/api"; +import { Router } from "/client/api"; import { LoginFormValidation } from "/lib/api"; -import UpdatePasswordOverlay from "../components/updatePasswordOverlay"; +import UpdatePassword from "../components/updatePassword"; const wrapComponent = (Comp) => ( - class UpdatePasswordOverlayContainer extends Component { + class UpdatePasswordContainer extends Component { static propTypes = { callback: PropTypes.func, formMessages: PropTypes.object, isOpen: PropTypes.bool, - token: PropTypes.string, type: PropTypes.string, uniqueId: PropTypes.string } @@ -64,8 +63,8 @@ const wrapComponent = (Comp) => ( }); return; } - - Accounts.resetPassword(this.props.token, password, (error) => { + const { token } = Router.current().params; + Accounts.resetPassword(token, password, (error) => { if (error) { this.setState({ isDisabled: false, @@ -76,15 +75,7 @@ const wrapComponent = (Comp) => ( } else { // Now that Meteor.users is verified, we should do the same with the Accounts collection Meteor.call("accounts/verifyAccount"); - - this.props.callback(); - - this.setState({ - isOpen: !this.state.isOpen - }); - - const shopId = Reaction.getUserPreferences("reaction", "activeShopId"); - Reaction.setShopId(shopId); + Router.go(`${Router.current().route.fullPath}/completed`); } }); } @@ -111,6 +102,27 @@ const wrapComponent = (Comp) => ( } render() { + const { status } = Router.current().params; + if (status === "completed") { + return ( +
+
+

+ +

+
+

+ +

+
+ ); + } return ( ( } ); -registerComponent("UpdatePasswordOverlay", UpdatePasswordOverlay, wrapComponent); +registerComponent("UpdatePassword", UpdatePassword, wrapComponent); -export default wrapComponent(UpdatePasswordOverlay); +export default wrapComponent(UpdatePassword); diff --git a/imports/plugins/core/accounts/client/index.js b/imports/plugins/core/accounts/client/index.js index 489f74301fa..a6aca83c6e2 100644 --- a/imports/plugins/core/accounts/client/index.js +++ b/imports/plugins/core/accounts/client/index.js @@ -20,7 +20,7 @@ export { default as PermissionsList } from "./components/permissionsList"; export { default as SignIn } from "./components/signIn"; export { default as SignUp } from "./components/signUp"; export { default as UpdateEmail } from "./containers/updateEmail"; -export { default as UpdatePasswordOverlay } from "./components/updatePasswordOverlay"; +export { default as UpdatePassword } from "./components/updatePassword"; export { default as LoginInline } from "./components/loginInline"; export { default as AccountsDashboardContainer } from "./containers/accountsDashboardContainer"; @@ -31,7 +31,7 @@ export { default as EditGroupContainer } from "./containers/editGroupContainer"; export { default as ForgotPasswordContainer } from "./containers/forgotPassword"; export { default as MainDropdownContainer } from "./containers/mainDropdown"; export { default as MessagesContainer } from "./containers/messages"; -export { default as UpdatePasswordOverlayContainer } from "./containers/passwordOverlay"; +export { default as UpdatePasswordContainer } from "./containers/updatePassword"; export { default as LoginInlineContainer } from "./containers/loginInline"; export { default as VerifyAccount } from "./containers/verifyAccount"; diff --git a/imports/plugins/core/accounts/client/templates/updatePassword/updatePassword.html b/imports/plugins/core/accounts/client/templates/updatePassword/updatePassword.html index 8ceba9961fc..5ab5c3b7909 100644 --- a/imports/plugins/core/accounts/client/templates/updatePassword/updatePassword.html +++ b/imports/plugins/core/accounts/client/templates/updatePassword/updatePassword.html @@ -1,5 +1,5 @@ -