diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bc038b..0512a3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,8 +9,8 @@ look forward and maintain only >=7.4 versions. There's a change in flash messages handling, please see #391 -- Ehn: update welcome and confirmation email ending line (maxxer) -- Ehn #361: Record and manage user session history (maranqz) +- Enh: update welcome and confirmation email ending line (maxxer) +- Enh #361: Record and manage user session history (maranqz) - Fix: replace non-working travis build with working github actions build (TonisOrmisson) - Fix: user login events not triggered on ajax requests (TonisOrmisson) - Enh: Added minimum requirements when a new password is automatically generated (MatteoF96) @@ -22,14 +22,15 @@ There's a change in flash messages handling, please see #391 - Enh: Added SK translations (snickom) - Fix: allow `password_changed_at` to be saved when reseting password (p4blojf) - Fix #430: Moved `EVENT_BEFORE_PROFILE_UPDATE` to correct place (eluhr) -- Ehn #456: Added filter to allow forcing 2FA for specific user roles (acordeddu) -- Ehn #412: Allow role names to support UTF-8 chars (4khobta) -- Ehn #448: Remove deprecated SwiftMailer, use SymfonyMailer instead (TonisOrmisson) -- Ehn #428: Translations of the placeholders in the login widget (anapaulaxenon) +- Enh #456: Added filter to allow forcing 2FA for specific user roles (acordeddu) +- Enh #412: Allow role names to support UTF-8 chars (4khobta) +- Enh #448: Remove deprecated SwiftMailer, use SymfonyMailer instead (TonisOrmisson) +- Enh #428: Translations of the placeholders in the login widget (anapaulaxenon) - Update PHP-CS-Fixer configuration to new version (maxxer) - Fix #391: Always create flash messages, allow `enableFlashMessages` only to dictate display (ajmedway) -- Ehn #458: Multiple 2FA channels (email, sms) (acordeddu) +- Enh #458: Multiple 2FA channels (email, sms) (acordeddu) - Fix #432: Fix documentation overlap by shortening page names (cgsmith) +- Enh #472: implement module viewPath in all views instead of static file reference (tonisormisson) ## 1.5.1 April 5, 2020 @@ -60,8 +61,8 @@ There's a change in flash messages handling, please see #391 - Fix #209: Doc fix. allowAccountDelete default value is false (Dezinger) - Fix #211: Migration boolean default value set to FALSE instead 0 (Dezinger) - Fix #213: Migration sql syntax fix (Dezinger) -- Ehn #131: 2FA libraries now optional (maxxer) -- Ehn #187: Add GDPR features (Eseperio) +- Enh #131: 2FA libraries now optional (maxxer) +- Enh #187: Add GDPR features (Eseperio) - Enh #184: Add `last-login-ip` capture capability (kartik-v) - Enh: Changed `View::render()` calls in views to use absolute paths (ajmedway) - Fix #169: Fix bug in ReCaptchaComponent (BuTaMuH) diff --git a/src/User/Controller/AbstractAuthItemController.php b/src/User/Controller/AbstractAuthItemController.php index 4b49465..76b01af 100644 --- a/src/User/Controller/AbstractAuthItemController.php +++ b/src/User/Controller/AbstractAuthItemController.php @@ -74,6 +74,7 @@ abstract class AbstractAuthItemController extends Controller [ 'searchModel' => $searchModel, 'dataProvider' => $searchModel->search(Yii::$app->request->get()), + 'module' => $this->module ] ); } @@ -101,6 +102,7 @@ abstract class AbstractAuthItemController extends Controller [ 'model' => $model, 'unassignedItems' => $this->authHelper->getUnassignedItems($model), + 'module' => $this->module ] ); } @@ -130,6 +132,7 @@ abstract class AbstractAuthItemController extends Controller [ 'model' => $model, 'unassignedItems' => $this->authHelper->getUnassignedItems($model), + 'module' => $this->module ] ); } diff --git a/src/User/Controller/AdminController.php b/src/User/Controller/AdminController.php index b76c090..05b1ca2 100755 --- a/src/User/Controller/AdminController.php +++ b/src/User/Controller/AdminController.php @@ -128,6 +128,7 @@ class AdminController extends Controller [ 'dataProvider' => $dataProvider, 'searchModel' => $searchModel, + 'module' => $this->module ] ); } @@ -178,7 +179,10 @@ class AdminController extends Controller } } - return $this->render('_account', ['user' => $user]); + return $this->render('_account', [ + 'user' => $user, + 'module' => $this->module + ]); } public function actionUpdateProfile($id) @@ -211,6 +215,7 @@ class AdminController extends Controller [ 'user' => $user, 'profile' => $profile, + 'module' => $this->module ] ); } @@ -224,6 +229,7 @@ class AdminController extends Controller '_info', [ 'user' => $user, + 'module' => $this->module ] ); } @@ -238,6 +244,7 @@ class AdminController extends Controller [ 'user' => $user, 'params' => Yii::$app->request->post(), + 'module' => $this->module ] ); } @@ -372,6 +379,7 @@ class AdminController extends Controller 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'user' => $user, + 'module' => $this->module ]); } diff --git a/src/User/Controller/RuleController.php b/src/User/Controller/RuleController.php index 4797f6a..f3a5f2c 100644 --- a/src/User/Controller/RuleController.php +++ b/src/User/Controller/RuleController.php @@ -67,6 +67,7 @@ class RuleController extends Controller [ 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, + 'module' => $this->module ] ); } @@ -89,7 +90,8 @@ class RuleController extends Controller return $this->render( 'create', [ - 'model' => $model + 'model' => $model, + 'module' => $this->module ] ); } @@ -104,7 +106,7 @@ class RuleController extends Controller [ 'previousName' => $name, 'name' => $rule->name, - 'className' => get_class($rule) + 'className' => get_class($rule), ] ); @@ -123,6 +125,7 @@ class RuleController extends Controller 'update', [ 'model' => $model, + 'module' => $this->module ] ); } diff --git a/src/User/Service/MailService.php b/src/User/Service/MailService.php index a0dfd0d..39b52ee 100644 --- a/src/User/Service/MailService.php +++ b/src/User/Service/MailService.php @@ -12,13 +12,16 @@ namespace Da\User\Service; use Da\User\Contracts\ServiceInterface; +use Da\User\Traits\ModuleAwareTrait; use Yii; use yii\mail\BaseMailer; use yii\mail\MailerInterface; class MailService implements ServiceInterface { - protected $viewPath = '@Da/User/resources/views/mail'; + use ModuleAwareTrait; + + protected $viewPath = ''; protected $type; protected $from; @@ -48,6 +51,7 @@ class MailService implements ServiceInterface $this->view = $view; $this->params = $params; $this->mailer = $mailer; + $this->viewPath = $this->getModule()->viewPath . '/mail'; $this->mailer->setViewPath($this->viewPath); $this->mailer->getView()->theme = Yii::$app->view->theme; } diff --git a/src/User/Widget/LoginWidget.php b/src/User/Widget/LoginWidget.php index f4d2a54..df5729e 100644 --- a/src/User/Widget/LoginWidget.php +++ b/src/User/Widget/LoginWidget.php @@ -12,17 +12,22 @@ namespace Da\User\Widget; use Da\User\Form\LoginForm; +use Da\User\Traits\ModuleAwareTrait; use Yii; use yii\base\Widget; +/** + * @deprecated this seems to be unused by this module. To be deleted in future! + */ class LoginWidget extends Widget { + use ModuleAwareTrait; public $validate = true; public function run() { return $this->render( - '@Da/User/resources/views/widgets/login/form', + $this->getModule()->$this->viewPath .'/widgets/login/form', [ 'model' => Yii::createObject(LoginForm::class), ] diff --git a/src/User/resources/views/admin/_account.php b/src/User/resources/views/admin/_account.php index e9d49e8..7b44021 100644 --- a/src/User/resources/views/admin/_account.php +++ b/src/User/resources/views/admin/_account.php @@ -14,10 +14,11 @@ use yii\helpers\Html; /** @var yii\web\View $this */ /** @var Da\User\Model\User $user */ +/** @var \Da\User\Module $module */ ?> -beginContent('@Da/User/resources/views/admin/update.php', ['user' => $user]) ?> +beginContent($module->viewPath. '/admin/update.php', ['user' => $user]) ?> -beginContent('@Da/User/resources/views/admin/update.php', ['user' => $user]) ?> +beginContent($module->viewPath. '/admin/update.php', ['user' => $user]) ?> = yii\bootstrap\Alert::widget( [ diff --git a/src/User/resources/views/admin/_info.php b/src/User/resources/views/admin/_info.php index 1b929e7..a2de143 100644 --- a/src/User/resources/views/admin/_info.php +++ b/src/User/resources/views/admin/_info.php @@ -11,10 +11,11 @@ /** @var yii\web\View $this */ /** @var Da\User\Model\User $user */ +/** @var \Da\User\Module $module */ ?> -beginContent('@Da/User/resources/views/admin/update.php', ['user' => $user]) ?> +beginContent($module->viewPath. '/admin/update.php', ['user' => $user]) ?>