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 checkout login permissions #2752

Merged
merged 18 commits into from
Sep 14, 2017
Merged
Changes from all 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
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Meteor } from "meteor/meteor";
import { Template } from "meteor/templating";
import { Roles } from "meteor/alanning:roles";
import { Reaction } from "/client/api";
import { Cart } from "/lib/collections";

Expand All @@ -18,9 +17,12 @@ Template.checkoutLogin.helpers({
if (cart && cart.workflow) {
const currentStatus = cart.workflow.status;
const guestUser = Reaction.hasPermission("guest", Meteor.user());
const anonUser = Roles.userIsInRole("anonymous", Meteor.user(), Reaction.getShopId());

if (currentStatus !== self.template && guestUser === true && anonUser === false) {
// when you click as "continue as guest" you ARE still anonymous.
// you are only NOT anonymous if you sign up or have supply an email. Hence
// we check only that the user is at least guest before moving to next step.
// since sign up users can still have guest permission.
if (currentStatus !== self.template && guestUser === true) {
return true;
}
}
Expand Down