An illegal choice has been detected

Created on 16 February 2022, almost 3 years ago
Updated 20 February 2023, almost 2 years ago

Problem/Motivation
When logging out all users except Admin, I get the "illegal choice" error. The logs don't tell me much: "Illegal choice 1 in This setting will force logout all users except admin element."
Using Drupal 8.9. Current dev version of the module produces the same error.

Steps to reproduce

  1. Install the module
  2. Go to the Role Based User Logout (All Other Users) Configuration /admin/config/force-users-logout/otheruserslogout
  3. Select the "This setting will force logout all users except admin" checkbox
  4. Click on Force Logout
  5. You will notice the error "An illegal choice has been detected. Please contact the site administrator."
🐛 Bug report
Status

Needs work

Version

2.0

Component

User interface

Created by

🇺🇸United States ex DJ

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇳India arunkumark Coimbatore

    The illegal choice issue is due to the ConfigFormBase and Checkbox #option. The issues has been addressed in the Merge request.

    📌 Remove unwanted codes and replace relevant classes Needs review

    https://git.drupalcode.org/project/force_users_logout/-/merge_requests/1...

  • Status changed to Needs review almost 2 years ago
  • Status changed to Needs work almost 2 years ago
  • 🇺🇸United States kreynen

    I think this fixes the issue in that users with only the authenticated user role do not generate an error... but they aren't logged out either.

    Testing this is simple. With the patched module installed, create a user with no additional roles called test-user. Log into Drupal with test-user.

    In another browser, log in as an admin user with permission to admin/config/force-users-logout/otheruserslogout. Check the checkbox next to `This setting will force logout all users except admin` and submit the form by clicking the Force Logout button.

    Go back to the browser where you are logged in with the authenticated test-user. You will still be logged in.

    Now add test-user to a role. As the admin user, run admin/config/force-users-logout/otheruserslogout again.

    The test-user is now logged out.

    The underlying issue remains. Users with just the authenticated user role really have no role. They are simply authenticated.

    This module is using roles to get the list of users to log out instead of logging out everyone except the current user.

  • 🇲🇸Montserrat eloivaque Catalan Countries

    Reroll patch with 2.0.1 version.

Production build 0.71.5 2024