Problem/Motivation
The TfaTrustedBrowser plugin form is showing on the TFA screen even when disabled.
Steps to reproduce
Have empty login_plugins key in config, i.e:
login_plugins: { }
login_plugin_settings:
tfa_trusted_browser:
cookie_allow_subdomains: true
cookie_expiration: 30
cookie_name: tfa-trusted-browser
Setup TFA for an account, login and see that the trusted browser checkbox is visible.
Proposed resolution
Only apply plugins that are explicitly enabled.
Remaining tasks
Code
Tests
Review
Commit
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | Screenshot 2022-12-09 at 4.51.46 PM.png | 136.97 KB | ankitv18 |
| #10 | interdiff-3319595-8-10.txt | 5.37 KB | acbramley |
| #10 | 3319595-10.patch | 9.21 KB | acbramley |
Issue fork tfa-3319595
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3319595-login-plugins-are
changes, plain diff MR !20
Comments
Comment #2
acbramley commentedWorking on the fix
Comment #3
acbramley commentedHere's the first part - skipping forms for plugins that aren't enabled. Second part is skipping the actual check for disabled plugins.
Comment #5
acbramley commentedSlight bug here - needed to wrap left side in brackets, fixed in new patch.
Comment #8
acbramley commentedSubdir fix.
Comment #9
jcnventuraIt would be cleaner the move the active plugin check into the getLoginDefinitions code, and add a parameter to those functions that allows to get definitions of all plugins or only the acrive ones.
Ideally, the default would be to get only the active plugins, and the patch will need to change the TFA settings form to use the parameter to get also the inactive plugins.
This will prevent a few more bugs like this from showing up in the future.
Comment #10
acbramley commentedRefactored as per #9 also removed the config check from TfaOverviewForm
Comment #11
jcnventuraComment #12
martijn de witGot same issue where new features in 2.x branch are always enabled.
Patch applies good and works in our situation
+1 RTBC
Comment #15
ankitv18 commentedHi,
Patch#10 is cleanly applied with 2.x-dev branch
I also have opened a MR!20 wrt patch#10, added empty line at the end in tfa.services.yml
+1 RTBC
Comment #16
thatguy commentedThe patch installs cleanly but I get the error below when I go to the module configuration page at /admin/config/people/tfa
"ArgumentCountError: Too few arguments to function Drupal\tfa\TfaPluginManager::__construct(), 3 passed in /app/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 262 and exactly 4 expected in Drupal\tfa\TfaPluginManager->__construct() (line 35 of modules/contrib/tfa/src/TfaPluginManager.php). "
Comment #17
jcnventura@thatguy, you need to clear caches after applying the patch to not have that error. Drupal is still using the previous definition of the tfa.services.yml file.
Comment #18
thatguy commentedYep cache clear fixed it, should already maybe know to try it when something doesn't work :D
Patch seems to fix the issue!
Comment #20
jcnventura