Skip to content

Commit

Permalink
fix(TwoFactorAuthenticationEnforceFilter.php): use $user variable ins…
Browse files Browse the repository at this point in the history
…tead of accessing Yii::$app->user->identity multiple times for better readability and performance

fix(MailService.php): remove unnecessary whitespace before $this->mailer to improve code formatting
  • Loading branch information
deadmantfa committed Sep 24, 2023
1 parent 40a76b1 commit 4b1536f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/User/Filter/TwoFactorAuthenticationEnforceFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function beforeAction($action)
$permissions = $module->twoFactorAuthenticationForcedPermissions;

$user = Yii::$app->user->identity;
$itemsByUser = array_keys($this->getAuthManager()->getItemsByUser(Yii::$app->user->identity->id));
$itemsByUser = array_keys($this->getAuthManager()->getItemsByUser($user->id));
if (!empty(array_intersect($permissions, $itemsByUser)) && !$user->auth_tf_enabled) {
Yii::$app->session->setFlash('warning', Yii::t('usuario', 'Your role requires 2FA, you won\'t be able to use the application until you enable it'));
return Yii::$app->response->redirect(['/user/settings/account'])->send();
Expand Down
3 changes: 1 addition & 2 deletions src/User/Service/MailService.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ public function getType()
*/
public function run()
{

$result = $this->mailer
$result = $this->mailer
->compose(['html' => $this->view, 'text' => "text/{$this->view}"], $this->params)
->setFrom($this->from)
->setTo($this->to)
Expand Down

0 comments on commit 4b1536f

Please sign in to comment.