Skip to content

Commit

Permalink
remove account, update domain_hint logic (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
rohanharikr authored Oct 22, 2024
1 parent 31453b5 commit 78adcfe
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,7 @@
const queryParams = {
params: {
provider_hint: '',
account: ['personal', 'managed']
provider_hint: ''
},
required: []
};
Expand All @@ -182,18 +181,17 @@
state: '',
prompt: ['consent', 'login'],
login_hint: '',
domain_hint: '',
scope: '',
custom: ''
},
pi_params: {
passkeys: 'global',
domain_hint: ''
passkeys: 'global'
},
required: ['client_id', 'redirect_uri', 'nonce', 'response_type']
};
const protocolParamsPlaceholders = {
login_hint: '[email protected]',
domain_hint: 'example.com'
login_hint: '[email protected]'
};
const inviteQueryParams = {
Expand Down Expand Up @@ -230,8 +228,7 @@
invite_query_params: ['inviter', 'client_id', 'initiate_login_uri', 'return_uri'],
invite_playground_query_params: ['inviter', 'client_id', 'initiate_login_uri', 'return_uri'],
query_param_values: {
...queryParams.params,
account: 'managed'
...queryParams.params
},
protocol_param_values: {
...protocolParams.params,
Expand Down Expand Up @@ -1060,7 +1057,9 @@
<span class="pt-0.5 block" />
{/if}
<li
class="flex items-center relative {param === 'custom'
class="flex {param === 'domain_hint'
? 'items-start'
: 'items-center'} relative {param === 'custom'
? 'pt-4 border-t border-charcoal/30 dark:border-white/20'
: ''}"
>
Expand Down Expand Up @@ -1096,13 +1095,20 @@
states.protocol_param_values.response_mode === 'query' &&
states.protocol_params.includes('response_type') &&
states.protocol_param_values.response_type === 'id_token') ||
//login_hint and domain_hint can both be provided if domain_hint is not a domain (IE it is personal or managed)
//if both domain_hint and login_hint are checked (only one is valid at a time)
(param === 'login_hint' &&
states.protocol_params.includes('login_hint') &&
states.protocol_params.includes('domain_hint')) ||
states.protocol_params.includes('domain_hint') &&
!['personal', 'managed'].includes(
states.protocol_param_values.domain_hint
)) ||
(param === 'domain_hint' &&
states.protocol_params.includes('domain_hint') &&
states.protocol_params.includes('login_hint'))}
states.protocol_params.includes('login_hint') &&
!['personal', 'managed'].includes(
states.protocol_param_values.domain_hint
))}
>
{param}
{required ? '*' : ''}
Expand Down Expand Up @@ -1180,6 +1186,10 @@
/>
</div>
{/if}
{#if param === 'domain_hint'}
<p class="text-xs mt-1.5 opacity-80">personal managed domain.example</p>
{/if}
</div>
</li>
{/each}
Expand Down Expand Up @@ -1224,7 +1234,6 @@
<div
class="w-1/2 md:w-1/4 flex-shrink-0 md:min-w-[10rem] flex items-center"
class:mt-6={param === 'client_id'}
class:mt-1={param === 'provider_hint'}
>
<input
type="checkbox"
Expand Down

0 comments on commit 78adcfe

Please sign in to comment.