F51-214, F51-222 Anonymous Shopping#90
F51-214, F51-222 Anonymous Shopping#90crhistianramirez merged 6 commits intoordercloud-api:developmentfrom
Conversation
- When app.constants.json > anonymous is set to true, the ocRefreshToken service will attempt to authorize anonymously using the current clientid and scope constants. - An error will be logged to the console if the clientid is not configured to work with anonymous authentication.
- Storing these tokens will trigger the refresh token workflow which does not correspond to an anonymous authentication. - Comments have been added in the code explaining why we do not store the refresh tokens from the anonymous auth response.
- The /register component has been added. Anonymous users can access this at any time to profile themselves. - The /login controller has been updated to merge anon orders with profiled users most recent unsubmitted order - Checkout state has a resolve for opening up the ocAnonymous Identify modal which will force anon users to either login or register before continuing to checking out. - ocAnonymous has a "Redirect" function for sending the newly profiled user to the state that was passed into the .Identify() modal (usually "checkout.shipping" but it could be anything)
- Redirect back to cart after force profiling - Remove the redirect cookie after a successful ocAnonymous.Redirect() - Block the registration state from non-anonymous users & applications - Fix undefined error blocking ocStateLoading from completing - Add a redirectState argument to ocRefreshToken() for controlling where the user is sent to after the new token is retrieved. - Registration form validation for username conflicts.
|
I confirmed the login unit tests are still passing. I will create tasks for unit testing the |
| <div class="panel-footer"> | ||
| <button ng-if="cart.lineItems.Items.length > 0" type="button" ui-sref="checkout.shipping" class="btn btn-block btn-primary" ng-disabled="OrderLineItemForm.$invalid">Proceed to Checkout</button> | ||
| <button ng-if="cart.lineItems.Items.length > 0" type="button" ng-click="cart.proceedToCheckout()" class="btn btn-block btn-primary" ng-disabled="OrderLineItemForm.$invalid">Proceed to Checkout</button> | ||
| </div> |
There was a problem hiding this comment.
Why do you have an ng-click here? Looks like its just routing user to checkout.shipping state, so we can probably just keep the ui-sref?
There was a problem hiding this comment.
I thought about removing it, but while developing it took me a second to figure out why my click wasn't updating and that's because we have TWO proceed to checkout buttons (one only displays on mobile views).
I think leaving this as a function will help future developers alter the proceedToCheckout behavior in a way that doesn't require them to know anything about the template.
| ocMatch: 'Passwords do not match.', | ||
| positiveInteger: 'Please enter a positive integer', | ||
| ID_Name: 'Only Alphanumeric characters, hyphens and underscores are allowed', | ||
| confirmpassword: 'Your passwords do not match', |
There was a problem hiding this comment.
Reuse confirmPassword error message instead of creating a new one with the same content.
| }; | ||
| } | ||
| }; | ||
| } No newline at end of file |
There was a problem hiding this comment.
we also have a confirm-password directive that does the same thing
There was a problem hiding this comment.
Personally I like the way this is structured better than the confirmPassword directive. It's a lot less code and it actually creates a $ngModelCtrl validator.
I don't believe the confirmPassword directive is being used anywhere in the app so maybe we can create a task to remove that.
New and improved user group filtering on orders
Summary of changes:
ocRefreshTokenservice will attempt to authorize anonymously using the current clientid and scope constants.ocAnonymous.Identify()modal which will force anon users to either login or register before continuing to checking out.ocAnonymous.Identify()modal (usually "cart" but it could be anything)ocAnonymous.Redirect()ocStateLoadingfrom completingocRefreshToken(redirectState)for controlling where the user is sent to after the new token is retrieved.See the commit messages for more details.
Additional tasks:
F51-236 - Allow duplicate toasts on add-to-cart