-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
883e027
commit 9aa5fcf
Showing
21 changed files
with
86 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,50 @@ | ||
<?php | ||
|
||
/** | ||
* @link https://www.humhub.org/ | ||
* @copyright Copyright (c) 2020 HumHub GmbH & Co. KG | ||
* @license https://www.humhub.com/licences | ||
* | ||
*/ | ||
|
||
namespace humhub\modules\twofa\controllers; | ||
|
||
use humhub\modules\admin\permissions\ManageModules; | ||
use humhub\modules\admin\components\Controller; | ||
use humhub\modules\twofa\helpers\TwofaHelper; | ||
use humhub\modules\twofa\models\Config; | ||
use Yii; | ||
|
||
class ConfigController extends Controller | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public function getAccessRules() | ||
{ | ||
return [['permissions' => ManageModules::class]]; | ||
} | ||
|
||
/** | ||
* Configuration action for system admins. | ||
*/ | ||
public function actionIndex() | ||
{ | ||
$model = new Config(); | ||
|
||
if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
$this->view->saved(); | ||
} | ||
|
||
$ip = Yii::$app->request->userIP; | ||
if ($ip !== Yii::$app->request->remoteIP) { | ||
$ip .= ', ' . Yii::$app->request->remoteIP; | ||
} | ||
|
||
return $this->render('module', [ | ||
'model' => $model, | ||
'defaultDriverName' => TwofaHelper::getDriverByClassName($model->module->defaultDriver)->name, | ||
'ip' => $ip, | ||
]); | ||
} | ||
} | ||
<?php | ||
|
||
/** | ||
* @link https://www.humhub.org/ | ||
* @copyright Copyright (c) 2020 HumHub GmbH & Co. KG | ||
* @license https://www.humhub.com/licences | ||
* | ||
*/ | ||
|
||
namespace humhub\modules\twofa\controllers; | ||
|
||
use humhub\modules\admin\permissions\ManageModules; | ||
use humhub\modules\admin\components\Controller; | ||
use humhub\modules\twofa\helpers\TwofaHelper; | ||
use humhub\modules\twofa\models\Config; | ||
use Yii; | ||
|
||
class ConfigController extends Controller | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public function getAccessRules() | ||
{ | ||
return [['permissions' => ManageModules::class]]; | ||
} | ||
|
||
/** | ||
* Configuration action for system admins. | ||
*/ | ||
public function actionIndex() | ||
{ | ||
$model = new Config(); | ||
|
||
if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
$this->view->saved(); | ||
} | ||
|
||
$ip = Yii::$app->request->userIP; | ||
if ($ip !== Yii::$app->request->remoteIP) { | ||
$ip .= ', ' . Yii::$app->request->remoteIP; | ||
} | ||
|
||
return $this->render('module', [ | ||
'model' => $model, | ||
'defaultDriverName' => TwofaHelper::getDriverByClassName($model->module->defaultDriver)->name, | ||
'ip' => $ip, | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,6 @@ | |
*/ | ||
class UserSettings extends Model | ||
{ | ||
|
||
/** | ||
* @var Module | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<?php | ||
|
||
return \tests\codeception\_support\HumHubTestConfiguration::getSuiteConfig('unit'); | ||
return \tests\codeception\_support\HumHubTestConfiguration::getSuiteConfig('unit'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,5 +10,5 @@ | |
'fixtures' => [ | ||
'default', | ||
//'twofa' => \tests\codeception\fixtures\TwofaFixture::class | ||
] | ||
], | ||
]; |