Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 21, 2026

Adds support for customizing OAuth login button display based on identity provider. When set to 'Microsoft', shows Microsoft logo and localized text. Otherwise displays generic text with provider name.

Changes

Configuration (src/config.sample.php):

// OAuth Provider Name
$authProvider = 'Microsoft';  // or 'Google', 'Authentik', etc.

Login Page (login/index.php):

  • Conditional rendering: Microsoft logo SVG + "Iniciar Sessão com Microsoft" when $authProvider === 'Microsoft'
  • Generic text "Iniciar Sessão com Fornecedor de Identidade {provider}" for other providers
  • XSS protection via htmlspecialchars() on provider name

Visual Changes

Microsoft Provider:
Microsoft

Non-Microsoft Provider (e.g., Google):
Google

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/PHPMailer/PHPMailer/zipball/360ae911ce62e25e11249f6140fa58939f556ebe
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/87ijFi /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/guzzle/guzzle/zipball/b51ac707cfa420b7bfd4e4d5e510ba8008e822b4
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/yKYxlO /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/87ijFi /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/guzzle/promises/zipball/481557b130ef3790cf82b713667b43030dc9c957
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/yKYxlO /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/87ijFi /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/guzzle/psr7/zipball/21dc724a0583619cd1652f673303492272778051
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/yKYxlO /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/87ijFi /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/yKYxlO /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/87ijFi /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/yKYxlO /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/87ijFi /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/yKYxlO /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/87ijFi /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/yKYxlO /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/87ijFi /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/yKYxlO /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/87ijFi /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/thephpleague/oauth2-client/zipball/26e8c5da4f3d78cede7021e09b1330a0fc093d5e
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/87ijFi /usr/bin/composer install --no-interaction --prefer-dist (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

OAuth2 allows multiple types of providers. Add a new variable over at config.php, $authProvider. If set to 'Microsoft', you will load the Microsoft logo onto the sign on button, and it will say "Iniciar Sessão com Microsoft", as it already says. If it's not 'Microsoft', the Microsoft logo won't be loaded, and it will say "Iniciar Sessão com Fornecedor de Identidade $authProvider".

Do not document any of your changes to a text file or a .MD file, do so via the PR you are going to create, or via the chat of the agent session.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: marpisco <162377105+marpisco@users.noreply.github.com>
Copilot AI changed the title [WIP] Add authProvider variable for flexible login options Add configurable OAuth provider branding via $authProvider Jan 21, 2026
Copilot AI requested a review from marpisco January 21, 2026 16:07
@marpisco marpisco marked this pull request as ready for review January 21, 2026 16:36
Copilot AI review requested due to automatic review settings January 21, 2026 16:36
Copy link
Member

@marpisco marpisco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds configurable OAuth provider branding to the ClassLink login screen. It introduces a new configuration variable $authProvider that controls the visual appearance of the login button. When set to 'Microsoft', the button displays the Microsoft logo with localized Portuguese text. For other providers, it shows generic text with the provider name.

Changes:

  • Added $authProvider configuration variable in config.sample.php
  • Implemented conditional rendering of provider-specific branding in the login page
  • Applied XSS protection to provider names using htmlspecialchars()

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/config.sample.php Added $authProvider configuration variable and updated comments to Portuguese
login/index.php Implemented conditional rendering for Microsoft logo/text vs. generic provider text with proper XSS protection


// OAuth 2.0 configuration
// SECURITY: Keep clientId and clientSecret confidential
// Configuração do fornecedor OAuth2

This comment was marked as resolved.

Comment on lines +567 to +574
if (isset($authProvider) && $authProvider === 'Microsoft') {
echo "<style>";
echo ".login-btn:hover .ms-rect1 { fill: #f25022; }";
echo ".login-btn:hover .ms-rect2 { fill: #7fba00; }";
echo ".login-btn:hover .ms-rect3 { fill: #00a4ef; }";
echo ".login-btn:hover .ms-rect4 { fill: #ffb900; }";
echo "</style>";
}

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants