Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Set shop manager password on invitation #5173

Merged
merged 4 commits into from
Jun 9, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion imports/plugins/core/accounts/client/components/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Login extends Component {
super(props);

const currentRoute = Router.current().route;
const isPasswordReset = currentRoute.name === "reset-password";
const isPasswordReset = ["reset-password", "account/enroll"].includes(currentRoute.name);

this.state = {
currentView: isPasswordReset ? "loginFormUpdatePasswordView" : props.loginFormCurrentView
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const wrapComponent = (Comp) => (
// Now that Meteor.users is verified, we should do the same with the Accounts collection
Meteor.call("accounts/verifyAccount");
const { storefrontUrls } = Reaction.getCurrentShop();
if (Reaction.hasAdminAccess()) {
if (Reaction.hasDashboardAccessForAnyShop()) {
Router.go("/operator");
} else {
window.location.href = `${storefrontUrls.storefrontHomeUrl}/signin`;
Expand Down
6 changes: 4 additions & 2 deletions imports/plugins/core/layout/client/components/coreLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@ const styles = (theme) => ({
function CoreLayout({ classes, location }) {
let content = <Components.Login />;

const isAdmin = Reaction.hasDashboardAccessForAnyShop();

// If we're not on /account or /account/login for hydra, and the user is signed in,
// then we will redirect or show a logout button
if (location.pathname.startsWith("/account") === false) {
// If the current user is an admin then redirect to /operator
if (Reaction.hasDashboardAccessForAnyShop()) {
if (isAdmin) {
window.location.replace("/operator");
return null;
}
Expand All @@ -50,7 +52,7 @@ function CoreLayout({ classes, location }) {
// But they aren't an admin, then give them a logout button.
if (!Reaction.hasPermission(["anonymous"])) {
// If the user is logged in but not a admin redirect to the storefront.
if (!Reaction.hasAdminAccess()) {
if (!isAdmin) {
const { storefrontUrls } = Reaction.getCurrentShop();
window.location.href = `${storefrontUrls.storefrontHomeUrl}`;
return null;
Expand Down