Skip to content

Commit

Permalink
fix(app/checkout): improving link to external auth with already set e…
Browse files Browse the repository at this point in the history
…mail

allow in-page call with global sign in functions
  • Loading branch information
leomp12 committed May 2, 2024
1 parent f6d2b32 commit b28fa04
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
15 changes: 13 additions & 2 deletions @ecomplus/storefront-app/src/components/html/EcCheckout.html
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,21 @@ <h3>
:customer-email.sync="customerEmail"
:can-fetch-oauth="!isExternalAuth"
>
<template v-if="isExternalAuth" v-slot:login-methods="{ confirmAccount }">
<template v-if="isExternalAuth" v-slot:login-methods="{ email, confirmAccount }">
<p v-if="confirmAccount()">
Ou entre com
<a href="/app/account#/checkout">link de acesso por e-mail</a>
<template v-if="externalAuthEmailLinkSignIn">
<a href="#" @click.prevent="externalAuthEmailLinkSignIn()">
link de acesso por e-mail</a>
<span v-if="externalAuthGoogleSignIn"> /
<a href="#" @click.prevent="externalAuthGoogleSignIn()">
Login do Google</a>
</span>
</template>
<template v-else>
<a :href="`/app/account?email=${encodeURIComponent(email)}#/checkout`">
link de acesso por e-mail</a>
</template>
</p>
</template>
</login-block>
Expand Down
14 changes: 14 additions & 0 deletions @ecomplus/storefront-app/src/components/js/EcCheckout.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,20 @@ export default {
}
})
return key
},

externalAuthEmailLinkSignIn () {
if (this.isExternalAuth && window.signInWithEmailLink) {
return window.signInWithEmailLink
}
return null
},

externalAuthGoogleSignIn () {
if (this.isExternalAuth && window.signInWithGoogle) {
return window.signInWithGoogle
}
return null
}
},

Expand Down

0 comments on commit b28fa04

Please sign in to comment.