php-cs-fixer run

This commit is contained in:
Lorenzo Milesi
2022-09-22 11:17:46 +02:00
parent b4ba918a45
commit b680784f66

View File

@ -454,14 +454,14 @@ class SettingsController extends Controller
public function actionTwoFactor($id) public function actionTwoFactor($id)
{ {
if(!$this->module->enableTwoFactorAuthentication){ if (!$this->module->enableTwoFactorAuthentication) {
throw new ForbiddenHttpException(Yii::t('usuario','Application not configured for two factor authentication.')); 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(); throw new ForbiddenHttpException();
} }
$choice = Yii::$app->request->post('choice'); $choice = Yii::$app->request->post('choice');
/** @var User $user */ /** @var User $user */
$user = $this->userQuery->whereId($id)->one(); $user = $this->userQuery->whereId($id)->one();
@ -489,10 +489,10 @@ class SettingsController extends Controller
public function actionTwoFactorEnable($id) public function actionTwoFactorEnable($id)
{ {
if(!$this->module->enableTwoFactorAuthentication){ if (!$this->module->enableTwoFactorAuthentication) {
throw new ForbiddenHttpException(Yii::t('usuario','Application not configured for two factor authentication.')); throw new ForbiddenHttpException(Yii::t('usuario', 'Application not configured for two factor authentication.'));
} }
Yii::$app->response->format = Response::FORMAT_JSON; Yii::$app->response->format = Response::FORMAT_JSON;
/** @var User $user */ /** @var User $user */
@ -525,14 +525,14 @@ class SettingsController extends Controller
public function actionTwoFactorDisable($id) public function actionTwoFactorDisable($id)
{ {
if(!$this->module->enableTwoFactorAuthentication){ if (!$this->module->enableTwoFactorAuthentication) {
throw new ForbiddenHttpException(Yii::t('usuario','Application not configured for two factor authentication.')); 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(); throw new ForbiddenHttpException();
} }
/** /**
* @var User $user * @var User $user
*/ */
@ -542,7 +542,7 @@ class SettingsController extends Controller
throw new NotFoundHttpException(); 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 Yii::$app
->getSession() ->getSession()
->setFlash('success', Yii::t('usuario', 'Two factor authentication has been disabled.')); ->setFlash('success', Yii::t('usuario', 'Two factor authentication has been disabled.'));