Merge branch 'develop' into feature/524_cant_scan_qrcode_fix
This commit is contained in:
2
.github/workflows/php.yml
vendored
2
.github/workflows/php.yml
vendored
@ -18,7 +18,7 @@ jobs:
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
mariadb:
|
mariadb:
|
||||||
image: mariadb:latest
|
image: mariadb:10
|
||||||
ports:
|
ports:
|
||||||
- 3306:3306
|
- 3306:3306
|
||||||
env:
|
env:
|
||||||
|
|||||||
@ -2,8 +2,11 @@
|
|||||||
|
|
||||||
## dev
|
## dev
|
||||||
|
|
||||||
|
- Fix: Two Factor Authentication - Filter - Blocks even when two factor authentication is enabled
|
||||||
- Fix: update Dutch (nl) translations (squio)
|
- Fix: update Dutch (nl) translations (squio)
|
||||||
- Enh: possibility to limit the depth of the recursion when getting user ids from roles (mp1509)
|
- Enh: possibility to limit the depth of the recursion when getting user ids from roles (mp1509)
|
||||||
|
- Fix: UserSearch avoid fields name conflict if joined with other tables (liviuk2)
|
||||||
|
- Fix: PasswordExpireService return false when user model attribute "password_changed_at" is already set at null.
|
||||||
|
|
||||||
## 1.6.1 March 4th, 2023
|
## 1.6.1 March 4th, 2023
|
||||||
|
|
||||||
|
|||||||
@ -38,8 +38,10 @@ class TwoFactorAuthenticationEnforceFilter extends ActionFilter
|
|||||||
}
|
}
|
||||||
|
|
||||||
$permissions = $module->twoFactorAuthenticationForcedPermissions;
|
$permissions = $module->twoFactorAuthenticationForcedPermissions;
|
||||||
$itemsByUser = array_keys($this->getAuthManager()->getItemsByUser(Yii::$app->user->identity->id));
|
|
||||||
if (!empty(array_intersect($permissions, $itemsByUser))) {
|
$user = Yii::$app->user->identity;
|
||||||
|
$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'));
|
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();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,9 @@
|
|||||||
|
|
||||||
namespace Da\User\Search;
|
namespace Da\User\Search;
|
||||||
|
|
||||||
|
use Da\User\Model\User;
|
||||||
use Da\User\Query\UserQuery;
|
use Da\User\Query\UserQuery;
|
||||||
|
use Da\User\Traits\ContainerAwareTrait;
|
||||||
use Yii;
|
use Yii;
|
||||||
use yii\base\InvalidParamException;
|
use yii\base\InvalidParamException;
|
||||||
use yii\base\Model;
|
use yii\base\Model;
|
||||||
@ -19,6 +21,8 @@ use yii\data\ActiveDataProvider;
|
|||||||
|
|
||||||
class UserSearch extends Model
|
class UserSearch extends Model
|
||||||
{
|
{
|
||||||
|
use ContainerAwareTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
@ -106,21 +110,23 @@ class UserSearch extends Model
|
|||||||
return $dataProvider;
|
return $dataProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$userClass = $this->getClassMap()->get(User::class);
|
||||||
|
|
||||||
if ($this->created_at !== null) {
|
if ($this->created_at !== null) {
|
||||||
$date = strtotime($this->created_at);
|
$date = strtotime($this->created_at);
|
||||||
$query->andFilterWhere(['between', 'created_at', $date, $date + 3600 * 24]);
|
$query->andFilterWhere(['between', $userClass::tableName().'.created_at', $date, $date + 3600 * 24]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->last_login_at !== null) {
|
if ($this->last_login_at !== null) {
|
||||||
$date = strtotime($this->last_login_at);
|
$date = strtotime($this->last_login_at);
|
||||||
$query->andFilterWhere(['between', 'last_login_at', $date, $date + 3600 * 24]);
|
$query->andFilterWhere(['between', $userClass::tableName().'.last_login_at', $date, $date + 3600 * 24]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$query
|
$query
|
||||||
->andFilterWhere(['like', 'username', $this->username])
|
->andFilterWhere(['like', $userClass::tableName().'.username', $this->username])
|
||||||
->andFilterWhere(['like', 'email', $this->email])
|
->andFilterWhere(['like', $userClass::tableName().'.email', $this->email])
|
||||||
->andFilterWhere(['registration_ip' => $this->registration_ip])
|
->andFilterWhere([$userClass::tableName().'.registration_ip' => $this->registration_ip])
|
||||||
->andFilterWhere(['last_login_ip' => $this->last_login_ip]);
|
->andFilterWhere([$userClass::tableName().'.last_login_ip' => $this->last_login_ip]);
|
||||||
|
|
||||||
return $dataProvider;
|
return $dataProvider;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -83,11 +83,16 @@ class MailService implements ServiceInterface
|
|||||||
*/
|
*/
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
return $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)
|
||||||
->setSubject($this->subject)
|
->setSubject($this->subject)
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
|
if (!$result) {
|
||||||
|
Yii::error("Email sending failed to '{$this->to}'.", 'mailer');
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,8 +25,9 @@ class PasswordExpireService implements ServiceInterface
|
|||||||
|
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
return $this->model->updateAttributes([
|
$this->model->updateAttributes([
|
||||||
'password_changed_at' => null,
|
'password_changed_at' => null,
|
||||||
]);
|
]);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -111,6 +111,6 @@ class TwoFactorEmailValidator extends TwoFactorCodeValidator
|
|||||||
*/
|
*/
|
||||||
public function generateCode()
|
public function generateCode()
|
||||||
{
|
{
|
||||||
return $this->make(TwoFactorEmailCodeGeneratorService::class, $this->user)->run();
|
return $this->make(TwoFactorEmailCodeGeneratorService::class, [$this->user])->run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user