Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
email_tfa
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
email_tfa
Commits
8500e50b
Commit
8500e50b
authored
7 months ago
by
abdulaziz zaid
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3485953
by sarwan_verma, will_frank, riddhi.addweb, abdulaziz zaid: Drupal 11 Compatibility
parent
7939429b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
email_tfa.info.yml
+1
-1
1 addition, 1 deletion
email_tfa.info.yml
src/Form/EmailTfaConfigForm.php
+12
-3
12 additions, 3 deletions
src/Form/EmailTfaConfigForm.php
with
13 additions
and
4 deletions
email_tfa.info.yml
+
1
−
1
View file @
8500e50b
name
:
Email TFA
description
:
Provide An Email TFA for users after login.
core_version_requirement
:
^9 || ^10
core_version_requirement
:
^9 || ^10
|| ^11
package
:
Security
type
:
module
configure
:
email_tfa.settings
This diff is collapsed.
Click to expand it.
src/Form/EmailTfaConfigForm.php
+
12
−
3
View file @
8500e50b
...
...
@@ -3,11 +3,14 @@
namespace
Drupal\email_tfa\Form
;
use
Drupal\Core\Config\ConfigFactoryInterface
;
use
Drupal\Core\Config\TypedConfigManagerInterface
;
use
Drupal\Core\Extension\ModuleHandlerInterface
;
use
Drupal\Core\Form\ConfigFormBase
;
use
Drupal\Core\Form\FormStateInterface
;
use
Drupal\Core\Site\Settings
;
use
Drupal\user\RoleInterface
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
use
Drupal\user\Entity\Role
;
/**
* Class TfaConfigForm settings.
...
...
@@ -23,8 +26,8 @@ class EmailTfaConfigForm extends ConfigFormBase {
/**
* {@inheritdoc}
*/
public
function
__construct
(
ConfigFactoryInterface
$config_factory
,
ModuleHandlerInterface
$module_handler
)
{
parent
::
__construct
(
$config_factory
);
public
function
__construct
(
ConfigFactoryInterface
$config_factory
,
TypedConfigManagerInterface
$typedConfigManager
,
ModuleHandlerInterface
$module_handler
)
{
parent
::
__construct
(
$config_factory
,
$typedConfigManager
);
$this
->
moduleHandler
=
$module_handler
;
}
...
...
@@ -34,6 +37,7 @@ class EmailTfaConfigForm extends ConfigFormBase {
public
static
function
create
(
ContainerInterface
$container
)
{
return
new
static
(
$container
->
get
(
'config.factory'
),
$container
->
get
(
'config.typed'
),
$container
->
get
(
'module_handler'
)
);
}
...
...
@@ -141,7 +145,12 @@ class EmailTfaConfigForm extends ConfigFormBase {
];
// Load all roles.
$roles
=
user_role_names
(
TRUE
);
$roles
=
Role
::
loadMultiple
();
$roles
=
array_map
(
function
(
$role
)
{
return
$role
->
label
();
},
$roles
);
// remove anonymous role.
unset
(
$roles
[
RoleInterface
::
ANONYMOUS_ID
]);
$form
[
'email_tfa_settings'
][
'settings'
][
'ignore_role'
]
=
[
'#type'
=>
'checkboxes'
,
'#title'
=>
$this
->
t
(
'Roles'
),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment