fix(TwoFactorAuthenticationEnforceFilter.php): use $user variable instead 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
This commit is contained in:
@ -40,7 +40,7 @@ class TwoFactorAuthenticationEnforceFilter extends ActionFilter
|
|||||||
$permissions = $module->twoFactorAuthenticationForcedPermissions;
|
$permissions = $module->twoFactorAuthenticationForcedPermissions;
|
||||||
|
|
||||||
$user = Yii::$app->user->identity;
|
$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) {
|
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'));
|
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();
|
return Yii::$app->response->redirect(['/user/settings/account'])->send();
|
||||||
|
|||||||
@ -83,8 +83,7 @@ class MailService implements ServiceInterface
|
|||||||
*/
|
*/
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
|
$result = $this->mailer
|
||||||
$result = $this->mailer
|
|
||||||
->compose(['html' => $this->view, 'text' => "text/{$this->view}"], $this->params)
|
->compose(['html' => $this->view, 'text' => "text/{$this->view}"], $this->params)
|
||||||
->setFrom($this->from)
|
->setFrom($this->from)
|
||||||
->setTo($this->to)
|
->setTo($this->to)
|
||||||
|
|||||||
Reference in New Issue
Block a user