Okta sign in is broken for Dark Mode users

In Decouple dark color mode from navigation themes (!141459 - merged), Dark Mode (theme 11) was removed as a valid theme. This broke Okta sign in.

Screenshot_2024-03-07_at_14.52.20

The diff is below. Since Theme 11 is no longer in available_themes, valid_ids excludes it.

module Gitlab
  # Module containing GitLab's application theme definitions and helper methods
  # for accessing them.
  module Themes
...
    # All available Themes
    def available_themes
      [
        Theme.new(1, s_('NavigationTheme|Indigo'), 'ui-indigo', '#222261'),
        Theme.new(6, s_('NavigationTheme|Light Indigo'), 'ui-light-indigo', '#41419f'),
        Theme.new(4, s_('NavigationTheme|Blue'), 'ui-blue', '#0b2640'),
        Theme.new(7, s_('NavigationTheme|Light Blue'), 'ui-light-blue', '#145aa1'),
        Theme.new(5, s_('NavigationTheme|Green'), 'ui-green', '#0e4328'),
        Theme.new(8, s_('NavigationTheme|Light Green'), 'ui-light-green', '#1b653f'),
        Theme.new(9, s_('NavigationTheme|Red'), 'ui-red', '#580d02'),
        Theme.new(10, s_('NavigationTheme|Light Red'), 'ui-light-red', '#a02e1c'),
        Theme.new(2, s_('NavigationTheme|Gray'), 'ui-gray', '#333238'),
--      Theme.new(3, s_('NavigationTheme|Light Gray'), 'ui-light-gray', '#ececef'),
--      Theme.new(11, s_('NavigationTheme|Dark Mode (alpha)'), 'gl-dark', '#1f1e24')
++      Theme.new(3, s_('NavigationTheme|Neutral'), 'ui-neutral', '#ececef')
      ]
    end

...

    def self.valid_ids
      available_themes.map(&:id)
    end

I'm guessing since the Okta flow wants to validate the user, the following validation is run:

# frozen_string_literal: true

require 'carrierwave/orm/activerecord'

class User < MainClusterwide::ApplicationRecord
...
  validates :theme_id, allow_nil: true, inclusion: { in: Gitlab::Themes.valid_ids,
                                                     message: ->(*) { _("%{placeholder} is not a valid theme") % { placeholder: '%{value}' } } }

Steps to reproduce

  1. Use Dark Mode as a theme
  2. Sign out / clear all cookies
  3. Sign in to Okta
  4. Click the GitLab tile
  5. Observe that you can't sign in, with the error message Theme 11 is not a valid theme

Workaround

You can navigate to GitLab.com and sign in with your GitLab username and password.

Edited by Nick Malcolm