diff --git a/app/guid-node/addons/index/template.hbs b/app/guid-node/addons/index/template.hbs
index ce9b67e0977..7ff56a37dca 100644
--- a/app/guid-node/addons/index/template.hbs
+++ b/app/guid-node/addons/index/template.hbs
@@ -82,8 +82,8 @@
/>
{{#if account.displayName}}
{{account.displayName}}
- {{else if (not account.credentialsAvailable)}}
- {{t 'addons.accountSelect.unauthenticated-account'}}
+ {{else}}
+ {{t 'addons.accountSelect.unnamed-account'}}
{{/if}}
@@ -128,6 +128,7 @@
{{else if (eq manager.pageMode 'confirm')}}
diff --git a/lib/osf-components/addon/components/addons-service/addon-account-setup/component.ts b/lib/osf-components/addon/components/addons-service/addon-account-setup/component.ts
index caeafc663a5..91586890fa7 100644
--- a/lib/osf-components/addon/components/addons-service/addon-account-setup/component.ts
+++ b/lib/osf-components/addon/components/addons-service/addon-account-setup/component.ts
@@ -238,7 +238,8 @@ export default class AddonAccountSetupComponent extends Component {
@task
@waitFor
async checkOauthSuccess() {
- const oauthSuccesful = await taskFor(this.args.manager.oauthFlowRefocus).perform(this.newAccount!);
+ const accountToCheck = this.args.account || this.newAccount;
+ const oauthSuccesful = await taskFor(this.args.manager.oauthFlowRefocus).perform(accountToCheck!);
if (oauthSuccesful) {
this.pendingOauth = false;
document.removeEventListener('visibilitychange', this.onVisibilityChange);
@@ -267,17 +268,16 @@ export default class AddonAccountSetupComponent extends Component {
async startOauthReconnectFlow() {
const { account } = this.args;
if (account) {
- account.initiateOauth = true;
- account.displayName = this.displayName;
- await account.save(); // returned account should have authUrl
+ if (!account.authUrl) {
+ account.initiateOauth = true;
+ account.displayName = this.displayName;
+ await account.save(); // returned account should have authUrl
+ }
+
if (account.authUrl) {
- const oauthWindow = window.open(account.authUrl, '_blank');
- if (oauthWindow) {
- document.addEventListener('visibilitychange', this.onVisibilityChange);
- this.pendingOauth = true;
- } else {
- this.toast.error(this.intl.t('addons.accountCreate.oauth-window-blocked'));
- }
+ this.pendingOauth = true;
+ window.open(account.authUrl, '_blank');
+ document.addEventListener('visibilitychange', this.onVisibilityChange);
} else {
this.toast.error(this.intl.t('addons.accountCreate.oauth-reconnect-error'));
}
diff --git a/lib/osf-components/addon/components/addons-service/addon-account-setup/template.hbs b/lib/osf-components/addon/components/addons-service/addon-account-setup/template.hbs
index 00f33d2e67f..a2c450405e8 100644
--- a/lib/osf-components/addon/components/addons-service/addon-account-setup/template.hbs
+++ b/lib/osf-components/addon/components/addons-service/addon-account-setup/template.hbs
@@ -12,7 +12,7 @@
data-test-start-oauth-button
data-analytics-name='Start OAuth'
@target='_blank'
- @href={{this.newAccount.authUrl}}
+ @href={{if @account @account.authUrl this.newAccount.authUrl}}
>
{{t 'addons.accountCreate.oauth-start'}}
diff --git a/lib/osf-components/addon/components/addons-service/manager/component.ts b/lib/osf-components/addon/components/addons-service/manager/component.ts
index 4797aa1032c..1b60bd7e735 100644
--- a/lib/osf-components/addon/components/addons-service/manager/component.ts
+++ b/lib/osf-components/addon/components/addons-service/manager/component.ts
@@ -171,7 +171,11 @@ export default class AddonsServiceManagerComponent extends Component {
@action
authorizeSelectedAccount() {
- this.pageMode = PageMode.CONFIRM;
+ if (this.selectedAccount && this.selectedAccount.credentialsAvailable) {
+ this.pageMode = PageMode.CONFIRM;
+ } else {
+ this.pageMode = PageMode.ACCOUNT_CREATE;
+ }
}
@task
diff --git a/translations/en-us.yml b/translations/en-us.yml
index 93299dd5e31..85941078e2c 100644
--- a/translations/en-us.yml
+++ b/translations/en-us.yml
@@ -306,7 +306,7 @@ addons:
new-account: 'Setup new account'
reconnect-account: 'Reconnect account'
existing-account: 'Choose existing account'
- unauthenticated-account: 'Unconnected account'
+ unnamed-account: 'Unnamed account'
accountCreate:
display-name-label: 'Display name'
display-name-placeholder: 'Account name'