Skip to content

Commit

Permalink
Domain hint (#73)
Browse files Browse the repository at this point in the history
* update login_hint and add support for domain_hint

* put domain_hint behind dev flag
  • Loading branch information
rohanharikr authored Oct 21, 2024
1 parent ec77684 commit 31453b5
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,15 @@
custom: ''
},
pi_params: {
passkeys: 'global'
passkeys: 'global',
domain_hint: ''
},
required: ['client_id', 'redirect_uri', 'nonce', 'response_type']
};
const protocolParamsPlaceholders = {
login_hint: '[email protected]',
domain_hint: 'example.com'
};
const inviteQueryParams = {
params: {
Expand Down Expand Up @@ -1091,10 +1096,13 @@
states.protocol_param_values.response_mode === 'query' &&
states.protocol_params.includes('response_type') &&
states.protocol_param_values.response_type === 'id_token') ||
//login_hint should start with mailto:
//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_param_values.login_hint.startsWith('mailto:'))}
states.protocol_params.includes('domain_hint')) ||
(param === 'domain_hint' &&
states.protocol_params.includes('domain_hint') &&
states.protocol_params.includes('login_hint'))}
>
{param}
{required ? '*' : ''}
Expand Down Expand Up @@ -1161,7 +1169,7 @@
>
<input
type="text"
placeholder={param === 'login_hint' ? 'mailto:[email protected]' : ''}
placeholder={protocolParamsPlaceholders[param]}
name={param}
class="h-6 px-2 w-full form-input"
autocomplete="off"
Expand Down

0 comments on commit 31453b5

Please sign in to comment.