From b680784f66911e2ffdfbbd00b1a13bcd7e16d9c6 Mon Sep 17 00:00:00 2001 From: Lorenzo Milesi Date: Thu, 22 Sep 2022 11:17:46 +0200 Subject: [PATCH] php-cs-fixer run --- src/User/Controller/SettingsController.php | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/User/Controller/SettingsController.php b/src/User/Controller/SettingsController.php index 4cdb8d7..7d476f3 100644 --- a/src/User/Controller/SettingsController.php +++ b/src/User/Controller/SettingsController.php @@ -454,14 +454,14 @@ class SettingsController extends Controller public function actionTwoFactor($id) { - if(!$this->module->enableTwoFactorAuthentication){ - throw new ForbiddenHttpException(Yii::t('usuario','Application not configured for two factor authentication.')); + if (!$this->module->enableTwoFactorAuthentication) { + throw new ForbiddenHttpException(Yii::t('usuario', 'Application not configured for two factor authentication.')); } - if($id != Yii::$app->user->id) { + if ($id != Yii::$app->user->id) { throw new ForbiddenHttpException(); - } - + } + $choice = Yii::$app->request->post('choice'); /** @var User $user */ $user = $this->userQuery->whereId($id)->one(); @@ -489,10 +489,10 @@ class SettingsController extends Controller public function actionTwoFactorEnable($id) { - if(!$this->module->enableTwoFactorAuthentication){ - throw new ForbiddenHttpException(Yii::t('usuario','Application not configured for two factor authentication.')); + if (!$this->module->enableTwoFactorAuthentication) { + throw new ForbiddenHttpException(Yii::t('usuario', 'Application not configured for two factor authentication.')); } - + Yii::$app->response->format = Response::FORMAT_JSON; /** @var User $user */ @@ -525,14 +525,14 @@ class SettingsController extends Controller public function actionTwoFactorDisable($id) { - if(!$this->module->enableTwoFactorAuthentication){ - throw new ForbiddenHttpException(Yii::t('usuario','Application not configured for two factor authentication.')); + if (!$this->module->enableTwoFactorAuthentication) { + throw new ForbiddenHttpException(Yii::t('usuario', 'Application not configured for two factor authentication.')); } - - if($id != Yii::$app->user->id) { + + if ($id != Yii::$app->user->id) { throw new ForbiddenHttpException(); } - + /** * @var User $user */ @@ -542,7 +542,7 @@ class SettingsController extends Controller throw new NotFoundHttpException(); } - if ($user->updateAttributes(['auth_tf_enabled' => '0', 'auth_tf_key' => NULL])) { + if ($user->updateAttributes(['auth_tf_enabled' => '0', 'auth_tf_key' => null])) { Yii::$app ->getSession() ->setFlash('success', Yii::t('usuario', 'Two factor authentication has been disabled.'));