Skip to content

Commit

Permalink
Merge pull request #8644 from ccci-code/patch-1
Browse files Browse the repository at this point in the history
Update AccountForm.vue so Reconnect button works for Microsoft accounts
  • Loading branch information
ChristophWurst authored Jul 2, 2024
2 parents fefd2a7 + e4b4102 commit b194763
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions src/components/AccountForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,11 @@ export default {
return this.loadingMessage ?? t('mail', 'Connecting')
}
if (this.mode === 'manual' && this.useOauth) {
return this.account ? t('mail', 'Reconnect Google account') : t('mail', 'Sign in with Google')
if (this.isGoogleAccount) {
return this.account ? t('mail', 'Reconnect Google account') : t('mail', 'Sign in with Google')
} else {
return this.account ? t('mail', 'Reconnect Microsoft account') : t('mail', 'Sign in with Microsoft')
}
}
return this.account ? t('mail', 'Save') : t('mail', 'Connect')
},
Expand Down Expand Up @@ -561,16 +565,16 @@ export default {
const account = await this.$store.dispatch('startAccountSetup', data)
if (this.useOauth) {
this.loadingMessage = t('mail', 'Awaiting user consent')
this.feedback = t('mail', 'Account created. Please follow the pop-up instructions to link your Google account')
try {
if (this.isGoogleAccount) {
this.feedback = t('mail', 'Account created. Please follow the pop-up instructions to link your Google account')
await getUserConsent(
this.googleOauthUrl
.replace('_accountId_', account.id)
.replace('_email_', encodeURIComponent(account.emailAddress)),
)
} else {
// Microsoft
this.feedback = t('mail', 'Account created. Please follow the pop-up instructions to link your Microsoft account')
await getUserConsent(
this.microsoftOauthUrl
.replace('_accountId_', account.id)
Expand All @@ -596,13 +600,22 @@ export default {
})
if (this.useOauth) {
this.loadingMessage = t('mail', 'Awaiting user consent')
this.feedback = t('mail', 'Account updated. Please follow the pop-up instructions to reconnect your Google account')
try {
await getUserConsent(
this.googleOauthUrl
.replace('_accountId_', account.id)
.replace('_email_', encodeURIComponent(account.emailAddress)),
)
if (this.isGoogleAccount) {
this.feedback = t('mail', 'Account updated. Please follow the pop-up instructions to reconnect your Google account')
await getUserConsent(
this.googleOauthUrl
.replace('_accountId_', account.id)
.replace('_email_', encodeURIComponent(account.emailAddress)),
)
} else {
this.feedback = t('mail', 'Account updated. Please follow the pop-up instructions to reconnect your Microsoft account')
await getUserConsent(
this.microsoftOauthUrl
.replace('_accountId_', account.id)
.replace('_email_', encodeURIComponent(account.emailAddress)),
)
}
} catch (e) {
// Undo changes
await this.$store.dispatch('updateAccount', {
Expand Down

0 comments on commit b194763

Please sign in to comment.