Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 2, 2025

The SEMAPHORE_PASSWORD_LOGIN_DISABLED=true environment variable was not working as expected - instead of disabling the login form entirely, it was showing an email-based login form as a fallback.

Problem

When users set SEMAPHORE_PASSWORD_LOGIN_DISABLED=true (typically for OIDC/LDAP-only environments), they expected the login form to be completely disabled. However, the frontend was showing an email login form instead:

Before (incorrect behavior):

  • SEMAPHORE_PASSWORD_LOGIN_DISABLED=true → Shows email login form
  • Users had no way to disable all login forms for OIDC-only setups

Root Cause

The frontend logic assumed that when password login is disabled, email login should be shown as a fallback. However, email authentication is controlled by a separate configuration (SEMAPHORE_EMAIL_2TP_ENABLED) that wasn't being exposed to the frontend.

Solution

Backend changes:

  • Added login_with_email field to the /api/auth/login response
  • Properly check util.Config.Auth.Email.Enabled status

Frontend changes:

  • Updated Auth.vue to check both loginWithPassword and loginWithEmail settings
  • Show email form only when loginWithEmail is explicitly true
  • Show no login forms when both authentication methods are disabled

Behavior After Fix

Configuration Result
Default Shows username/password form
SEMAPHORE_PASSWORD_LOGIN_DISABLED=true Shows no login forms
SEMAPHORE_PASSWORD_LOGIN_DISABLED=true + SEMAPHORE_EMAIL_2TP_ENABLED=true Shows email form only

API Changes

The fix adds one field to the login metadata response:

{
  "oidc_providers": [],
  "login_with_password": false,
  "login_with_email": false,
  "auth_methods": {}
}

This change is backward compatible - existing clients will ignore the new field.

Screenshots

Fixed behavior - Password login disabled:
No login forms shown

Email authentication when explicitly enabled:
Email form when configured

Fixes #3225.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 2 commits September 2, 2025 20:32
- Add login_with_email field to login metadata API response
- Update frontend to check both password and email authentication settings
- Only show email form when explicitly enabled via SEMAPHORE_EMAIL_2TP_ENABLED
- Show no login forms when both password and email auth are disabled
- Fix divider display logic to only show when login forms are present

Co-authored-by: fiftin <[email protected]>
@Copilot Copilot AI changed the title [WIP] Problem: login form not disabled Fix SEMAPHORE_PASSWORD_LOGIN_DISABLED to properly disable login forms Sep 2, 2025
@Copilot Copilot AI requested a review from fiftin September 2, 2025 20:41
Copilot finished work on behalf of fiftin September 2, 2025 20:41
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.

Problem: login form not disabled
2 participants