-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from prinzdezibel/development
Allow checkout as guest (without user account)
- Loading branch information
Showing
18 changed files
with
150 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,6 +71,5 @@ _.extend ReactionCore, | |
getShopId: -> | ||
return @shopId | ||
|
||
|
||
Meteor.startup -> | ||
ReactionCore.init() | ||
ReactionCore.init() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
packages/reaction-core/client/templates/accounts/accounts-ui/login_buttons_dropdown.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
loginButtonsSession = Accounts._loginButtonsSession | ||
|
||
Template._loginButtonsLoggedOutPasswordService.helpers | ||
# Build a decorator to wrap the original function from Accounts package. When called, | ||
# just modify the visible property of the password field. | ||
fields: ((func) -> | ||
-> | ||
fields = func() | ||
unless loginButtonsSession.get("inSignupFlow") | ||
fields.forEach (item, i) -> | ||
if item.fieldName is "password" | ||
item.visible = -> | ||
not Session.get("Reactioncommerce.Core.loginButtons.inLoginAsGuestFlow") | ||
return | ||
return fields | ||
)(Blaze._getTemplateHelper(Template._loginButtonsLoggedOutPasswordService, "fields")) | ||
|
||
inLoginAsGuestFlow: -> | ||
return Session.get "Reactioncommerce.Core.loginButtons.inLoginAsGuestFlow" | ||
|
||
inLoginFlow: -> | ||
return not Session.get("Reactioncommerce.Core.loginButtons.inLoginAsGuestFlow") and | ||
not loginButtonsSession.get("inSignupFlow") and | ||
not loginButtonsSession.get("inForgotPasswordFlow") | ||
|
||
resetLoginFlow: -> | ||
Session.set 'Reactioncommerce.Core.loginButtons.inLoginAsGuestFlow', false | ||
loginButtonsSession.set "inSignupFlow", false | ||
loginButtonsSession.set 'inForgotPasswordFlow', false | ||
|
||
canCheckoutAsGuest: -> | ||
!!ReactionCore.canCheckoutAsGuest() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/reaction-core/client/templates/accounts/inline/inline.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<template name="loginInline"> | ||
<div class="accounts-dialog accounts-inline"> | ||
{{>_loginButtonsLoggedOutAllServices}} | ||
{{>_loginButtonsLoggedOutAllServices inline="inline"}} | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 9 additions & 2 deletions
11
packages/reaction-core/client/templates/cart/checkout/login/login.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
loginButtonsSession = Accounts._loginButtonsSession | ||
|
||
Template.checkoutLogin.rendered = -> | ||
# initial screen in checkout should be to create an account | ||
loginButtonsSession = Accounts._loginButtonsSession | ||
loginButtonsSession.set "inSignupFlow", true | ||
if !!ReactionCore.canCheckoutAsGuest() | ||
Session.set 'Reactioncommerce.Core.loginButtons.inLoginAsGuestFlow', true | ||
loginButtonsSession.set "inSignupFlow", false | ||
else | ||
loginButtonsSession.set "inSignupFlow", true | ||
Session.set 'Reactioncommerce.Core.loginButtons.inLoginAsGuestFlow', false | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
ReactionCore.canCheckoutAsGuest = () -> | ||
return Meteor.settings?.public?.CHECKOUT_AS_GUEST || false | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,4 +68,4 @@ ReactionCore.registerPackage | |
permission: "dashboard/settings/account" | ||
group: "Shop Settings" | ||
} | ||
] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,7 @@ Package.onUse(function (api) { | |
api.use("aldeed:[email protected]"); | ||
api.use("aldeed:[email protected]","client"); | ||
api.use("iron:[email protected]"); | ||
api.use("prinzdezibel:[email protected]"); | ||
api.use("ongoworks:[email protected]"); | ||
api.use("ongoworks:[email protected]"); | ||
api.use("ongoworks:[email protected]"); | ||
|
@@ -105,6 +106,7 @@ Package.onUse(function (api) { | |
"lib/statemachine/state-machine.js", | ||
"common/packageGlobals.js", | ||
"common/common.coffee", | ||
"common/reaction-core.coffee", | ||
"common/register.coffee", | ||
"common/routing.coffee", | ||
"common/schemas/packages.coffee", | ||
|
@@ -198,6 +200,7 @@ Package.onUse(function (api) { | |
"client/templates/accounts/accounts-ui/login_buttons.html", | ||
"client/templates/accounts/accounts-ui/login_buttons_dialogs.html", | ||
"client/templates/accounts/accounts-ui/login_buttons_dropdown.html", | ||
"client/templates/accounts/accounts-ui/login_buttons_dropdown.coffee", | ||
"client/templates/accounts/accounts-ui/login_buttons_single.html", | ||
"client/templates/accounts/accounts-ui/accounts-ui.coffee", | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.