+
+
{showSpinner ? this.renderSpinnerOnLoad() :
-
}
+ }
);
}
diff --git a/imports/plugins/core/accounts/client/containers/passwordOverlay.js b/imports/plugins/core/accounts/client/containers/passwordOverlay.js
index 5cc3e42ae52..a5fdb73ef6f 100644
--- a/imports/plugins/core/accounts/client/containers/passwordOverlay.js
+++ b/imports/plugins/core/accounts/client/containers/passwordOverlay.js
@@ -5,7 +5,7 @@ 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, i18next } from "/client/api";
import { LoginFormValidation } from "/lib/api";
import UpdatePasswordOverlay from "../components/updatePasswordOverlay";
@@ -15,7 +15,7 @@ const wrapComponent = (Comp) => (
callback: PropTypes.func,
formMessages: PropTypes.object,
isOpen: PropTypes.bool,
- token: PropTypes.string,
+ // token: PropTypes.string,
type: PropTypes.string,
uniqueId: PropTypes.string
}
@@ -64,8 +64,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 +76,15 @@ 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
+ isLoading: false,
+ isDisabled: true,
+ formMessages: {
+ info: [{
+ reason: i18next.t("accountsUI.info.passwordResetDone") || "Password reset complete."
+ }]
+ }
});
-
- const shopId = Reaction.getUserPreferences("reaction", "activeShopId");
- Reaction.setShopId(shopId);
}
});
}
diff --git a/imports/plugins/core/accounts/client/templates/updatePassword/updatePassword.js b/imports/plugins/core/accounts/client/templates/updatePassword/updatePassword.js
index 16bc22b7351..a9542b7983d 100644
--- a/imports/plugins/core/accounts/client/templates/updatePassword/updatePassword.js
+++ b/imports/plugins/core/accounts/client/templates/updatePassword/updatePassword.js
@@ -9,18 +9,6 @@ import { LoginFormSharedHelpers } from "../../helpers";
import { getComponent } from "/imports/plugins/core/components/lib";
import { LoginFormValidation } from "/lib/api";
-/**
- * Accounts Event: onResetPasswordLink When a user uses a password reset link
- */
-Accounts.onResetPasswordLink((token, done) => {
- Blaze.renderWithData(Template.loginFormUpdatePasswordOverlay, {
- token,
- callback: done,
- isOpen: true,
- type: "updatePassword"
- }, $("body").get(0));
-});
-
/**
* Accounts Event: onEnrollmentLink When a user uses an enrollment link
*/
@@ -40,7 +28,10 @@ Accounts.onEnrollmentLink((token, done) => {
// */
Template.loginFormUpdatePasswordOverlay.helpers({
component() {
- const currentData = Template.currentData() || {};
+ let currentData = { isOpen: true, type: "updatePassword" }; // TODO: Edit
+ if (Object.keys(Template.currentData()).length) {
+ currentData = Template.currentData();
+ }
return {
...currentData,
component: getComponent("UpdatePasswordOverlay")
diff --git a/imports/plugins/core/accounts/register.js b/imports/plugins/core/accounts/register.js
index 6621eda1b46..98c4a5507e7 100644
--- a/imports/plugins/core/accounts/register.js
+++ b/imports/plugins/core/accounts/register.js
@@ -65,6 +65,13 @@ Reaction.registerPackage({
label: "Profile",
icon: "fa fa-user",
provides: ["userAccountDropdown"]
+ }, {
+ route: "/reset-password/:token",
+ template: "loginFormUpdatePasswordOverlay",
+ workflow: "none",
+ meta: { noAdminControls: true },
+ name: "Reset Password",
+ label: "reset-password"
}],
layout: [{
layout: "coreLayout",
diff --git a/imports/plugins/core/accounts/server/methods/sendResetPasswordEmail.js b/imports/plugins/core/accounts/server/methods/sendResetPasswordEmail.js
index bb43c6dc9b5..7ddea0db33b 100644
--- a/imports/plugins/core/accounts/server/methods/sendResetPasswordEmail.js
+++ b/imports/plugins/core/accounts/server/methods/sendResetPasswordEmail.js
@@ -9,6 +9,10 @@ import { Shops } from "/lib/collections";
import Reaction from "/imports/plugins/core/core/server/Reaction";
import ReactionError from "@reactioncommerce/reaction-error";
+Accounts.urls.resetPassword = function reset(token) {
+ return Meteor.absoluteUrl(`reset-password/${token}`);
+};
+
/**
* @method sendResetEmail
* @memberof Core
diff --git a/imports/plugins/core/ui/client/components/app/app.js b/imports/plugins/core/ui/client/components/app/app.js
index a19f2ba9aa8..9694af9db22 100644
--- a/imports/plugins/core/ui/client/components/app/app.js
+++ b/imports/plugins/core/ui/client/components/app/app.js
@@ -47,6 +47,11 @@ class App extends Component {
return this.props.hasDashboardAccess;
}
+ get noAdmin() {
+ const currentRoute = this.props.currentRoute.route;
+ return currentRoute && currentRoute.options && currentRoute.options.meta && currentRoute.options.meta.noAdminControls;
+ }
+
get isOauthProvider() {
const currentRoute = this.props.currentRoute.route;
return currentRoute && currentRoute.options && currentRoute.options.meta && currentRoute.options.meta.oauthLoginFlow;
@@ -115,7 +120,7 @@ class App extends Component {
const { currentRoute } = this.props;
const layout = currentRoute && currentRoute.route && currentRoute.route.options && currentRoute.route.options.layout;
- if (this.isAdminApp && layout !== "printLayout" && !this.isOauthProvider) {
+ if (this.isAdminApp && layout !== "printLayout" && !this.isOauthProvider && !this.noAdmin) {
return this.renderAdminApp();
}
diff --git a/private/data/i18n/en.json b/private/data/i18n/en.json
index 60848154620..a07397d83f2 100644
--- a/private/data/i18n/en.json
+++ b/private/data/i18n/en.json
@@ -642,7 +642,7 @@
"signUpWithYourEmailAddress": "Register with your email address",
"terms": "Terms of use",
"updateYourPassword": "Update your password",
- "updatePasswordAndContinue": "Update and continue",
+ "updatePasswordAndContinue": "Update",
"updatedServiceConfiguration": "Updated service configuration for {{service}}",
"username": "Username",
"usernameOrEmail": "Username or email",
@@ -658,6 +658,7 @@
"passwordChanged": "Password changed",
"passwordReset": "Password reset",
"passwordResetSend": "Email with password reset link has been sent.",
+ "passwordResetDone": "Password reset complete. Please return to app.",
"invitationSent": "Invitation sent",
"sendInvitation": "Send invitation"
},