Skip to content

Commit

Permalink
Merge branch 'develop' into release/1.0.0-rc.10
Browse files Browse the repository at this point in the history
  • Loading branch information
Frodigo committed Jul 4, 2022
2 parents 04d05f7 + 73d065a commit 3135b30
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/deploy-vue-storefront-cloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,9 @@ jobs:
VSF_REDIS_CACHE_INVALIDATE_URL: /cache-invalidate

VSF_RECAPTCHA_ENABLED: true
VSF_RECAPTCHA_HIDE_BADGE: false
VSF_RECAPTCHA_VERSION: 3
VSF_RECAPTCHA_SIZE: invisible
VSF_RECAPTCHA_MIN_SCORE: 0.5
VSF_RECAPTCHA_MIN_SCORE: 1.0
VSF_RECAPTCHA_SITE_KEY: 6Ldce0EeAAAAAAGGtGWG-e-SygXiFub6PXHT5fKd
VSF_RECAPTCHA_SECRET_KEY: ${{ secrets.RECAPTCHA_SECRET_KEY }}

Expand Down
5 changes: 3 additions & 2 deletions packages/theme/modules/checkout/pages/Checkout/Billing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,6 @@ export default defineComponent({
loadUserBilling(),
loadCountries(),
]);
const [defaultAddress = null] = userBillingGetters.getAddresses(loadedUserBilling, { default_shipping: true });
const wasBillingAddressAlreadySetOnCart = Boolean(loadedBillingInfoBoundToCart);
Expand All @@ -501,7 +500,9 @@ export default defineComponent({
} else if (defaultAddress) {
handleSetCurrentAddress(defaultAddress);
}
if (billingDetails.value?.country_code) {
country.value = await searchCountry({ id: billingDetails.value.country_code });
}
userBilling.value = loadedUserBilling;
countries.value = loadedCountries;
});
Expand Down
3 changes: 3 additions & 0 deletions packages/theme/modules/checkout/pages/Checkout/Shipping.vue
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,9 @@ export default defineComponent({
} else if (defaultAddress) {
handleSetCurrentAddress(defaultAddress);
}
if (shippingDetails.value?.country_code) {
country.value = await searchCountry({ id: shippingDetails.value.country_code });
}
userShipping.value = loadedUserShipping;
countries.value = loadedCountries;
});
Expand Down
18 changes: 8 additions & 10 deletions packages/theme/modules/customer/composables/useUser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ import type {
*/
export function useUser(): UseUserInterface {
const customerStore = useCustomerStore();
const { app } = useContext();
// @ts-ignore
const { app, $recaptcha } = useContext();
const { setCart } = useCart();
const { send: sendNotification } = useUiNotification();
const loading: Ref<boolean> = ref(false);
Expand Down Expand Up @@ -269,16 +270,13 @@ export function useUser(): UseUserInterface {
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
throw new Error(joinedErrors);
}

// if (recaptchaToken) { // todo: move recaptcha to separate module
// // generate a new token for the login action
// const { recaptchaInstance } = params;
// const newRecaptchaToken = await recaptchaInstance.getResponse();
//
// return factoryParams.logIn(context, { username: email, password, recaptchaToken: newRecaptchaToken });
// }
error.value.register = null;
await login({ user: { email, password }, customQuery: {} });
let loginRecaptchaToken = '';
if ($recaptcha && recaptchaToken) {
loginRecaptchaToken = await $recaptcha.getResponse();
}

await login({ user: { email, password, recaptchaToken: loginRecaptchaToken }, customQuery: {} });
} catch (err) {
error.value.register = err;
Logger.error('useUser/register', err);
Expand Down
2 changes: 1 addition & 1 deletion packages/theme/plugins/token-expired.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { UiNotification } from '~/composables/useUiNotification';
import { useCustomerStore } from '~/modules/customer/stores/customer';

export const hasGraphqlAuthorizationError = (res: ApolloQueryResult<unknown>) => res?.errors
?.some((error) => error.extensions.category === 'graphql-authorization') ?? false;
?.some((error) => error?.extensions?.category === 'graphql-authorization') ?? false;

const plugin : Plugin = ({ $pinia, app }) => {
const customerStore = useCustomerStore($pinia);
Expand Down

0 comments on commit 3135b30

Please sign in to comment.