Skip to content

Commit f4513a2

Browse files
dpageclaude
andcommitted
Allow any Font Awesome style for the OAuth2 button icon. #7641
The login page hardcoded the 'fab' (brands) Font Awesome style for the OAuth2 button icon, so non-brand icons could not be used. Use the configured OAUTH2_ICON as-is when it already specifies a style class (e.g. 'fas fa-key'), and fall back to 'fab' when only an icon name is given, preserving backward compatibility. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 5dc3a5a commit f4513a2

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

‎docs/en_US/oauth2.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ and secure.
6363
"OAUTH2_API_BASE_URL", "Oauth2 base URL endpoint to make requests simple, ex: *https://api.github.com/*"
6464
"OAUTH2_USERINFO_ENDPOINT", "User Endpoint, ex: *user* (for github, or *user/emails* if the user's email address is private) and *userinfo* (for google). **For OIDC providers**, this is optional if the ID token contains sufficient claims (email, preferred_username, or sub)."
6565
"OAUTH2_SCOPE", "Oauth scope, ex: 'openid email profile'. **For OIDC providers**, include 'openid' scope to receive an ID token."
66-
"OAUTH2_ICON", "The Font-awesome icon to be placed on the oauth2 button, ex: fa-github"
66+
"OAUTH2_ICON", "The Font Awesome icon to be placed on the oauth2 button. A brand icon name (e.g. fa-github) uses the brands style by default; to use another style, include the style class explicitly (e.g. 'fas fa-key')."
6767
"OAUTH2_BUTTON_COLOR", "Oauth2 button color"
6868
"OAUTH2_USERNAME_CLAIM", "The claim which is used for the username. If the value is empty, **for OIDC providers** pgAdmin will use: 1) email, 2) preferred_username, or 3) sub (in that order). **For OAuth2 providers** without OIDC, email is required. Ex: *oid* (for AzureAD), *email* (for Github), *preferred_username* (for Keycloak)"
6969
"OAUTH2_AUTO_CREATE_USER", "Set the value to *True* if you want to automatically

‎docs/en_US/release_notes_9_16.rst‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Bundled PostgreSQL Utilities
2020
New features
2121
************
2222

23+
| `Issue #7641 <https://github.com/pgadmin-org/pgadmin4/issues/7641>`_ - Allow the OAuth2 login button icon to use any Font Awesome style (e.g. ``fas fa-key``), not only brand icons.
24+
2325
Housekeeping
2426
************
2527

‎web/pgadmin/static/js/SecurityPages/LoginPage.jsx‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,16 @@ export default function LoginPage({userLanguage, langOptions, forgotPassUrl, csr
4646
}
4747
{authSources?.includes?.(authSourcesEnum.OAUTH2) &&
4848
oauth2Config.map((oauth)=>{
49+
// Allow the configured icon to specify its own Font Awesome style
50+
// (e.g. 'fas fa-key'). Default to the brands style ('fab') when
51+
// only an icon name is given, for backward compatibility.
52+
const iconStyles = ['fab', 'fas', 'far', 'fal', 'fat', 'fad',
53+
'fa-brands', 'fa-solid', 'fa-regular', 'fa-light', 'fa-thin', 'fa-duotone'];
54+
const hasStyle = oauth.OAUTH2_ICON?.split(/\s+/).some((c)=>iconStyles.includes(c));
55+
const iconClassName = hasStyle ? oauth.OAUTH2_ICON : 'fab '+oauth.OAUTH2_ICON;
4956
return (
5057
<SecurityButton key={oauth.OAUTH2_NAME} name="oauth2_button" value={oauth.OAUTH2_NAME} style={{backgroundColor: oauth.OAUTH2_BUTTON_COLOR}}>
51-
<Icon className={'fab '+oauth.OAUTH2_ICON} style={{ fontSize: '1.5em', marginRight: '8px' }} />{gettext('Login with %s', oauth.OAUTH2_DISPLAY_NAME)}
58+
<Icon className={iconClassName} style={{ fontSize: '1.5em', marginRight: '8px' }} />{gettext('Login with %s', oauth.OAUTH2_DISPLAY_NAME)}
5259
</SecurityButton>
5360
);
5461
})

0 commit comments

Comments
 (0)