-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
31 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:bug | ||
ui: Fix OIDC provider logo showing when domain doesn't match | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,30 @@ | ||
import Model, { attr } from '@ember-data/model'; | ||
import { computed } from '@ember/object'; | ||
import parseURL from 'core/utils/parse-url'; | ||
|
||
const DOMAIN_STRINGS = { | ||
github: 'GitHub', | ||
gitlab: 'GitLab', | ||
google: 'Google', | ||
ping: 'Ping', | ||
okta: 'Okta', | ||
auth0: 'Auth0', | ||
'github.com': 'GitHub', | ||
'gitlab.com': 'GitLab', | ||
'google.com': 'Google', | ||
'ping.com': 'Ping', | ||
'okta.com': 'Okta', | ||
'auth0.com': 'Auth0', | ||
}; | ||
|
||
const PROVIDER_WITH_LOGO = ['GitLab', 'Google', 'Auth0']; | ||
|
||
export { DOMAIN_STRINGS, PROVIDER_WITH_LOGO }; | ||
|
||
export default Model.extend({ | ||
authUrl: attr('string'), | ||
export default class RoleJwtModel extends Model { | ||
@attr('string') authUrl; | ||
|
||
providerName: computed('authUrl', function () { | ||
get providerName() { | ||
const { hostname } = parseURL(this.authUrl); | ||
const firstMatch = Object.keys(DOMAIN_STRINGS).find((name) => hostname.includes(name)); | ||
return DOMAIN_STRINGS[firstMatch] || null; | ||
}), | ||
} | ||
|
||
providerButtonComponent: computed('providerName', function () { | ||
get providerButtonComponent() { | ||
const { providerName } = this; | ||
return PROVIDER_WITH_LOGO.includes(providerName) ? `auth-button-${providerName.toLowerCase()}` : null; | ||
}), | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters