11<script setup lang="ts">
22import axios , { type AxiosError } from " axios" ;
3- import { BAlert , BButton , BForm , BFormCheckbox , BFormGroup } from " bootstrap-vue" ;
3+ import { BAlert , BButton , BButtonGroup , BForm , BFormCheckbox , BFormGroup } from " bootstrap-vue" ;
44import { computed , onMounted , ref } from " vue" ;
55import Multiselect from " vue-multiselect" ;
66
@@ -45,7 +45,7 @@ const messageVariant = ref<string | null>(null);
4545const cILogonIdps = ref <Idp []>([]);
4646const selected = ref <Idp | null >(null );
4747const rememberIdp = ref (false );
48- const cilogonOrCustos = ref <string | null >(null );
48+ const cilogonOrCustos = ref <" cilogon " | " custos " | null >(null );
4949const toggleCilogon = ref (false );
5050
5151const oIDCIdps = computed <OIDCConfig >(() => (isConfigLoaded .value ? config .value .oidc : {}));
@@ -77,8 +77,10 @@ onMounted(async () => {
7777 }
7878});
7979
80- function toggleCILogon(idp : string ) {
81- toggleCilogon .value = ! toggleCilogon .value ;
80+ function toggleCILogon(idp : " cilogon" | " custos" ) {
81+ if (cilogonOrCustos .value === idp || cilogonOrCustos .value === null ) {
82+ toggleCilogon .value = ! toggleCilogon .value ;
83+ }
8284 cilogonOrCustos .value = toggleCilogon .value ? idp : null ;
8385}
8486
@@ -227,13 +229,23 @@ function getIdpPreference() {
227229 </div >
228230
229231 <div v-else >
230- <BButton v-if =" cILogonEnabled" @click =" toggleCILogon('cilogon')" >
231- Sign in with Institutional Credentials*
232- </BButton >
232+ <BButtonGroup class =" w-100" >
233+ <BButton
234+ v-if =" cILogonEnabled"
235+ :pressed =" cilogonOrCustos === 'cilogon'"
236+ @click =" toggleCILogon('cilogon')" >
237+ Sign in with Institutional Credentials*
238+ </BButton >
233239
234- <BButton v-if =" custosEnabled" @click =" toggleCILogon('custos')" >Sign in with Custos*</BButton >
240+ <BButton
241+ v-if =" custosEnabled"
242+ :pressed =" cilogonOrCustos === 'custos'"
243+ @click =" toggleCILogon('custos')" >
244+ Sign in with Custos*
245+ </BButton >
246+ </BButtonGroup >
235247
236- <BFormGroup v-if =" toggleCilogon" >
248+ <BFormGroup v-if =" toggleCilogon" class = " mt-1 " >
237249 <Multiselect
238250 v-model =" selected"
239251 placeholder =" Select your institution"
@@ -246,9 +258,10 @@ function getIdpPreference() {
246258
247259 <BButton
248260 v-if =" toggleCilogon"
261+ class =" mt-1"
249262 :disabled =" loading || selected === null"
250263 @click =" submitCILogon(cilogonOrCustos)" >
251- Login*
264+ Login via {{ cilogonOrCustos === "cilogon" ? "CILogon" : "Custos" }} *
252265 </BButton >
253266 </BFormGroup >
254267 </div >
0 commit comments