From 74d735367c83eb49714a72b045c10bde454d52eb Mon Sep 17 00:00:00 2001 From: mlm483 <128052931+mlm483@users.noreply.github.com> Date: Tue, 25 Feb 2025 12:40:59 -0500 Subject: [PATCH 1/2] [BI-2539] - added Sign In with GitHub support --- .env.development | 1 + src/assets/scss/main.scss | 8 ++- src/components/layouts/InfoSideBarLayout.vue | 34 ++++++++++ src/views/account/AccountSignUp.vue | 69 +++++++++++++++----- vue.config.js | 1 + 5 files changed, 95 insertions(+), 18 deletions(-) diff --git a/.env.development b/.env.development index 60d1d1189..0f1ee0ecf 100644 --- a/.env.development +++ b/.env.development @@ -18,3 +18,4 @@ VUE_APP_BI_REFERENCE_SOURCE=${BRAPI_REFERENCE_SOURCE} # feature flags VUE_APP_BRAPI_VENDOR_SUBMISSION_ENABLED=${BRAPI_VENDOR_SUBMISSION_ENABLED} +VUE_APP_ALTERNATE_AUTHENTICATION_ENABLED=${VUE_APP_ALTERNATE_AUTHENTICATION_ENABLED} \ No newline at end of file diff --git a/src/assets/scss/main.scss b/src/assets/scss/main.scss index 66397d521..4ccf9e0a3 100644 --- a/src/assets/scss/main.scss +++ b/src/assets/scss/main.scss @@ -579,6 +579,10 @@ table tr.is-edited + .detail { margin-bottom: 7em; } +.githubBtn { + margin: 1em auto; +} + .program-selection-level { .level-item:not(:last-child) { margin-right:0.5em !important; @@ -621,7 +625,7 @@ a.is-underlined { text-decoration: underline; } -#connect-orcid-button{ +#connect-orcid-button #connect-github-button { border: 1px solid #D3D3D3; padding: .3em; background-color: #fff; @@ -635,7 +639,7 @@ a.is-underlined { vertical-align: middle; } -#connect-orcid-button:hover{ +#connect-orcid-button:hover #connect-github-button:hover { border: 1px solid #338caf; color: #338caf; } diff --git a/src/components/layouts/InfoSideBarLayout.vue b/src/components/layouts/InfoSideBarLayout.vue index 6b1442f09..147a4bee7 100644 --- a/src/components/layouts/InfoSideBarLayout.vue +++ b/src/components/layouts/InfoSideBarLayout.vue @@ -128,6 +128,19 @@
To access to your breeding program, please log in.
+To acknowledge that you have used your iD and that it has been authenticated, we display the ORCID iD icon @@ -188,6 +202,7 @@ public isLoginModalActive: boolean = false; public isLoginServerErrorModalActive: boolean = false; public loginProcessing: boolean = false; + public githubLoginProcessing: boolean = false; private orcidLogoUrl: string = 'https://orcid.org/sites/default/files/images/orcid_24x24.png'; @Prop() public loginRedirect!: boolean; @@ -231,9 +246,28 @@ window.location.href = process.env.VUE_APP_BI_API_ROOT+'/sso/start'; } + async githubLogin() { + // Check the server can be contacted + this.githubLoginProcessing = true; + try { + await ServerManagementService.checkHealth(); + } catch (error) { + this.isLoginServerErrorModalActive = true; + this.githubLoginProcessing = false; + return; + } + + // Start login process + window.location.href = process.env.VUE_APP_BI_API_ROOT+'/sso/start/github'; + } + get sandboxConfig() { return process.env.VUE_APP_SANDBOX; } + alternateAuthenticationEnabled() { + return process.env.VUE_APP_ALTERNATE_AUTHENTICATION_ENABLED === 'true'; } + + } diff --git a/src/views/account/AccountSignUp.vue b/src/views/account/AccountSignUp.vue index 8b2f77a94..8ae5fbf88 100644 --- a/src/views/account/AccountSignUp.vue +++ b/src/views/account/AccountSignUp.vue @@ -27,23 +27,37 @@
To activate your account, please log in.
-