Skip to content

Commit

Permalink
Add user extension
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Mühl committed Jan 3, 2018
1 parent ccd153e commit 47c6ee7
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 7 deletions.
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
"require": {
"robthree/twofactorauth": "^1.6"
},
"license": "LGPL-3.0",
"autoload": {
"psr-4": {
"DieSchittigs\\TwoFactorAuth\\": "src/"
}
},
"authors": [
{
"name": "Christopher Mühl",
"email": "[email protected]"
}
],
"license": "LGPL-3.0",
"autoload": {
"psr-4": {
"DieSchittigs\\TwoFactorAuth\\": "src/"
}
},
"extra": {
"contao-manager-plugin": "DieSchittigs\\TwoFactorAuthBundle\\ContaoManager\\Plugin"
"contao-manager-plugin": "DieSchittigs\\TwoFactorAuth\\ContaoManager\\Plugin"
}
}
22 changes: 22 additions & 0 deletions src/ContaoManager/Plugin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace DieSchittigs\TwoFactorAuth\ContaoManager;

use Contao\ManagerPlugin\Bundle\Config\BundleConfig;
use Contao\ManagerPlugin\Bundle\BundlePluginInterface;
use Contao\ManagerPlugin\Bundle\Parser\ParserInterface;
use DieSchittigs\TwoFactorAuth\TwoFactorAuthBundle;

class Plugin implements BundlePluginInterface
{
/**
* {@inheritdoc}
*/
public function getBundles(ParserInterface $parser)
{
return [
BundleConfig::create('DieSchittigs\TwoFactorAuth\TwoFactorAuthBundle')
->setLoadAfter(['Contao\CoreBundle\ContaoCoreBundle'])
];
}
}
20 changes: 20 additions & 0 deletions src/DependencyInjection/TwoFactorAuthExtension.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace DieSchittigs\TwoFactorAuth\DependencyInjection;

use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\Config\FileLocator;

class TwoFactorAuthExtension extends Extension
{
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('parameters.yml');
}
}
Empty file.
5 changes: 5 additions & 0 deletions src/Resources/contao/config/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php


var_dump("hi");
die();
12 changes: 12 additions & 0 deletions src/Resources/contao/dca/tl_user.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

$GLOBALS['TL_DCA']['tl_user']['fields']['tfaSecret'] = [
'label' => '2FA Secret',
'exclude' => true,
'sql' => "varchar(64) NOT NULL default ''"
];

$GLOBALS['TL_DCA']['tl_user']['palettes']['admin'] .= ',tfaSecret';

var_dump($GLOBALS['TL_DCA']['tl_user']);
die();
17 changes: 17 additions & 0 deletions src/TwoFactorAuthBundle.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace DieSchittigs\TwoFactorAuth;

use Symfony\Component\HttpKernel\Bundle\Bundle;
use DieSchittigs\TwoFactorAuth\DependencyInjection\TwoFactorAuthExtension;

class TwoFactorAuthBundle extends Bundle
{
/**
* {@inheritdoc}
*/
public function getContainerExtension()
{
return new TwoFactorAuthExtension();
}
}

0 comments on commit 47c6ee7

Please sign in to comment.