From 3ba01b4674fd92898008430d9ddbbfed012c3f23 Mon Sep 17 00:00:00 2001 From: Antonio Ramirez Date: Wed, 14 Dec 2016 02:50:12 +0100 Subject: [PATCH] fix formatting --- lib/User/AuthClient/Facebook.php | 5 +- lib/User/AuthClient/GitHub.php | 5 +- lib/User/AuthClient/Google.php | 5 +- lib/User/AuthClient/LinkedIn.php | 5 +- lib/User/AuthClient/Twitter.php | 5 +- lib/User/AuthClient/VKontakte.php | 9 ++-- lib/User/AuthClient/Yandex.php | 7 +-- lib/User/Bootstrap.php | 43 ++++++++-------- lib/User/Command/ConfirmController.php | 10 ++-- lib/User/Command/CreateController.php | 8 +-- lib/User/Command/DeleteController.php | 7 +-- lib/User/Command/PasswordController.php | 7 +-- lib/User/Component/AuthDbManagerComponent.php | 12 ++--- lib/User/Contracts/AuthClientInterface.php | 1 + lib/User/Contracts/AuthManagerInterface.php | 9 ++-- .../Contracts/MailChangeStrategyInterface.php | 1 + lib/User/Contracts/ServiceInterface.php | 1 + lib/User/Contracts/StrategyInterface.php | 1 + lib/User/Contracts/ValidatorInterface.php | 1 + .../Controller/AbstractAuthItemController.php | 25 +++++----- lib/User/Controller/AdminController.php | 21 +++----- lib/User/Controller/PermissionController.php | 9 ++-- lib/User/Controller/ProfileController.php | 14 +++--- lib/User/Controller/RecoveryController.php | 22 ++++----- .../Controller/RegistrationController.php | 26 +++++----- lib/User/Controller/RoleController.php | 8 +-- lib/User/Controller/SecurityController.php | 17 +++---- lib/User/Controller/SettingsController.php | 17 +++---- lib/User/Event/FormEvent.php | 2 +- lib/User/Event/ProfileEvent.php | 3 +- lib/User/Event/ResetPasswordEvent.php | 2 +- lib/User/Event/SocialNetworkAuthEvent.php | 2 +- lib/User/Event/SocialNetworkConnectEvent.php | 2 +- lib/User/Event/UserEvent.php | 2 +- lib/User/Factory/AuthItemFactory.php | 4 +- .../Factory/EmailChangeStrategyFactory.php | 6 +-- lib/User/Factory/MailFactory.php | 22 +++++---- lib/User/Factory/TokenFactory.php | 5 +- lib/User/Filter/AccessRuleFilter.php | 3 +- lib/User/Form/LoginForm.php | 17 ++++--- lib/User/Form/RecoveryForm.php | 11 +++-- lib/User/Form/RegistrationForm.php | 9 ++-- lib/User/Form/ResendForm.php | 7 +-- lib/User/Form/SettingsForm.php | 7 ++- lib/User/Helper/AuthHelper.php | 3 +- lib/User/Helper/ClassMapHelper.php | 9 ++-- lib/User/Helper/GravatarHelper.php | 3 +- lib/User/Helper/SecurityHelper.php | 4 +- lib/User/Helper/TimezoneHelper.php | 8 +-- .../m000000_000001_create_user_table.php | 3 +- .../m000000_000002_create_profile_table.php | 3 +- ...000_000003_create_social_account_table.php | 3 +- .../m000000_000004_create_token_table.php | 3 +- lib/User/Model/AbstractAuthItem.php | 11 +++-- lib/User/Model/Assignment.php | 14 +++--- lib/User/Model/Permission.php | 1 + lib/User/Model/Profile.php | 20 ++++---- lib/User/Model/Role.php | 2 +- lib/User/Model/SocialNetworkAccount.php | 16 +++--- lib/User/Model/Token.php | 19 ++++--- lib/User/Model/User.php | 49 ++++++++++--------- lib/User/Module.php | 33 +++++++------ lib/User/Query/ProfileQuery.php | 1 + lib/User/Query/SocialNetworkAccountQuery.php | 3 +- lib/User/Query/TokenQuery.php | 1 + lib/User/Query/UserQuery.php | 1 - lib/User/Search/AbstractAuthItemSearch.php | 4 +- lib/User/Search/PermissionSearch.php | 4 +- lib/User/Search/RoleSearch.php | 3 +- lib/User/Search/UserSearch.php | 8 +-- .../Service/AccountConfirmationService.php | 4 +- lib/User/Service/AuthItemEditionService.php | 5 +- lib/User/Service/EmailChangeService.php | 9 ++-- lib/User/Service/MailService.php | 11 +++-- lib/User/Service/PasswordRecoveryService.php | 3 +- .../Service/ResendConfirmationService.php | 5 +- lib/User/Service/ResetPasswordService.php | 8 ++- .../SocialNetworkAccountConnectService.php | 10 ++-- .../SocialNetworkAuthenticateService.php | 8 ++- .../Service/UpdateAuthAssignmentsService.php | 3 +- lib/User/Service/UserBlockService.php | 6 ++- lib/User/Service/UserConfirmationService.php | 4 +- lib/User/Service/UserCreateService.php | 5 +- lib/User/Service/UserRegisterService.php | 12 ++--- .../Strategy/DefaultEmailChangeStrategy.php | 4 +- .../Strategy/InsecureEmailChangeStrategy.php | 4 +- .../Strategy/SecureEmailChangeStrategy.php | 6 +-- lib/User/Traits/AuthManagerTrait.php | 5 +- lib/User/Traits/ContainerTrait.php | 12 ++--- lib/User/Traits/ModuleTrait.php | 1 - .../Validator/AjaxRequestModelValidator.php | 5 +- lib/User/Validator/RbacItemsValidator.php | 2 +- lib/User/Validator/RbacRuleValidator.php | 1 + lib/User/Validator/TimeZoneValidator.php | 2 +- lib/User/Widget/AssignmentsWidget.php | 15 +++--- lib/User/Widget/ConnectWidget.php | 8 +-- lib/User/Widget/LoginWidget.php | 3 +- lib/User/resources/i18n/message.php | 4 +- lib/User/resources/views/admin/_account.php | 2 +- .../resources/views/admin/_assignments.php | 2 +- lib/User/resources/views/admin/_info.php | 2 +- lib/User/resources/views/admin/_profile.php | 2 +- lib/User/resources/views/admin/_user.php | 4 +- lib/User/resources/views/admin/create.php | 8 +-- lib/User/resources/views/admin/index.php | 6 +-- lib/User/resources/views/admin/update.php | 8 +-- .../resources/views/mail/confirmation.php | 2 +- .../resources/views/mail/layouts/html.php | 2 +- .../resources/views/mail/layouts/text.php | 2 +- .../resources/views/mail/reconfirmation.php | 2 +- lib/User/resources/views/mail/recovery.php | 2 +- .../views/mail/text/confirmation.php | 4 +- .../views/mail/text/reconfirmation.php | 2 +- .../resources/views/mail/text/recovery.php | 4 +- .../resources/views/mail/text/welcome.php | 4 +- lib/User/resources/views/mail/welcome.php | 2 +- lib/User/resources/views/permission/_form.php | 9 ++-- .../resources/views/permission/create.php | 9 ++-- lib/User/resources/views/permission/index.php | 19 ++++--- .../resources/views/permission/update.php | 9 ++-- lib/User/resources/views/profile/show.php | 6 +-- lib/User/resources/views/recovery/request.php | 2 +- lib/User/resources/views/recovery/reset.php | 2 +- .../resources/views/registration/connect.php | 2 +- .../resources/views/registration/register.php | 2 +- .../resources/views/registration/resend.php | 2 +- lib/User/resources/views/role/_form.php | 6 +-- lib/User/resources/views/role/create.php | 9 ++-- lib/User/resources/views/role/index.php | 15 +++--- lib/User/resources/views/role/update.php | 9 ++-- lib/User/resources/views/security/login.php | 8 +-- lib/User/resources/views/settings/_menu.php | 2 +- lib/User/resources/views/settings/account.php | 14 +++--- .../resources/views/settings/networks.php | 4 +- lib/User/resources/views/settings/profile.php | 4 +- lib/User/resources/views/shared/_alert.php | 4 +- lib/User/resources/views/shared/_menu.php | 8 +-- lib/User/resources/views/shared/message.php | 5 +- .../views/widgets/assignments/form.php | 8 +-- .../resources/views/widgets/login/login.php | 18 +++---- 140 files changed, 512 insertions(+), 523 deletions(-) diff --git a/lib/User/AuthClient/Facebook.php b/lib/User/AuthClient/Facebook.php index bc08f57..3ccfe8e 100644 --- a/lib/User/AuthClient/Facebook.php +++ b/lib/User/AuthClient/Facebook.php @@ -1,4 +1,5 @@ initAuthCollection($app); $this->initAuthManager($app); } else { - /** @var $app ConsoleApplication */ + /* @var $app ConsoleApplication */ $this->initConsoleCommands($app); } } } /** - * Initialize container with module classes + * Initialize container with module classes. * * @param \yii\base\Application $app - * @param array $map the previously built class map list + * @param array $map the previously built class map list */ protected function initContainer($app, $map) { @@ -131,7 +132,7 @@ class Bootstrap implements BootstrapInterface [ 'enableAutoLogin' => true, 'loginUrl' => ['/user/auth/login'], - 'identityClass' => $di->get(ClassMapHelper::class)->get(User::class) + 'identityClass' => $di->get(ClassMapHelper::class)->get(User::class), ] ); } @@ -141,7 +142,7 @@ class Bootstrap implements BootstrapInterface } /** - * Registers module translation messages + * Registers module translation messages. * * @param Application $app */ @@ -150,8 +151,8 @@ class Bootstrap implements BootstrapInterface if (!isset($app->get('i18n')->translations['user*'])) { $app->get('i18n')->translations['user*'] = [ 'class' => PhpMessageSource::class, - 'basePath' => __DIR__ . '/resources/i18n', - 'sourceLanguage' => 'en-US' + 'basePath' => __DIR__.'/resources/i18n', + 'sourceLanguage' => 'en-US', ]; } } @@ -167,14 +168,14 @@ class Bootstrap implements BootstrapInterface $app->set( 'authManager', [ - 'class' => AuthDbManagerComponent::class + 'class' => AuthDbManagerComponent::class, ] ); } } /** - * Initializes web url routes (rules in Yii2) + * Initializes web url routes (rules in Yii2). * * @param WebApplication $app */ @@ -199,7 +200,7 @@ class Bootstrap implements BootstrapInterface /** * Ensures required mail parameters needed for the mail service. * - * @param Application $app + * @param Application $app * @param Module|\yii\base\Module $module */ protected function initMailServiceConfiguration(Application $app, Module $module) @@ -209,7 +210,7 @@ class Bootstrap implements BootstrapInterface 'welcomeMailSubject' => Yii::t('user', 'Welcome to {0}', $app->name), 'confirmationMailSubject' => Yii::t('user', 'Confirm account on {0}', $app->name), 'reconfirmationMailSubject' => Yii::t('user', 'Confirm email change on {0}', $app->name), - 'recoveryMailSubject' => Yii::t('user', 'Complete password reset on {0}', $app->name) + 'recoveryMailSubject' => Yii::t('user', 'Complete password reset on {0}', $app->name), ]; $module->mailParams = array_merge($defaults, $module->mailParams); @@ -238,7 +239,7 @@ class Bootstrap implements BootstrapInterface } /** - * Registers controllers + * Registers controllers. * * @param WebApplication $app */ @@ -249,7 +250,7 @@ class Bootstrap implements BootstrapInterface } /** - * Builds class map according to user configuration + * Builds class map according to user configuration. * * @param array $userClassMap user configuration on the module * @@ -288,12 +289,12 @@ class Bootstrap implements BootstrapInterface 'Token', 'Assignment', 'Permission', - 'Role' + 'Role', ], 'Da\User\Search' => [ 'UserSearch', 'PermissionSearch', - 'RoleSearch' + 'RoleSearch', ], 'Da\UserForm' => [ 'RegistrationForm', @@ -301,25 +302,26 @@ class Bootstrap implements BootstrapInterface 'LoginForm', 'SettingsForm', 'RecoveryForm', - ] + ], ]; $mapping = array_merge($defaults, $userClassMap); foreach ($mapping as $name => $definition) { - $map[$this->getRoute($routes, $name) . "\\$name"] = $definition; + $map[$this->getRoute($routes, $name)."\\$name"] = $definition; } return $map; } /** - * Returns the parent class name route of a short class name + * Returns the parent class name route of a short class name. * - * @param array $routes class name routes + * @param array $routes class name routes * @param string $name * * @return int|string + * * @throws Exception */ protected function getRoute(array $routes, $name) @@ -331,5 +333,4 @@ class Bootstrap implements BootstrapInterface } throw new Exception("Unknown configuration class name '{$name}'"); } - } diff --git a/lib/User/Command/ConfirmController.php b/lib/User/Command/ConfirmController.php index b21122e..38f29ef 100644 --- a/lib/User/Command/ConfirmController.php +++ b/lib/User/Command/ConfirmController.php @@ -1,4 +1,5 @@ userQuery->whereUsernameOrEmail($usernameOrEmail)->one(); if ($user === null) { - $this->stdout(Yii::t('user', 'User is not found') . "\n", Console::FG_RED); + $this->stdout(Yii::t('user', 'User is not found')."\n", Console::FG_RED); } else { - if ($this->make(UserConfirmationService::class, [$user])->run()) { - $this->stdout(Yii::t('user', 'User has been confirmed') . "\n", Console::FG_GREEN); + $this->stdout(Yii::t('user', 'User has been confirmed')."\n", Console::FG_GREEN); } else { - $this->stdout(Yii::t('user', 'Error occurred while confirming user') . "\n", Console::FG_RED); + $this->stdout(Yii::t('user', 'Error occurred while confirming user')."\n", Console::FG_RED); } } } } - - diff --git a/lib/User/Command/CreateController.php b/lib/User/Command/CreateController.php index 905c8d0..c048756 100644 --- a/lib/User/Command/CreateController.php +++ b/lib/User/Command/CreateController.php @@ -1,4 +1,5 @@ make(UserCreateService::class, [$user, $mailService])->run()) { - $this->stdout(Yii::t('user', 'User has been created') . "!\n", Console::FG_GREEN); + $this->stdout(Yii::t('user', 'User has been created')."!\n", Console::FG_GREEN); } else { - $this->stdout(Yii::t('user', 'Please fix following errors:') . "\n", Console::FG_RED); + $this->stdout(Yii::t('user', 'Please fix following errors:')."\n", Console::FG_RED); foreach ($user->errors as $errors) { foreach ($errors as $error) { - $this->stdout(' - ' . $error . "\n", Console::FG_RED); + $this->stdout(' - '.$error."\n", Console::FG_RED); } } } - } } diff --git a/lib/User/Command/DeleteController.php b/lib/User/Command/DeleteController.php index 73791db..912c6a4 100644 --- a/lib/User/Command/DeleteController.php +++ b/lib/User/Command/DeleteController.php @@ -1,4 +1,5 @@ confirm(Yii::t('user', 'Are you sure? Deleted user can not be restored'))) { $user = $this->userQuery->whereUsernameOrEmail($usernameOrEmail)->one(); if ($user === null) { - $this->stdout(Yii::t('user', 'User is not found') . "\n", Console::FG_RED); + $this->stdout(Yii::t('user', 'User is not found')."\n", Console::FG_RED); } else { if ($user->delete()) { - $this->stdout(Yii::t('user', 'User has been deleted') . "\n", Console::FG_GREEN); + $this->stdout(Yii::t('user', 'User has been deleted')."\n", Console::FG_GREEN); } else { - $this->stdout(Yii::t('user', 'Error occurred while deleting user') . "\n", Console::FG_RED); + $this->stdout(Yii::t('user', 'Error occurred while deleting user')."\n", Console::FG_RED); } } } diff --git a/lib/User/Command/PasswordController.php b/lib/User/Command/PasswordController.php index 65f1a9e..85aa829 100644 --- a/lib/User/Command/PasswordController.php +++ b/lib/User/Command/PasswordController.php @@ -1,4 +1,5 @@ userQuery->whereUsernameOrEmail($usernameOrEmail)->one(); if ($user === null) { - $this->stdout(Yii::t('user', 'User is not found') . "\n", Console::FG_RED); + $this->stdout(Yii::t('user', 'User is not found')."\n", Console::FG_RED); } else { if ($this->make(ResetPasswordService::class, [$password, $user])->run()) { - $this->stdout(Yii::t('user', 'Password has been changed') . "\n", Console::FG_GREEN); + $this->stdout(Yii::t('user', 'Password has been changed')."\n", Console::FG_GREEN); } else { - $this->stdout(Yii::t('user', 'Error occurred while changing password') . "\n", Console::FG_RED); + $this->stdout(Yii::t('user', 'Error occurred while changing password')."\n", Console::FG_RED); } } } diff --git a/lib/User/Component/AuthDbManagerComponent.php b/lib/User/Component/AuthDbManagerComponent.php index a546ef8..95be925 100644 --- a/lib/User/Component/AuthDbManagerComponent.php +++ b/lib/User/Component/AuthDbManagerComponent.php @@ -1,6 +1,6 @@ select('b.*') ->from(['a' => $this->assignmentTable, 'b' => $this->itemTable]) ->where('{{a}}.[[item_name]]={{b}}.[[name]]') - ->andWhere(['a.user_id' => (string)$userId]); + ->andWhere(['a.user_id' => (string) $userId]); $roles = []; foreach ($query->all($this->db) as $row) { @@ -66,7 +66,7 @@ class AuthDbManagerComponent extends DbManager implements AuthManagerInterface } /** - * @inheritdoc + * {@inheritdoc} */ public function getItem($name) { diff --git a/lib/User/Contracts/AuthClientInterface.php b/lib/User/Contracts/AuthClientInterface.php index a6d8bf2..479b120 100644 --- a/lib/User/Contracts/AuthClientInterface.php +++ b/lib/User/Contracts/AuthClientInterface.php @@ -1,4 +1,5 @@ $searchModel, - 'dataProvider' => $searchModel->search(Yii::$app->request->get()) + 'dataProvider' => $searchModel->search(Yii::$app->request->get()), ] ); } @@ -82,7 +83,6 @@ abstract class AbstractAuthItemController extends Controller ->setFlash('success', Yii::t('user', 'Authorization item successfully created.')); return $this->redirect(['index']); - } else { Yii::$app->getSession()->setFlash('danger', Yii::t('user', 'Unable to create authorization item.')); } @@ -92,7 +92,7 @@ abstract class AbstractAuthItemController extends Controller 'create', [ 'model' => $model, - 'unassignedItems' => $this->authHelper->getUnassignedItems($model) + 'unassignedItems' => $this->authHelper->getUnassignedItems($model), ] ); } @@ -107,14 +107,12 @@ abstract class AbstractAuthItemController extends Controller $this->make(AjaxRequestModelValidator::class, [$model])->validate(); if ($model->load(Yii::$app->request->post())) { - if ($this->make(AuthItemEditionService::class, [$model])->run()) { Yii::$app ->getSession() ->setFlash('success', Yii::t('user', 'Authorization item successfully updated.')); return $this->redirect(['index']); - } else { Yii::$app->getSession()->setFlash('danger', Yii::t('user', 'Unable to update authorization item.')); } @@ -124,7 +122,7 @@ abstract class AbstractAuthItemController extends Controller 'update', [ 'model' => $model, - 'unassignedItems' => $this->authHelper->getUnassignedItems($model) + 'unassignedItems' => $this->authHelper->getUnassignedItems($model), ] ); } @@ -143,26 +141,25 @@ abstract class AbstractAuthItemController extends Controller } /** - * The fully qualified class name of the model + * The fully qualified class name of the model. * * @return string */ abstract protected function getModelClass(); /** - * The fully qualified class name of the search model + * The fully qualified class name of the search model. * * @return string */ abstract protected function getSearchModelClass(); /** - * Returns the an auth item + * Returns the an auth item. * * @param string $name * * @return \yii\rbac\Role|\yii\rbac\Permission|\yii\rbac\Rule */ abstract protected function getItem($name); - } diff --git a/lib/User/Controller/AdminController.php b/lib/User/Controller/AdminController.php index 2cfe63a..278bf9a 100644 --- a/lib/User/Controller/AdminController.php +++ b/lib/User/Controller/AdminController.php @@ -1,4 +1,5 @@ $dataProvider, - 'searchModel' => $searchModel + 'searchModel' => $searchModel, ] ); } @@ -113,13 +113,11 @@ class AdminController extends Controller $this->make(AjaxRequestModelValidator::class, [$user])->validate(); if ($user->load(Yii::$app->request->post())) { - $this->trigger(UserEvent::EVENT_BEFORE_CREATE, $event); $mailService = MailFactory::makeWelcomeMailerService($user); if ($this->make(UserCreateService::class, [$user, $mailService])->run()) { - Yii::$app->getSession()->setFlash('success', Yii::t('user', 'User has been created')); $this->trigger(UserEvent::EVENT_AFTER_CREATE, $event); @@ -181,7 +179,7 @@ class AdminController extends Controller '_profile', [ 'user' => $user, - 'profile' => $profile + 'profile' => $profile, ] ); } @@ -208,7 +206,7 @@ class AdminController extends Controller '_assignments', [ 'user' => $user, - 'params' => Yii::$app->request->post() + 'params' => Yii::$app->request->post(), ] ); } @@ -225,7 +223,6 @@ class AdminController extends Controller if ($this->make(UserConfirmationService::class, [$user])->run()) { Yii::$app->getSession()->setFlash('success', Yii::t('user', 'User has been confirmed')); $this->trigger(UserEvent::EVENT_AFTER_CONFIRMATION, $event); - } else { Yii::$app->getSession()->setFlash('warning', Yii::t('user', 'Unable to confirm user. Please, try again.')); } @@ -247,7 +244,6 @@ class AdminController extends Controller if ($user->delete()) { Yii::$app->getSession()->setFlash('success', \Yii::t('user', 'User has been deleted')); $this->trigger(ActiveRecord::EVENT_AFTER_DELETE, $event); - } else { Yii::$app->getSession()->setFlash( 'warning', @@ -279,4 +275,3 @@ class AdminController extends Controller return $this->redirect(Url::previous('actions-redirect')); } } - diff --git a/lib/User/Controller/PermissionController.php b/lib/User/Controller/PermissionController.php index 33d9524..ef1c56d 100644 --- a/lib/User/Controller/PermissionController.php +++ b/lib/User/Controller/PermissionController.php @@ -1,6 +1,6 @@ true, 'actions' => ['index'], - 'roles' => ['@'] + 'roles' => ['@'], ], [ 'allow' => true, 'actions' => ['show'], - 'roles' => ['?', '@'] + 'roles' => ['?', '@'], ], ], ], @@ -70,5 +71,4 @@ class ProfileController extends Controller ] ); } - } diff --git a/lib/User/Controller/RecoveryController.php b/lib/User/Controller/RecoveryController.php index 82aee36..e7a91ba 100644 --- a/lib/User/Controller/RecoveryController.php +++ b/lib/User/Controller/RecoveryController.php @@ -1,4 +1,5 @@ true, 'actions' => ['request', 'reset'], - 'roles' => ['?'] + 'roles' => ['?'], ], ], ], @@ -64,11 +65,11 @@ class RecoveryController extends Controller * Displays / handles user password recovery request. * * @return string + * * @throws NotFoundHttpException */ public function actionRequest() { - if (!$this->module->allowPasswordRecovery) { throw new NotFoundHttpException(); } @@ -81,13 +82,11 @@ class RecoveryController extends Controller $this->make(AjaxRequestModelValidator::class, $form)->validate(); if ($form->load(Yii::$app->request->post())) { - $this->trigger(FormEvent::EVENT_BEFORE_REQUEST, $event); $mailService = MailFactory::makeRecoveryMailerService($form->email); if ($this->make(PasswordRecoveryService::class, [$form->email, $mailService])->run()) { - $this->trigger(FormEvent::EVENT_AFTER_REQUEST, $event); return $this->render( @@ -100,7 +99,7 @@ class RecoveryController extends Controller } } - return $this->render('request', ['model' => $form,]); + return $this->render('request', ['model' => $form]); } /** @@ -110,6 +109,7 @@ class RecoveryController extends Controller * @param $code * * @return string + * * @throws NotFoundHttpException */ public function actionReset($id, $code) @@ -159,6 +159,6 @@ class RecoveryController extends Controller } } - return $this->render('reset', ['model' => $form,]); + return $this->render('reset', ['model' => $form]); } } diff --git a/lib/User/Controller/RegistrationController.php b/lib/User/Controller/RegistrationController.php index 1ebaa1e..d23159e 100644 --- a/lib/User/Controller/RegistrationController.php +++ b/lib/User/Controller/RegistrationController.php @@ -1,4 +1,5 @@ userQuery = $userQuery; $this->socialNetworkAccountQuery = $socialNetworkAccountQuery; parent::__construct($id, $module, $config); } /** - * @inheritdoc + * {@inheritdoc} */ public function behaviors() { @@ -65,12 +65,12 @@ class RegistrationController extends Controller [ 'allow' => true, 'actions' => ['register', 'connect'], - 'roles' => ['?'] + 'roles' => ['?'], ], [ 'allow' => true, 'actions' => ['confirm', 'resend'], - 'roles' => ['?', '@'] + 'roles' => ['?', '@'], ], ], ], @@ -97,7 +97,6 @@ class RegistrationController extends Controller $mailService = MailFactory::makeWelcomeMailerService($user); if ($this->make(UserRegisterService::class, [$user, $mailService])->run()) { - Yii::$app->session->setFlash( 'info', Yii::t( @@ -110,7 +109,7 @@ class RegistrationController extends Controller '/shared/message', [ 'title' => Yii::t('user', 'Your account has been created'), - 'module' => $this->module + 'module' => $this->module, ] ); } @@ -143,7 +142,6 @@ class RegistrationController extends Controller $this->make(AjaxRequestModelValidator::class, [$user])->validate(); if ($user->load(Yii::$app->request->post())) { - $this->trigger(SocialNetworkConnectEvent::EVENT_BEFORE_CONNECT, $event); $mailService = MailFactory::makeWelcomeMailerService($user); @@ -225,7 +223,7 @@ class RegistrationController extends Controller 'info', Yii::t( 'user', - 'A message has been sent to your email address. ' . + 'A message has been sent to your email address. '. 'It contains a confirmation link that you must click to complete registration.' ) ); @@ -236,14 +234,14 @@ class RegistrationController extends Controller 'danger', Yii::t( 'user', - 'We couldn\'t re-send the mail to confirm your address. ' . + 'We couldn\'t re-send the mail to confirm your address. '. 'Please, verify is the correct email or if it has been confirmed already.' ) ); } return $this->render('/shared/message', [ - 'title' => $success + 'title' => $success ? Yii::t('user', 'A new confirmation link has been sent') : Yii::t('user', 'Unable to send confirmation link'), 'module' => $this->module, diff --git a/lib/User/Controller/RoleController.php b/lib/User/Controller/RoleController.php index b0812f2..e4639ab 100644 --- a/lib/User/Controller/RoleController.php +++ b/lib/User/Controller/RoleController.php @@ -1,4 +1,5 @@ true, 'actions' => ['login', 'auth', 'blocked'], - 'roles' => ['?'] + 'roles' => ['?'], ], [ 'allow' => true, 'actions' => ['login', 'auth', 'logout'], - 'roles' => ['@'] + 'roles' => ['@'], ], ], ], @@ -73,7 +72,7 @@ class SecurityController extends Controller } /** - * @inheritdoc + * {@inheritdoc} */ public function actions() { diff --git a/lib/User/Controller/SettingsController.php b/lib/User/Controller/SettingsController.php index 9af6e40..e03ff29 100644 --- a/lib/User/Controller/SettingsController.php +++ b/lib/User/Controller/SettingsController.php @@ -1,4 +1,5 @@ trigger(SocialNetworkConnectEvent::EVENT_AFTER_DISCONNECT, $event); return $this->redirect(['networks']); - } public function actionDelete() diff --git a/lib/User/Event/FormEvent.php b/lib/User/Event/FormEvent.php index 8bdd785..9ba175b 100644 --- a/lib/User/Event/FormEvent.php +++ b/lib/User/Event/FormEvent.php @@ -1,4 +1,5 @@ form; } } - diff --git a/lib/User/Event/ProfileEvent.php b/lib/User/Event/ProfileEvent.php index 82b9e06..a92b02e 100644 --- a/lib/User/Event/ProfileEvent.php +++ b/lib/User/Event/ProfileEvent.php @@ -1,17 +1,16 @@ profile = $profile; return parent::__construct($config); diff --git a/lib/User/Event/ResetPasswordEvent.php b/lib/User/Event/ResetPasswordEvent.php index 4403801..263d9c6 100644 --- a/lib/User/Event/ResetPasswordEvent.php +++ b/lib/User/Event/ResetPasswordEvent.php @@ -1,6 +1,6 @@ 'makeRole', - Item::TYPE_PERMISSION => 'makePermission' + Item::TYPE_PERMISSION => 'makePermission', ]; /** @@ -37,6 +38,7 @@ class AuthItemFactory * @param $name * * @return \yii\rbac\Role|\yii\rbac\Permission + * * @throws Exception */ public static function makeByType($type, $name) diff --git a/lib/User/Factory/EmailChangeStrategyFactory.php b/lib/User/Factory/EmailChangeStrategyFactory.php index 1133bcd..e5258d2 100644 --- a/lib/User/Factory/EmailChangeStrategyFactory.php +++ b/lib/User/Factory/EmailChangeStrategyFactory.php @@ -1,8 +1,8 @@ InsecureEmailChangeStrategy::class, MailChangeStrategyInterface::TYPE_DEFAULT => DefaultEmailChangeStrategy::class, - MailChangeStrategyInterface::TYPE_SECURE => SecureEmailChangeStrategy::class + MailChangeStrategyInterface::TYPE_SECURE => SecureEmailChangeStrategy::class, ]; /** @@ -24,6 +23,7 @@ class EmailChangeStrategyFactory * @param SettingsForm $form * * @return MailChangeStrategyInterface + * * @throws Exception */ public static function makeByStrategyType($strategy, SettingsForm $form) diff --git a/lib/User/Factory/MailFactory.php b/lib/User/Factory/MailFactory.php index 26d1744..5a4b95c 100644 --- a/lib/User/Factory/MailFactory.php +++ b/lib/User/Factory/MailFactory.php @@ -1,4 +1,5 @@ $user, 'token' => null, 'module' => $module, - 'showPassword' => false + 'showPassword' => false, ]; return static::makeMailerService($from, $to, $subject, 'welcome', $params); @@ -33,7 +34,7 @@ class MailFactory /** * @param string $email - * @param Token $token + * @param Token $token * * @return MailService */ @@ -46,14 +47,14 @@ class MailFactory $subject = $module->mailParams['recoveryMailSubject']; $params = [ 'user' => $token && $token->user ? $token->user : null, - 'token' => $token + 'token' => $token, ]; return static::makeMailerService($from, $to, $subject, 'recovery', $params); } /** - * @param User $user + * @param User $user * @param Token|null $token * * @return MailService @@ -67,19 +68,20 @@ class MailFactory $subject = $module->mailParams['confirmationMailSubject']; $params = [ 'user' => $token && $token->user ? $token->user : null, - 'token' => $token + 'token' => $token, ]; return static::makeMailerService($from, $to, $subject, 'recovery', $params); } /** - * @param User $user + * @param User $user * @param Token $token * * @return MailService */ - public static function makeReconfirmationMailerService(User $user, Token $token) { + public static function makeReconfirmationMailerService(User $user, Token $token) + { /** @var Module $module */ $module = Yii::$app->getModule('user'); $to = $token->type === Token::TYPE_CONFIRM_NEW_EMAIL @@ -90,20 +92,20 @@ class MailFactory $subject = $module->mailParams['reconfirmationMailSubject']; $params = [ 'user' => $token && $token->user ? $token->user : null, - 'token' => $token + 'token' => $token, ]; return static::makeMailerService($from, $to, $subject, 'recovery', $params); } /** - * Builds a MailerService + * Builds a MailerService. * * @param string $from * @param string $to * @param string $subject * @param string $view - * @param array $params + * @param array $params * * @return MailService */ diff --git a/lib/User/Factory/TokenFactory.php b/lib/User/Factory/TokenFactory.php index c60e769..c89bf04 100644 --- a/lib/User/Factory/TokenFactory.php +++ b/lib/User/Factory/TokenFactory.php @@ -1,13 +1,12 @@ save(false); return $token; - } /** @@ -75,5 +73,4 @@ class TokenFactory { return Yii::createObject(['class' => Token::class, 'user_id' => $userId, 'type' => $type]); } - } diff --git a/lib/User/Filter/AccessRuleFilter.php b/lib/User/Filter/AccessRuleFilter.php index 15258a1..abe113b 100644 --- a/lib/User/Filter/AccessRuleFilter.php +++ b/lib/User/Filter/AccessRuleFilter.php @@ -5,11 +5,10 @@ namespace Da\User\Filter; use Da\User\Model\User; use yii\filters\AccessRule; - class AccessRuleFilter extends AccessRule { /** - * @inheritdoc + * {@inheritdoc} * */ protected function matchRole($user) { diff --git a/lib/User/Form/LoginForm.php b/lib/User/Form/LoginForm.php index 9dcb116..f4deb0e 100644 --- a/lib/User/Form/LoginForm.php +++ b/lib/User/Form/LoginForm.php @@ -39,9 +39,9 @@ class LoginForm extends Model protected $securityHelper; /** - * @param UserQuery $query + * @param UserQuery $query * @param SecurityHelper $securityHelper - * @param array $config + * @param array $config */ public function __construct(UserQuery $query, SecurityHelper $securityHelper, $config = []) { @@ -51,7 +51,7 @@ class LoginForm extends Model } /** - * @inheritdoc + * {@inheritdoc} */ public function attributeLabels() { @@ -63,7 +63,7 @@ class LoginForm extends Model } /** - * @inheritdoc + * {@inheritdoc} */ public function rules() { @@ -78,7 +78,7 @@ class LoginForm extends Model ) { $this->addError($attribute, Yii::t('user', 'Invalid login or password')); } - } + }, ], 'confirmationValidate' => [ 'login', @@ -93,7 +93,7 @@ class LoginForm extends Model $this->addError($attribute, Yii::t('user', 'Your account has been blocked')); } } - } + }, ], 'rememberMe' => ['rememberMe', 'boolean'], ]; @@ -108,6 +108,7 @@ class LoginForm extends Model { if ($this->validate()) { $duration = $this->rememberMe ? $this->module->rememberLoginLifespan : 0; + return Yii::$app->getUser()->login($this->user, $duration); } else { return false; @@ -115,14 +116,16 @@ class LoginForm extends Model } /** - * @inheritdoc + * {@inheritdoc} */ public function beforeValidate() { if (parent::beforeValidate()) { $this->user = $this->query->whereUsernameOrEmail(trim($this->login))->one(); + return true; } + return false; } } diff --git a/lib/User/Form/RecoveryForm.php b/lib/User/Form/RecoveryForm.php index 0f64fd4..db141bf 100644 --- a/lib/User/Form/RecoveryForm.php +++ b/lib/User/Form/RecoveryForm.php @@ -1,4 +1,5 @@ Yii::t('user', 'Email'), + 'email' => Yii::t('user', 'Email'), 'password' => Yii::t('user', 'Password'), ]; } /** - * @inheritdoc + * {@inheritdoc} */ public function scenarios() { @@ -59,7 +60,7 @@ class RecoveryForm extends Model } /** - * @inheritdoc + * {@inheritdoc} */ public function rules() { diff --git a/lib/User/Form/RegistrationForm.php b/lib/User/Form/RegistrationForm.php index 331a6e1..75a04d6 100644 --- a/lib/User/Form/RegistrationForm.php +++ b/lib/User/Form/RegistrationForm.php @@ -8,7 +8,6 @@ use Da\User\Traits\ModuleTrait; use Yii; use yii\base\Model; - class RegistrationForm extends Model { use ModuleTrait; @@ -28,7 +27,7 @@ class RegistrationForm extends Model public $password; /** - * @inheritdoc + * {@inheritdoc} */ public function rules() { @@ -45,7 +44,7 @@ class RegistrationForm extends Model 'username', 'unique', 'targetClass' => $user, - 'message' => Yii::t('user', 'This username has already been taken') + 'message' => Yii::t('user', 'This username has already been taken'), ], // email rules 'emailTrim' => ['email', 'filter', 'filter' => 'trim'], @@ -55,7 +54,7 @@ class RegistrationForm extends Model 'email', 'unique', 'targetClass' => $user, - 'message' => Yii::t('user', 'This email address has already been taken') + 'message' => Yii::t('user', 'This email address has already been taken'), ], // password rules 'passwordRequired' => ['password', 'required', 'skipOnEmpty' => $this->module->generatePasswords], @@ -64,7 +63,7 @@ class RegistrationForm extends Model } /** - * @inheritdoc + * {@inheritdoc} */ public function attributeLabels() { diff --git a/lib/User/Form/ResendForm.php b/lib/User/Form/ResendForm.php index b207ca3..ec7fdeb 100644 --- a/lib/User/Form/ResendForm.php +++ b/lib/User/Form/ResendForm.php @@ -1,4 +1,5 @@ function ($model, $attribute) { return $this->getUser()->$attribute != $model->$attribute; }, - 'targetClass' => $this->getClassMap()->get(User::class) + 'targetClass' => $this->getClassMap()->get(User::class), ], 'newPasswordLength' => ['new_password', 'string', 'max' => 72, 'min' => 6], 'currentPasswordRequired' => ['current_password', 'required'], @@ -74,13 +74,13 @@ class SettingsForm extends Model if (!$this->securityHelper->validatePassword($this->$attribute, $this->getUser()->password_hash)) { $this->addError($attribute, Yii::t('user', 'Current password is not valid')); } - } + }, ], ]; } /** - * @inheritdoc + * {@inheritdoc} */ public function attributeLabels() { @@ -117,7 +117,6 @@ class SettingsForm extends Model $this->user->password = $this->new_password; if ($this->email == $this->user->email && $this->user->unconfirmed_email != null) { $this->user->unconfirmed_email = null; - } elseif ($this->email != $this->user->email) { $strategy = EmailChangeStrategyFactory::makeByStrategyType( $this->getModule()->emailChangeStrategy, diff --git a/lib/User/Helper/AuthHelper.php b/lib/User/Helper/AuthHelper.php index 6b69d13..9ab30ae 100644 --- a/lib/User/Helper/AuthHelper.php +++ b/lib/User/Helper/AuthHelper.php @@ -1,4 +1,5 @@ */ class ClassMapHelper @@ -37,13 +37,14 @@ class ClassMapHelper * @param $key * * @return mixed + * * @throws \Exception */ public function get($key) { if (array_key_exists($key, $this->map)) { return $this->map[$key]; - }; - throw new \Exception('Unknown model map key: ' . $key); + } + throw new \Exception('Unknown model map key: '.$key); } } diff --git a/lib/User/Helper/GravatarHelper.php b/lib/User/Helper/GravatarHelper.php index 0ad2c04..467c27b 100644 --- a/lib/User/Helper/GravatarHelper.php +++ b/lib/User/Helper/GravatarHelper.php @@ -1,4 +1,5 @@ getOffset() / 60 / 60; $timeZones[] = [ 'timezone' => $timeZone, - 'name' => "{$timeZone} (UTC " . ($offset > 0 ? '+' : '') . "{$offset})", - 'offset' => $offset + 'name' => "{$timeZone} (UTC ".($offset > 0 ? '+' : '')."{$offset})", + 'offset' => $offset, ]; } diff --git a/lib/User/Migration/m000000_000001_create_user_table.php b/lib/User/Migration/m000000_000001_create_user_table.php index d58cb54..10e303e 100644 --- a/lib/User/Migration/m000000_000001_create_user_table.php +++ b/lib/User/Migration/m000000_000001_create_user_table.php @@ -1,4 +1,5 @@ $this->integer(), 'blocked_at' => $this->integer(), 'updated_at' => $this->integer()->notNull(), - 'created_at' => $this->integer()->notNull() + 'created_at' => $this->integer()->notNull(), ]); $this->createIndex('idx_user_username', '{{%user}}', 'username', true); diff --git a/lib/User/Migration/m000000_000002_create_profile_table.php b/lib/User/Migration/m000000_000002_create_profile_table.php index b8fa244..6a9c741 100644 --- a/lib/User/Migration/m000000_000002_create_profile_table.php +++ b/lib/User/Migration/m000000_000002_create_profile_table.php @@ -1,4 +1,5 @@ $this->string(255), 'website' => $this->string(255), 'timezone' => $this->string(40), - 'bio' => $this->text() + 'bio' => $this->text(), ] ); diff --git a/lib/User/Migration/m000000_000003_create_social_account_table.php b/lib/User/Migration/m000000_000003_create_social_account_table.php index e4f5270..c90c84f 100644 --- a/lib/User/Migration/m000000_000003_create_social_account_table.php +++ b/lib/User/Migration/m000000_000003_create_social_account_table.php @@ -1,4 +1,5 @@ $this->string(255), 'username' => $this->string(255), 'data' => $this->text(), - 'created_at' => $this->integer() + 'created_at' => $this->integer(), ] ); diff --git a/lib/User/Migration/m000000_000004_create_token_table.php b/lib/User/Migration/m000000_000004_create_token_table.php index 8cda655..ab7b935 100644 --- a/lib/User/Migration/m000000_000004_create_token_table.php +++ b/lib/User/Migration/m000000_000004_create_token_table.php @@ -1,4 +1,5 @@ $this->integer(), 'code' => $this->string(32)->notNull(), 'type' => $this->smallInteger(6)->notNull(), - 'created_at' => $this->integer()->notNull() + 'created_at' => $this->integer()->notNull(), ] ); diff --git a/lib/User/Model/AbstractAuthItem.php b/lib/User/Model/AbstractAuthItem.php index 5e7a810..461de61 100644 --- a/lib/User/Model/AbstractAuthItem.php +++ b/lib/User/Model/AbstractAuthItem.php @@ -1,4 +1,5 @@ function () { return $this->scenario == 'create' || $this->item->name != $this->name; - } + }, ], ['children', RbacItemsValidator::class], ['rule', RbacRuleValidator::class], diff --git a/lib/User/Model/Assignment.php b/lib/User/Model/Assignment.php index 9904753..2790b82 100644 --- a/lib/User/Model/Assignment.php +++ b/lib/User/Model/Assignment.php @@ -1,4 +1,5 @@ user_id === null) { + if ($this->user_id === null) { throw new InvalidConfigException('"user_id" must be set.'); } @@ -31,24 +33,24 @@ class Assignment extends Model } /** - * @inheritdoc + * {@inheritdoc} */ public function attributeLabels() { return [ - 'items' => Yii::t('user', 'Items') + 'items' => Yii::t('user', 'Items'), ]; } /** - * @inheritdoc + * {@inheritdoc} */ public function rules() { return [ ['user_id', 'required'], ['items', RbacItemsValidator::class], - ['user_id', 'integer'] + ['user_id', 'integer'], ]; } } diff --git a/lib/User/Model/Permission.php b/lib/User/Model/Permission.php index 9598489..d186fe8 100644 --- a/lib/User/Model/Permission.php +++ b/lib/User/Model/Permission.php @@ -1,4 +1,5 @@ isAttributeChanged('gravatar_email')) { - $this->setAttribute( 'gravatar_id', $this->make(GravatarHelper::class)->buildId(trim($this->getAttribute('gravatar_email'))) @@ -48,7 +46,7 @@ class Profile extends ActiveRecord } /** - * @inheritdoc + * {@inheritdoc} */ public static function tableName() { @@ -56,7 +54,7 @@ class Profile extends ActiveRecord } /** - * @inheritdoc + * {@inheritdoc} */ public function rules() { @@ -68,7 +66,7 @@ class Profile extends ActiveRecord if ($this->make(TimeZoneValidator::class, [$attribute])->validate()) { $this->addError($attribute, Yii::t('user', 'Time zone is not valid')); } - } + }, ], 'publicEmailPattern' => ['public_email', 'email'], 'gravatarEmailPattern' => ['gravatar_email', 'email'], @@ -82,7 +80,7 @@ class Profile extends ActiveRecord } /** - * @inheritdoc + * {@inheritdoc} */ public function attributeLabels() { @@ -112,7 +110,7 @@ class Profile extends ActiveRecord } /** - * Set the User's timezone + * Set the User's timezone. * * @param DateTimeZone $timezone */ @@ -122,7 +120,7 @@ class Profile extends ActiveRecord } /** - * Get User's local time + * Get User's local time. * * @param DateTime|null $dateTime * diff --git a/lib/User/Model/Role.php b/lib/User/Model/Role.php index 258b069..873f190 100644 --- a/lib/User/Model/Role.php +++ b/lib/User/Model/Role.php @@ -1,9 +1,9 @@ '/user/registration/confirm', self::TYPE_RECOVERY => '/usr/recovery/reset', self::TYPE_CONFIRM_NEW_EMAIL => '/user/settings/confirm', - self::TYPE_CONFIRM_OLD_EMAIL => '/usr/settings/confirm' + self::TYPE_CONFIRM_OLD_EMAIL => '/usr/settings/confirm', ]; /** - * @inheritdoc + * {@inheritdoc} */ public function beforeSave($insert) { @@ -54,7 +53,7 @@ class Token extends ActiveRecord } /** - * @inheritdoc + * {@inheritdoc} */ public static function tableName() { @@ -62,7 +61,7 @@ class Token extends ActiveRecord } /** - * @inheritdoc + * {@inheritdoc} */ public static function primaryKey() { @@ -86,7 +85,7 @@ class Token extends ActiveRecord } /** - * @return bool Whether token has expired. + * @return bool Whether token has expired */ public function getIsExpired() { diff --git a/lib/User/Model/User.php b/lib/User/Model/User.php index 0210aae..ee103e1 100644 --- a/lib/User/Model/User.php +++ b/lib/User/Model/User.php @@ -1,4 +1,5 @@ [ 'username', 'unique', - 'message' => Yii::t('user', 'This username has already been taken') + 'message' => Yii::t('user', 'This username has already been taken'), ], // email rules @@ -155,7 +156,7 @@ class User extends ActiveRecord implements IdentityInterface 'emailUnique' => [ 'email', 'unique', - 'message' => Yii::t('user', 'This email address has already been taken') + 'message' => Yii::t('user', 'This email address has already been taken'), ], 'emailTrim' => ['email', 'trim'], @@ -166,7 +167,7 @@ class User extends ActiveRecord implements IdentityInterface } /** - * @inheritdoc + * {@inheritdoc} */ public function validateAuthKey($authKey) { @@ -174,7 +175,7 @@ class User extends ActiveRecord implements IdentityInterface } /** - * @inheritdoc + * {@inheritdoc} */ public function getId() { @@ -182,7 +183,7 @@ class User extends ActiveRecord implements IdentityInterface } /** - * @inheritdoc + * {@inheritdoc} */ public function getAuthKey() { @@ -190,7 +191,7 @@ class User extends ActiveRecord implements IdentityInterface } /** - * @inheritdoc + * {@inheritdoc} */ public static function findIdentity($id) { @@ -198,7 +199,7 @@ class User extends ActiveRecord implements IdentityInterface } /** - * @return bool whether is blocked or not. + * @return bool whether is blocked or not */ public function getIsBlocked() { @@ -222,7 +223,7 @@ class User extends ActiveRecord implements IdentityInterface } /** - * Checks whether a user has a specific role + * Checks whether a user has a specific role. * * @param string $role * @@ -269,10 +270,10 @@ class User extends ActiveRecord implements IdentityInterface } /** - * @inheritdoc + * {@inheritdoc} */ public static function findIdentityByAccessToken($token, $type = null) { - throw new NotSupportedException('Method "' . __CLASS__ . '::' . __METHOD__ . '" is not implemented.'); + throw new NotSupportedException('Method "'.__CLASS__.'::'.__METHOD__.'" is not implemented.'); } } diff --git a/lib/User/Module.php b/lib/User/Module.php index 2b2d2f9..69f1cf9 100644 --- a/lib/User/Module.php +++ b/lib/User/Module.php @@ -1,4 +1,5 @@ /' => 'registration/confirm', 'forgot' => 'recovery/request', 'recover//' => 'recovery/reset', - 'settings/' => 'settings/' + 'settings/' => 'settings/', ]; public $viewPath = '@Da/User/resources/views'; diff --git a/lib/User/Query/ProfileQuery.php b/lib/User/Query/ProfileQuery.php index 8f835b8..6e62d1c 100644 --- a/lib/User/Query/ProfileQuery.php +++ b/lib/User/Query/ProfileQuery.php @@ -1,4 +1,5 @@ andWhere( [ 'provider' => $client->getId(), - 'client_id' => $client->getUserAttributes()['id'] + 'client_id' => $client->getUserAttributes()['id'], ] ); } diff --git a/lib/User/Query/TokenQuery.php b/lib/User/Query/TokenQuery.php index 81bf466..ed69ca6 100644 --- a/lib/User/Query/TokenQuery.php +++ b/lib/User/Query/TokenQuery.php @@ -1,4 +1,5 @@ andWhere(['id' => $id]); } - /** * @param $id * diff --git a/lib/User/Search/AbstractAuthItemSearch.php b/lib/User/Search/AbstractAuthItemSearch.php index 037fa0f..26bb322 100644 --- a/lib/User/Search/AbstractAuthItemSearch.php +++ b/lib/User/Search/AbstractAuthItemSearch.php @@ -1,4 +1,5 @@ allModels = $query->all($this->getAuthManager()->db); return $dataProvider; - } } diff --git a/lib/User/Search/PermissionSearch.php b/lib/User/Search/PermissionSearch.php index c4f2efb..2414116 100644 --- a/lib/User/Search/PermissionSearch.php +++ b/lib/User/Search/PermissionSearch.php @@ -1,4 +1,5 @@ Yii::t('user', 'Username'), - 'email' => Yii::t('user', 'Email'), - 'created_at' => Yii::t('user', 'Registration time'), + 'username' => Yii::t('user', 'Username'), + 'email' => Yii::t('user', 'Email'), + 'created_at' => Yii::t('user', 'Registration time'), 'registration_ip' => Yii::t('user', 'Registration ip'), ]; } diff --git a/lib/User/Service/AccountConfirmationService.php b/lib/User/Service/AccountConfirmationService.php index 9491675..6973c6b 100644 --- a/lib/User/Service/AccountConfirmationService.php +++ b/lib/User/Service/AccountConfirmationService.php @@ -1,9 +1,8 @@ model->item = $item; return $this->updateChildren(); - } catch (Exception $e) { return false; } } /** - * Updates Auth Item children + * Updates Auth Item children. * * @return bool */ @@ -78,7 +78,6 @@ class AuthItemEditionService implements ServiceInterface if (!$this->getAuthManager()->removeChild($this->model->item, $children[$item])) { return false; } - } // add new children foreach (array_diff($this->model->children, $childrenNames) as $item) { diff --git a/lib/User/Service/EmailChangeService.php b/lib/User/Service/EmailChangeService.php index 6b96dbd..8cccc96 100644 --- a/lib/User/Service/EmailChangeService.php +++ b/lib/User/Service/EmailChangeService.php @@ -1,4 +1,5 @@ delete(); if (empty($this->model->unconfirmed_email)) { Yii::$app->session->setFlash('danger', Yii::t('user', 'An error occurred processing your request')); - } elseif ($this->userQuery->whereEmail($this->model->unconfirmed_email)->exists() === false) { - if ($this->getModule()->emailChangeStrategy === MailChangeStrategyInterface::TYPE_SECURE) { if ($token->type === Token::TYPE_CONFIRM_NEW_EMAIL) { $this->model->flags |= User::NEW_EMAIL_CONFIRMED; @@ -54,7 +53,7 @@ class EmailChangeService implements ServiceInterface 'success', Yii::t( 'user', - 'Awesome, almost there. ' . + 'Awesome, almost there. '. 'Now you need to click the confirmation link sent to your old email address.' ) ); @@ -64,7 +63,7 @@ class EmailChangeService implements ServiceInterface 'success', Yii::t( 'user', - 'Awesome, almost there. ' . + 'Awesome, almost there. '. 'Now you need to click the confirmation link sent to your new email address.' ) ); @@ -81,7 +80,7 @@ class EmailChangeService implements ServiceInterface return $this->model->save(false); } } + return false; } - } diff --git a/lib/User/Service/MailService.php b/lib/User/Service/MailService.php index 02f469f..1bff5d7 100644 --- a/lib/User/Service/MailService.php +++ b/lib/User/Service/MailService.php @@ -1,4 +1,5 @@ logger->log($e->getMessage(), Logger::LEVEL_ERROR); return false; } } - } diff --git a/lib/User/Service/ResendConfirmationService.php b/lib/User/Service/ResendConfirmationService.php index 566c12a..81b8fb5 100644 --- a/lib/User/Service/ResendConfirmationService.php +++ b/lib/User/Service/ResendConfirmationService.php @@ -1,6 +1,6 @@ model && !$this->model->getIsConfirmed()) { + if ($this->model && !$this->model->getIsConfirmed()) { $token = TokenFactory::makeConfirmationToken($this->model->id); $this->mailService->setViewParam('token', $token); @@ -31,5 +31,4 @@ class ResendConfirmationService implements ServiceInterface return false; } - } diff --git a/lib/User/Service/ResetPasswordService.php b/lib/User/Service/ResetPasswordService.php index 6eaf318..07baaf9 100644 --- a/lib/User/Service/ResetPasswordService.php +++ b/lib/User/Service/ResetPasswordService.php @@ -1,6 +1,6 @@ model && (bool)$this->model->updateAttributes( + return $this->model && (bool) $this->model->updateAttributes( [ - 'password_hash' => $this->securityHelper->generatePasswordHash($this->password) + 'password_hash' => $this->securityHelper->generatePasswordHash($this->password), ] ); } - } diff --git a/lib/User/Service/SocialNetworkAccountConnectService.php b/lib/User/Service/SocialNetworkAccountConnectService.php index 4cd773c..54be914 100644 --- a/lib/User/Service/SocialNetworkAccountConnectService.php +++ b/lib/User/Service/SocialNetworkAccountConnectService.php @@ -1,6 +1,6 @@ controller->trigger(SocialNetworkAuthEvent::EVENT_AFTER_CONNECT, $event); return true; - } else { Yii::$app->session->setFlash( 'danger', @@ -77,7 +75,7 @@ class SocialNetworkAccountConnectService implements ServiceInterface [ 'provider' => $this->client->getId(), 'client_id' => $data['id'], - 'data' => json_encode($data) + 'data' => json_encode($data), ] ); diff --git a/lib/User/Service/SocialNetworkAuthenticateService.php b/lib/User/Service/SocialNetworkAuthenticateService.php index 5e6e475..f027773 100644 --- a/lib/User/Service/SocialNetworkAuthenticateService.php +++ b/lib/User/Service/SocialNetworkAuthenticateService.php @@ -1,6 +1,6 @@ userQuery = $userQuery; } - public function run() { $account = $this->socialNetworkAccountQuery->whereClient($this->client)->one(); @@ -87,7 +85,7 @@ class SocialNetworkAuthenticateService implements ServiceInterface 'client_id' => $data['id'], 'data' => json_encode($data), 'username' => $this->client->getUserName(), - 'email' => $this->client->getEmail() + 'email' => $this->client->getEmail(), ] ); @@ -113,7 +111,7 @@ class SocialNetworkAuthenticateService implements ServiceInterface [ 'scenario' => 'connect', 'username' => $account->username, - 'email' => $account->email + 'email' => $account->email, ] ); diff --git a/lib/User/Service/UpdateAuthAssignmentsService.php b/lib/User/Service/UpdateAuthAssignmentsService.php index 0cad148..9091cb7 100644 --- a/lib/User/Service/UpdateAuthAssignmentsService.php +++ b/lib/User/Service/UpdateAuthAssignmentsService.php @@ -1,6 +1,6 @@ model->updated = true; - } } diff --git a/lib/User/Service/UserBlockService.php b/lib/User/Service/UserBlockService.php index a5789c9..022b6e5 100644 --- a/lib/User/Service/UserBlockService.php +++ b/lib/User/Service/UserBlockService.php @@ -1,4 +1,5 @@ model->getIsBlocked()) { $this->controller->trigger(UserEvent::EVENT_BEFORE_UNBLOCK, $this->event); - $result = (bool)$this->model->updateAttributes(['blocked_at' => null]); + $result = (bool) $this->model->updateAttributes(['blocked_at' => null]); $this->controller->trigger(UserEvent::EVENT_AFTER_UNBLOCK, $this->event); } else { $this->controller->trigger(UserEvent::EVENT_BEFORE_BLOCK, $this->event); - $result = (bool)$this->model->updateAttributes( + $result = (bool) $this->model->updateAttributes( ['blocked_at' => time(), 'auth_key' => $this->securityHelper->generateRandomString()] ); $this->controller->trigger(UserEvent::EVENT_AFTER_BLOCK, $this->event); } + return $result; } } diff --git a/lib/User/Service/UserConfirmationService.php b/lib/User/Service/UserConfirmationService.php index 9d255c9..304e781 100644 --- a/lib/User/Service/UserConfirmationService.php +++ b/lib/User/Service/UserConfirmationService.php @@ -1,4 +1,5 @@ model->trigger(UserEvent::EVENT_BEFORE_CONFIRMATION); - if ((bool)$this->model->updateAttributes(['confirmed_at' => time()])) { + if ((bool) $this->model->updateAttributes(['confirmed_at' => time()])) { $this->model->trigger(UserEvent::EVENT_AFTER_CONFIRMATION); return true; } + return false; } } diff --git a/lib/User/Service/UserCreateService.php b/lib/User/Service/UserCreateService.php index a01594a..6e5e7ed 100644 --- a/lib/User/Service/UserCreateService.php +++ b/lib/User/Service/UserCreateService.php @@ -1,4 +1,5 @@ commit(); return true; - } catch (Exception $e) { - $transaction->rollBack(); $this->logger->log($e->getMessage(), Logger::LEVEL_ERROR); return false; } } - } diff --git a/lib/User/Service/UserRegisterService.php b/lib/User/Service/UserRegisterService.php index bcc812e..99f07bc 100644 --- a/lib/User/Service/UserRegisterService.php +++ b/lib/User/Service/UserRegisterService.php @@ -1,4 +1,5 @@ trigger(UserEvent::EVENT_BEFORE_REGISTER); - if(!$model->save()) { + if (!$model->save()) { $transaction->rollBack(); + return false; } - if($this->getModule()->enableEmailConfirmation) { + if ($this->getModule()->enableEmailConfirmation) { $token = TokenFactory::makeConfirmationToken($model->id); } - if(isset($token)) { + if (isset($token)) { $this->mailService->setViewParam('token', $token); } $this->mailService->run(); @@ -66,13 +68,11 @@ class UserRegisterService implements ServiceInterface $transaction->commit(); return true; - - } catch(Exception $e) { + } catch (Exception $e) { $transaction->rollBack(); $this->logger->log($e->getMessage(), Logger::LEVEL_WARNING); return false; } } - } diff --git a/lib/User/Strategy/DefaultEmailChangeStrategy.php b/lib/User/Strategy/DefaultEmailChangeStrategy.php index 6b4acce..7962a9f 100644 --- a/lib/User/Strategy/DefaultEmailChangeStrategy.php +++ b/lib/User/Strategy/DefaultEmailChangeStrategy.php @@ -1,4 +1,5 @@ form = $form; - } public function run() @@ -37,7 +37,5 @@ class DefaultEmailChangeStrategy implements MailChangeStrategyInterface } return false; - } - } diff --git a/lib/User/Strategy/InsecureEmailChangeStrategy.php b/lib/User/Strategy/InsecureEmailChangeStrategy.php index 546496f..0356978 100644 --- a/lib/User/Strategy/InsecureEmailChangeStrategy.php +++ b/lib/User/Strategy/InsecureEmailChangeStrategy.php @@ -1,10 +1,10 @@ form->getUser()->email = $this->form->email; + return $this->form->getUser()->save(); } - } diff --git a/lib/User/Strategy/SecureEmailChangeStrategy.php b/lib/User/Strategy/SecureEmailChangeStrategy.php index df8d605..a2ae9cc 100644 --- a/lib/User/Strategy/SecureEmailChangeStrategy.php +++ b/lib/User/Strategy/SecureEmailChangeStrategy.php @@ -1,4 +1,5 @@ form = $form; - } public function run() { if ($this->make(DefaultEmailChangeStrategy::class, [$this->form])->run()) { - $token = TokenFactory::makeConfirmOldMailToken($this->form->getUser()->id); $mailService = MailFactory::makeReconfirmationMailerService($this->form->getUser(), $token); @@ -39,7 +38,7 @@ class SecureEmailChangeStrategy implements MailChangeStrategyInterface 'info', Yii::t( 'user', - 'We have sent confirmation links to both old and new email addresses. ' . + 'We have sent confirmation links to both old and new email addresses. '. 'You must click both links to complete your request.' ) ); @@ -51,5 +50,4 @@ class SecureEmailChangeStrategy implements MailChangeStrategyInterface return false; } - } diff --git a/lib/User/Traits/AuthManagerTrait.php b/lib/User/Traits/AuthManagerTrait.php index 5e041f9..2d2b02b 100644 --- a/lib/User/Traits/AuthManagerTrait.php +++ b/lib/User/Traits/AuthManagerTrait.php @@ -1,4 +1,5 @@ getAuthManager(); } } diff --git a/lib/User/Traits/ContainerTrait.php b/lib/User/Traits/ContainerTrait.php index 6c9e125..dbeb0e1 100644 --- a/lib/User/Traits/ContainerTrait.php +++ b/lib/User/Traits/ContainerTrait.php @@ -8,11 +8,9 @@ use Yii; use yii\di\Container; /** - * * @property-read Container $di * @property-ready Da\User\Helper\AuthHelper $auth * @property-ready Da\User\Helper\ClassMapHelper $classMap - * */ trait ContainerTrait { @@ -27,11 +25,10 @@ trait ContainerTrait /** * Gets a class from the container. * - * @param string $class he class name or an alias name (e.g. `foo`) that was previously registered via [[set()]] - * or [[setSingleton()]]. - * - * @param array $params constructor parameters - * @param array $config attributes + * @param string $class he class name or an alias name (e.g. `foo`) that was previously registered via [[set()]] + * or [[setSingleton()]] + * @param array $params constructor parameters + * @param array $config attributes * * @return object */ @@ -55,5 +52,4 @@ trait ContainerTrait { return $this->getDi()->get(ClassMapHelper::class); } - } diff --git a/lib/User/Traits/ModuleTrait.php b/lib/User/Traits/ModuleTrait.php index 05d3385..5fb74c4 100644 --- a/lib/User/Traits/ModuleTrait.php +++ b/lib/User/Traits/ModuleTrait.php @@ -2,7 +2,6 @@ namespace Da\User\Traits; -use Da\User\Helper\AuthHelper; use Da\User\Module; use Yii; diff --git a/lib/User/Validator/AjaxRequestModelValidator.php b/lib/User/Validator/AjaxRequestModelValidator.php index deed1bf..4bcde30 100644 --- a/lib/User/Validator/AjaxRequestModelValidator.php +++ b/lib/User/Validator/AjaxRequestModelValidator.php @@ -1,4 +1,5 @@ request; - if($request->getIsAjax() && !$request->getIsPjax()) { - if($this->model->load($request->post())) { + if ($request->getIsAjax() && !$request->getIsPjax()) { + if ($this->model->load($request->post())) { Yii::$app->response->format = Response::FORMAT_JSON; echo json_encode(ActiveForm::validate($this->model)); Yii::$app->end(); diff --git a/lib/User/Validator/RbacItemsValidator.php b/lib/User/Validator/RbacItemsValidator.php index 1960689..047bf09 100644 --- a/lib/User/Validator/RbacItemsValidator.php +++ b/lib/User/Validator/RbacItemsValidator.php @@ -1,4 +1,5 @@ timezone, timezone_identifiers_list()); } - } diff --git a/lib/User/Widget/AssignmentsWidget.php b/lib/User/Widget/AssignmentsWidget.php index 2d79f8d..46b4262 100644 --- a/lib/User/Widget/AssignmentsWidget.php +++ b/lib/User/Widget/AssignmentsWidget.php @@ -16,7 +16,7 @@ class AssignmentsWidget extends Widget use ContainerTrait; /** - * @var integer ID of the user to whom auth items will be assigned. + * @var int ID of the user to whom auth items will be assigned */ public $userId; /** @@ -25,19 +25,20 @@ class AssignmentsWidget extends Widget public $params = []; /** - * @inheritdoc + * {@inheritdoc} + * * @throws InvalidConfigException */ public function init() { parent::init(); if ($this->userId === null) { - throw new InvalidConfigException( __CLASS__ . '::$userId is required'); + throw new InvalidConfigException(__CLASS__.'::$userId is required'); } } /** - * @inheritdoc + * {@inheritdoc} */ public function run() { @@ -49,12 +50,12 @@ class AssignmentsWidget extends Widget return $this->render('/widgets/assignments/form', [ 'model' => $model, - 'availableItems' => $this->getAvailableItems() + 'availableItems' => $this->getAvailableItems(), ]); } /** - * Returns all available auth items to be attached to the user + * Returns all available auth items to be attached to the user. * * @return array */ @@ -63,7 +64,7 @@ class AssignmentsWidget extends Widget return ArrayHelper::map($this->getAuthManager()->getItems(), 'name', function ($item) { return empty($item->description) ? $item->name - : $item->name . ' (' . $item->description . ')'; + : $item->name.' ('.$item->description.')'; }); } } diff --git a/lib/User/Widget/ConnectWidget.php b/lib/User/Widget/ConnectWidget.php index 5514d79..825387e 100644 --- a/lib/User/Widget/ConnectWidget.php +++ b/lib/User/Widget/ConnectWidget.php @@ -1,6 +1,6 @@ view); if ($this->popupMode) { - Yii::$app->view->registerJs("\$('#" . $this->getId() . "').authchoice();"); + Yii::$app->view->registerJs("\$('#".$this->getId()."').authchoice();"); } $this->options['id'] = $this->getId(); echo Html::beginTag('div', $this->options); } /** - * @inheritdoc + * {@inheritdoc} */ public function createClientUrl($provider) { diff --git a/lib/User/Widget/LoginWidget.php b/lib/User/Widget/LoginWidget.php index a86ff64..375a093 100644 --- a/lib/User/Widget/LoginWidget.php +++ b/lib/User/Widget/LoginWidget.php @@ -1,4 +1,5 @@ render( '/widgets/login', [ - 'model' => Yii::createObject(LoginForm::class) + 'model' => Yii::createObject(LoginForm::class), ] ); } diff --git a/lib/User/resources/i18n/message.php b/lib/User/resources/i18n/message.php index 63f6077..7a70dab 100644 --- a/lib/User/resources/i18n/message.php +++ b/lib/User/resources/i18n/message.php @@ -1,7 +1,7 @@ __DIR__ . '/../User', + 'sourcePath' => __DIR__.'/../User', 'messagePath' => __DIR__, 'languages' => [ 'ca', @@ -40,7 +40,7 @@ return [ '.gitignore', '.gitkeep', '.hgignore', - '.hgkeep' + '.hgkeep', ], 'format' => 'php', ]; diff --git a/lib/User/resources/views/admin/_account.php b/lib/User/resources/views/admin/_account.php index a6a4178..0e31ee5 100644 --- a/lib/User/resources/views/admin/_account.php +++ b/lib/User/resources/views/admin/_account.php @@ -3,7 +3,7 @@ use yii\bootstrap\ActiveForm; use yii\helpers\Html; -/** +/* * @var yii\web\View $this * @var \Da\User\Model\User $user */ diff --git a/lib/User/resources/views/admin/_assignments.php b/lib/User/resources/views/admin/_assignments.php index 99dd900..d031933 100644 --- a/lib/User/resources/views/admin/_assignments.php +++ b/lib/User/resources/views/admin/_assignments.php @@ -2,7 +2,7 @@ use Da\User\Widget\AssignmentsWidget; -/** +/* * @var yii\web\View $this * @var \Da\User\Model\User $user * @var string[] $params diff --git a/lib/User/resources/views/admin/_info.php b/lib/User/resources/views/admin/_info.php index c2a5e0d..ce1a1ed 100644 --- a/lib/User/resources/views/admin/_info.php +++ b/lib/User/resources/views/admin/_info.php @@ -1,7 +1,7 @@ diff --git a/lib/User/resources/views/admin/_profile.php b/lib/User/resources/views/admin/_profile.php index 6faea30..e24ca84 100644 --- a/lib/User/resources/views/admin/_profile.php +++ b/lib/User/resources/views/admin/_profile.php @@ -3,7 +3,7 @@ use yii\bootstrap\ActiveForm; use yii\helpers\Html; -/** +/* * @var yii\web\View $this * @var \Da\User\Model\User $user * @var \Da\User\Model\Profile $profile diff --git a/lib/User/resources/views/admin/_user.php b/lib/User/resources/views/admin/_user.php index fc52dc7..5c6d1fb 100644 --- a/lib/User/resources/views/admin/_user.php +++ b/lib/User/resources/views/admin/_user.php @@ -1,7 +1,7 @@ diff --git a/lib/User/resources/views/admin/create.php b/lib/User/resources/views/admin/create.php index daf4779..e80a12a 100644 --- a/lib/User/resources/views/admin/create.php +++ b/lib/User/resources/views/admin/create.php @@ -4,7 +4,7 @@ use yii\bootstrap\ActiveForm; use yii\bootstrap\Nav; use yii\helpers\Html; -/** +/* * @var yii\web\View $this * @var \Da\User\Model\User $user */ @@ -42,21 +42,21 @@ $this->params['breadcrumbs'][] = $this->title; 'items' => [ [ 'label' => Yii::t('user', 'Account details'), - 'url' => ['/user/admin/create'] + 'url' => ['/user/admin/create'], ], [ 'label' => Yii::t('user', 'Profile details'), 'options' => [ 'class' => 'disabled', 'onclick' => 'return false;', - ] + ], ], [ 'label' => Yii::t('user', 'Information'), 'options' => [ 'class' => 'disabled', 'onclick' => 'return false;', - ] + ], ], ], ] diff --git a/lib/User/resources/views/admin/index.php b/lib/User/resources/views/admin/index.php index 5a315af..0aba39d 100644 --- a/lib/User/resources/views/admin/index.php +++ b/lib/User/resources/views/admin/index.php @@ -7,7 +7,7 @@ use yii\helpers\Html; use yii\web\View; use yii\widgets\Pjax; -/** +/* * @var View $this * @var ActiveDataProvider $dataProvider * @var UserSearch $searchModel @@ -33,7 +33,7 @@ $this->params['breadcrumbs'][] = $this->title; 'attribute' => 'registration_ip', 'value' => function ($model) { return $model->registration_ip == null - ? '' . Yii::t('user', '(not set)') . '' + ? ''.Yii::t('user', '(not set)').'' : $model->registration_ip; }, 'format' => 'html', @@ -53,7 +53,7 @@ $this->params['breadcrumbs'][] = $this->title; 'value' => function ($model) { if ($model->isConfirmed) { return '
- ' . Yii::t('user', 'Confirmed') . ' + ' .Yii::t('user', 'Confirmed').'
'; } else { return Html::a( diff --git a/lib/User/resources/views/admin/update.php b/lib/User/resources/views/admin/update.php index a3c1411..37a670f 100644 --- a/lib/User/resources/views/admin/update.php +++ b/lib/User/resources/views/admin/update.php @@ -5,7 +5,7 @@ use yii\bootstrap\Nav; use yii\web\View; use yii\helpers\Html; -/** +/* * @var View $this * @var User $user * @var string $content @@ -44,15 +44,15 @@ $this->params['breadcrumbs'][] = $this->title; 'items' => [ [ 'label' => Yii::t('user', 'Account details'), - 'url' => ['/user/admin/update', 'id' => $user->id] + 'url' => ['/user/admin/update', 'id' => $user->id], ], [ 'label' => Yii::t('user', 'Profile details'), - 'url' => ['/user/admin/update-profile', 'id' => $user->id] + 'url' => ['/user/admin/update-profile', 'id' => $user->id], ], [ 'label' => Yii::t('user', 'Information'), - 'url' => ['/user/admin/info', 'id' => $user->id] + 'url' => ['/user/admin/info', 'id' => $user->id], ], [ 'label' => Yii::t('user', 'Assignments'), diff --git a/lib/User/resources/views/mail/confirmation.php b/lib/User/resources/views/mail/confirmation.php index df27956..d9784b7 100644 --- a/lib/User/resources/views/mail/confirmation.php +++ b/lib/User/resources/views/mail/confirmation.php @@ -2,7 +2,7 @@ use yii\helpers\Html; -/** +/* * @var \Da\User\Model\User $user * @var \Da\User\Model\Token $token */ diff --git a/lib/User/resources/views/mail/layouts/html.php b/lib/User/resources/views/mail/layouts/html.php index 8981ab4..6b8d772 100644 --- a/lib/User/resources/views/mail/layouts/html.php +++ b/lib/User/resources/views/mail/layouts/html.php @@ -1,6 +1,6 @@ diff --git a/lib/User/resources/views/mail/layouts/text.php b/lib/User/resources/views/mail/layouts/text.php index 43ce060..189336f 100644 --- a/lib/User/resources/views/mail/layouts/text.php +++ b/lib/User/resources/views/mail/layouts/text.php @@ -1,6 +1,6 @@ diff --git a/lib/User/resources/views/mail/reconfirmation.php b/lib/User/resources/views/mail/reconfirmation.php index 02073c1..b1abc1c 100644 --- a/lib/User/resources/views/mail/reconfirmation.php +++ b/lib/User/resources/views/mail/reconfirmation.php @@ -1,7 +1,7 @@ diff --git a/lib/User/resources/views/mail/recovery.php b/lib/User/resources/views/mail/recovery.php index 1a98f78..c37548e 100644 --- a/lib/User/resources/views/mail/recovery.php +++ b/lib/User/resources/views/mail/recovery.php @@ -2,7 +2,7 @@ use yii\helpers\Html; -/** +/* * @var \Da\User\Model\User $user * @var \Da\User\Model\Token $token */ diff --git a/lib/User/resources/views/mail/text/confirmation.php b/lib/User/resources/views/mail/text/confirmation.php index e1d2daf..a697849 100644 --- a/lib/User/resources/views/mail/text/confirmation.php +++ b/lib/User/resources/views/mail/text/confirmation.php @@ -1,8 +1,8 @@ , diff --git a/lib/User/resources/views/mail/text/reconfirmation.php b/lib/User/resources/views/mail/text/reconfirmation.php index 6c5a388..1b19562 100644 --- a/lib/User/resources/views/mail/text/reconfirmation.php +++ b/lib/User/resources/views/mail/text/reconfirmation.php @@ -1,6 +1,6 @@ , diff --git a/lib/User/resources/views/mail/text/recovery.php b/lib/User/resources/views/mail/text/recovery.php index 9be9cad..5bb7c6b 100644 --- a/lib/User/resources/views/mail/text/recovery.php +++ b/lib/User/resources/views/mail/text/recovery.php @@ -1,7 +1,7 @@ , diff --git a/lib/User/resources/views/mail/text/welcome.php b/lib/User/resources/views/mail/text/welcome.php index 8cff168..44a3ae4 100644 --- a/lib/User/resources/views/mail/text/welcome.php +++ b/lib/User/resources/views/mail/text/welcome.php @@ -1,9 +1,9 @@ , diff --git a/lib/User/resources/views/mail/welcome.php b/lib/User/resources/views/mail/welcome.php index 1e708ac..97b1c37 100644 --- a/lib/User/resources/views/mail/welcome.php +++ b/lib/User/resources/views/mail/welcome.php @@ -1,7 +1,7 @@ false, - 'enableAjaxValidation' => true, + 'enableAjaxValidation' => true, ]) ?> field($model, 'name') ?> @@ -27,7 +26,7 @@ use yii\helpers\Html; 'data' => $unassignedItems, 'options' => [ 'id' => 'children', - 'multiple' => true + 'multiple' => true, ], ]) ?> diff --git a/lib/User/resources/views/permission/create.php b/lib/User/resources/views/permission/create.php index 27d4095..5eb8ce8 100644 --- a/lib/User/resources/views/permission/create.php +++ b/lib/User/resources/views/permission/create.php @@ -1,11 +1,10 @@ title = Yii::t('user', 'Create new permission'); $this->params['breadcrumbs'][] = $this->title; @@ -17,7 +16,7 @@ $this->params['breadcrumbs'][] = $this->title; '_form', [ 'model' => $model, - 'unassignedItems' => $unassignedItems + 'unassignedItems' => $unassignedItems, ] ) ?> diff --git a/lib/User/resources/views/permission/index.php b/lib/User/resources/views/permission/index.php index 450b4b6..b80dccb 100644 --- a/lib/User/resources/views/permission/index.php +++ b/lib/User/resources/views/permission/index.php @@ -1,11 +1,10 @@ params['breadcrumbs'][] = $this->title; 'attribute' => 'name', 'header' => Yii::t('user', 'Name'), 'options' => [ - 'style' => 'width: 20%' + 'style' => 'width: 20%', ], ], [ 'attribute' => 'description', 'header' => Yii::t('user', 'Description'), 'options' => [ - 'style' => 'width: 55%' + 'style' => 'width: 55%', ], ], [ 'attribute' => 'rule_name', 'header' => Yii::t('user', 'Rule name'), 'options' => [ - 'style' => 'width: 20%' + 'style' => 'width: 20%', ], ], [ 'class' => ActionColumn::className(), 'template' => '{update} {delete}', 'urlCreator' => function ($action, $model) { - return Url::to(['/user/permission/' . $action, 'name' => $model['name']]); + return Url::to(['/user/permission/'.$action, 'name' => $model['name']]); }, 'options' => [ - 'style' => 'width: 5%' + 'style' => 'width: 5%', ], - ] + ], ], ] ) ?> diff --git a/lib/User/resources/views/permission/update.php b/lib/User/resources/views/permission/update.php index 8124521..e5034c3 100644 --- a/lib/User/resources/views/permission/update.php +++ b/lib/User/resources/views/permission/update.php @@ -1,11 +1,10 @@ title = Yii::t('user', 'Update permission'); $this->params['breadcrumbs'][] = $this->title; @@ -17,7 +16,7 @@ $this->params['breadcrumbs'][] = $this->title; '_form', [ 'model' => $model, - 'unassignedItems' => $unassignedItems + 'unassignedItems' => $unassignedItems, ] ) ?> diff --git a/lib/User/resources/views/profile/show.php b/lib/User/resources/views/profile/show.php index bdabcae..7a67cac 100644 --- a/lib/User/resources/views/profile/show.php +++ b/lib/User/resources/views/profile/show.php @@ -2,7 +2,7 @@ use yii\helpers\Html; -/** +/* * @var \yii\web\View $this * @var \Da\User\Model\Profile $profile */ @@ -16,7 +16,7 @@ $this->params['breadcrumbs'][] = $this->title;
getAvatarUrl(230), [ 'class' => 'img-rounded img-responsive', - 'alt' => $profile->user->username, + 'alt' => $profile->user->username, ]) ?>
@@ -37,7 +37,7 @@ $this->params['breadcrumbs'][] = $this->title; public_email)): ?>
  • - public_email), 'mailto:' . + public_email), 'mailto:'. Html::encode($profile->public_email)) ?>
  • diff --git a/lib/User/resources/views/recovery/request.php b/lib/User/resources/views/recovery/request.php index fce2d37..02046a8 100644 --- a/lib/User/resources/views/recovery/request.php +++ b/lib/User/resources/views/recovery/request.php @@ -2,7 +2,7 @@ use yii\helpers\Html; use yii\widgets\ActiveForm; -/** +/* * @var yii\web\View $this * @var yii\widgets\ActiveForm $form * @var \Da\User\Form\RecoveryForm $model diff --git a/lib/User/resources/views/recovery/reset.php b/lib/User/resources/views/recovery/reset.php index 3ced36c..ba12b13 100644 --- a/lib/User/resources/views/recovery/reset.php +++ b/lib/User/resources/views/recovery/reset.php @@ -3,7 +3,7 @@ use yii\helpers\Html; use yii\widgets\ActiveForm; -/** +/* * @var yii\web\View $this * @var yii\widgets\ActiveForm $form * @var \Da\User\Form\RecoveryForm $model diff --git a/lib/User/resources/views/registration/connect.php b/lib/User/resources/views/registration/connect.php index 992b098..b5e4d4e 100644 --- a/lib/User/resources/views/registration/connect.php +++ b/lib/User/resources/views/registration/connect.php @@ -2,7 +2,7 @@ use yii\helpers\Html; use yii\widgets\ActiveForm; -/** +/* * @var yii\web\View $this * @var yii\widgets\ActiveForm $form * @var \Da\User\Model\User $model diff --git a/lib/User/resources/views/registration/register.php b/lib/User/resources/views/registration/register.php index 966a4a1..d40fa72 100644 --- a/lib/User/resources/views/registration/register.php +++ b/lib/User/resources/views/registration/register.php @@ -3,7 +3,7 @@ use yii\helpers\Html; use yii\widgets\ActiveForm; -/** +/* * @var yii\web\View $this * @var \Da\User\Form\RegistrationForm $model * @var \Da\User\Model\User $user diff --git a/lib/User/resources/views/registration/resend.php b/lib/User/resources/views/registration/resend.php index 98b925b..464c875 100644 --- a/lib/User/resources/views/registration/resend.php +++ b/lib/User/resources/views/registration/resend.php @@ -2,7 +2,7 @@ use yii\helpers\Html; use yii\widgets\ActiveForm; -/** +/* * @var yii\web\View $this * @var \Da\User\Form\ResendForm $model */ diff --git a/lib/User/resources/views/role/_form.php b/lib/User/resources/views/role/_form.php index 49738fe..6760e45 100644 --- a/lib/User/resources/views/role/_form.php +++ b/lib/User/resources/views/role/_form.php @@ -1,8 +1,8 @@ get(AuthHelper::class)->getUnassignedItems($ 'data' => $unassignedItems, 'options' => [ 'id' => 'children', - 'multiple' => true + 'multiple' => true, ], ] ) ?> diff --git a/lib/User/resources/views/role/create.php b/lib/User/resources/views/role/create.php index 2624220..7fa028f 100644 --- a/lib/User/resources/views/role/create.php +++ b/lib/User/resources/views/role/create.php @@ -1,11 +1,10 @@ title = Yii::t('user', 'Create new role'); $this->params['breadcrumbs'][] = $this->title; @@ -17,7 +16,7 @@ $this->params['breadcrumbs'][] = $this->title; '_form', [ 'model' => $model, - 'unassignedItems' => $unassignedItems + 'unassignedItems' => $unassignedItems, ] ) ?> diff --git a/lib/User/resources/views/role/index.php b/lib/User/resources/views/role/index.php index 73a257a..1cb33a9 100644 --- a/lib/User/resources/views/role/index.php +++ b/lib/User/resources/views/role/index.php @@ -3,13 +3,12 @@ use yii\grid\ActionColumn; use yii\grid\GridView; use yii\helpers\Url; -/** +/* * @var $dataProvider array * @var $searchModel \Da\User\Search\RoleSearch * @var $this yii\web\View */ - $this->title = Yii::t('user', 'Roles'); $this->params['breadcrumbs'][] = $this->title; @@ -27,33 +26,33 @@ $this->params['breadcrumbs'][] = $this->title; 'attribute' => 'name', 'header' => Yii::t('user', 'Name'), 'options' => [ - 'style' => 'width: 20%' + 'style' => 'width: 20%', ], ], [ 'attribute' => 'description', 'header' => Yii::t('user', 'Description'), 'options' => [ - 'style' => 'width: 55%' + 'style' => 'width: 55%', ], ], [ 'attribute' => 'rule_name', 'header' => Yii::t('user', 'Rule name'), 'options' => [ - 'style' => 'width: 20%' + 'style' => 'width: 20%', ], ], [ 'class' => ActionColumn::className(), 'template' => '{update} {delete}', 'urlCreator' => function ($action, $model) { - return Url::to(['/user/role/' . $action, 'name' => $model['name']]); + return Url::to(['/user/role/'.$action, 'name' => $model['name']]); }, 'options' => [ - 'style' => 'width: 5%' + 'style' => 'width: 5%', ], - ] + ], ], ] ) ?> diff --git a/lib/User/resources/views/role/update.php b/lib/User/resources/views/role/update.php index c372c25..d2172e9 100644 --- a/lib/User/resources/views/role/update.php +++ b/lib/User/resources/views/role/update.php @@ -1,11 +1,10 @@ title = Yii::t('user', 'Update role'); $this->params['breadcrumbs'][] = $this->title; @@ -17,7 +16,7 @@ $this->params['breadcrumbs'][] = $this->title; '_form', [ 'model' => $model, - 'unassignedItems' => $unassignedItems + 'unassignedItems' => $unassignedItems, ] ) ?> diff --git a/lib/User/resources/views/security/login.php b/lib/User/resources/views/security/login.php index f53c3ca..27e94ac 100644 --- a/lib/User/resources/views/security/login.php +++ b/lib/User/resources/views/security/login.php @@ -4,7 +4,7 @@ use Da\User\Widget\ConnectWidget; use yii\helpers\Html; use yii\widgets\ActiveForm; -/** +/* * @var yii\web\View $this * @var \Da\User\Form\LoginForm $model * @var \Da\User\Module $module @@ -49,13 +49,13 @@ $this->params['breadcrumbs'][] = $this->title; ->passwordInput() ->label( Yii::t('user', 'Password') - . ($module->allowPasswordRecovery ? - ' (' . Html::a( + .($module->allowPasswordRecovery ? + ' ('.Html::a( Yii::t('user', 'Forgot password?'), ['/user/recovery/request'], ['tabindex' => '5'] ) - . ')' : '') + .')' : '') ) ?> field($model, 'rememberMe')->checkbox(['tabindex' => '4']) ?> diff --git a/lib/User/resources/views/settings/_menu.php b/lib/User/resources/views/settings/_menu.php index b0faa38..8c5d25f 100644 --- a/lib/User/resources/views/settings/_menu.php +++ b/lib/User/resources/views/settings/_menu.php @@ -34,7 +34,7 @@ $networksVisible = count(Yii::$app->authClientCollection->clients) > 0; [ 'label' => Yii::t('user', 'Networks'), 'url' => ['/user/settings/networks'], - 'visible' => $networksVisible + 'visible' => $networksVisible, ], ], ] diff --git a/lib/User/resources/views/settings/account.php b/lib/User/resources/views/settings/account.php index 89a5a9f..b5abe68 100644 --- a/lib/User/resources/views/settings/account.php +++ b/lib/User/resources/views/settings/account.php @@ -3,7 +3,7 @@ use yii\helpers\Html; use yii\widgets\ActiveForm; -/** +/* * @var yii\web\View $this * @var yii\widgets\ActiveForm $form * @var \Da\User\Form\SettingsForm $model @@ -27,13 +27,13 @@ $this->params['breadcrumbs'][] = $this->title;
    $model->formName(), - 'options' => ['class' => 'form-horizontal'], + 'id' => $model->formName(), + 'options' => ['class' => 'form-horizontal'], 'fieldConfig' => [ - 'template' => "{label}\n
    {input}
    \n
    {error}\n{hint}
    ", + 'template' => "{label}\n
    {input}
    \n
    {error}\n{hint}
    ", 'labelOptions' => ['class' => 'col-lg-3 control-label'], ], - 'enableAjaxValidation' => true, + 'enableAjaxValidation' => true, 'enableClientValidation' => false, ]); ?> @@ -69,8 +69,8 @@ $this->params['breadcrumbs'][] = $this->title; .

    'btn btn-danger', - 'data-method' => 'post', + 'class' => 'btn btn-danger', + 'data-method' => 'post', 'data-confirm' => Yii::t('user', 'Are you sure? There is no going back'), ]) ?>
    diff --git a/lib/User/resources/views/settings/networks.php b/lib/User/resources/views/settings/networks.php index 2cd63d8..47cd4da 100644 --- a/lib/User/resources/views/settings/networks.php +++ b/lib/User/resources/views/settings/networks.php @@ -3,7 +3,7 @@ use Da\User\Widget\ConnectWidget; use yii\helpers\Html; -/** +/* * @var yii\web\View $this * @var yii\widgets\ActiveForm $form * @var \Da\User\Model\User $user @@ -42,7 +42,7 @@ $this->params['breadcrumbs'][] = $this->title; getClients() as $client): ?> - 'auth-icon ' . $client->getName()]) ?> + 'auth-icon '.$client->getName()]) ?> getTitle() ?> diff --git a/lib/User/resources/views/settings/profile.php b/lib/User/resources/views/settings/profile.php index 3696b57..03fb348 100644 --- a/lib/User/resources/views/settings/profile.php +++ b/lib/User/resources/views/settings/profile.php @@ -5,7 +5,7 @@ use yii\widgets\ActiveForm; use yii\helpers\ArrayHelper; use Da\User\Helper\TimezoneHelper; -/** +/* * @var yii\web\View $this * @var yii\widgets\ActiveForm $form * @var \Da\User\Model\Profile $model @@ -55,7 +55,7 @@ $timezoneHelper = $model->make(TimezoneHelper::class); field($model, 'timezone') - ->dropDownList(ArrayHelper::map($timezoneHelper->getAll(),'timezone','name')); + ->dropDownList(ArrayHelper::map($timezoneHelper->getAll(), 'timezone', 'name')); ?> field($model, 'gravatar_email') diff --git a/lib/User/resources/views/shared/_alert.php b/lib/User/resources/views/shared/_alert.php index 82c0fe2..1a19104 100644 --- a/lib/User/resources/views/shared/_alert.php +++ b/lib/User/resources/views/shared/_alert.php @@ -2,7 +2,7 @@ use yii\bootstrap\Alert; -/** +/* * @var \Da\User\Module $module */ ?> @@ -14,7 +14,7 @@ use yii\bootstrap\Alert; ['class' => 'alert-dismissible alert-'.$type], - 'body' => $message + 'body' => $message, ]) ?> diff --git a/lib/User/resources/views/shared/_menu.php b/lib/User/resources/views/shared/_menu.php index 6efd76e..779cfeb 100644 --- a/lib/User/resources/views/shared/_menu.php +++ b/lib/User/resources/views/shared/_menu.php @@ -17,11 +17,11 @@ use yii\bootstrap\Nav; ], [ 'label' => Yii::t('user', 'Roles'), - 'url' => ['/user/role/index'] + 'url' => ['/user/role/index'], ], [ 'label' => Yii::t('user', 'Permissions'), - 'url' => ['/user/permission/index'] + 'url' => ['/user/permission/index'], ], [ 'label' => Yii::t('user', 'Create'), @@ -32,11 +32,11 @@ use yii\bootstrap\Nav; ], [ 'label' => Yii::t('user', 'New role'), - 'url' => ['/user/role/create'] + 'url' => ['/user/role/create'], ], [ 'label' => Yii::t('user', 'New permission'), - 'url' => ['/user/permission/create'] + 'url' => ['/user/permission/create'], ], ], ], diff --git a/lib/User/resources/views/shared/message.php b/lib/User/resources/views/shared/message.php index 7cad12b..b74b998 100644 --- a/lib/User/resources/views/shared/message.php +++ b/lib/User/resources/views/shared/message.php @@ -1,11 +1,10 @@ title = $title; ?> diff --git a/lib/User/resources/views/widgets/assignments/form.php b/lib/User/resources/views/widgets/assignments/form.php index 3d54888..b5bc910 100644 --- a/lib/User/resources/views/widgets/assignments/form.php +++ b/lib/User/resources/views/widgets/assignments/form.php @@ -5,7 +5,7 @@ use yii\bootstrap\Alert; use yii\helpers\Html; use yii\widgets\ActiveForm; -/** +/* * @var $model \Da\User\Model\Assignment * @var $availableItems string[] */ @@ -16,7 +16,7 @@ use yii\widgets\ActiveForm; [ - 'class' => 'alert-success' + 'class' => 'alert-success', ], 'body' => Yii::t('user', 'Assignments have been updated'), ]) ?> @@ -25,7 +25,7 @@ use yii\widgets\ActiveForm; false, - 'enableAjaxValidation' => false, + 'enableAjaxValidation' => false, ]) ?> @@ -34,7 +34,7 @@ use yii\widgets\ActiveForm; 'data' => $availableItems, 'options' => [ 'id' => 'items', - 'multiple' => true + 'multiple' => true, ], ]) ?> diff --git a/lib/User/resources/views/widgets/login/login.php b/lib/User/resources/views/widgets/login/login.php index 83dfef2..5a0fc1c 100644 --- a/lib/User/resources/views/widgets/login/login.php +++ b/lib/User/resources/views/widgets/login/login.php @@ -13,7 +13,7 @@ use yii\helpers\Url; use yii\widgets\ActiveForm; use yii\helpers\Html; -/** +/* * @var yii\web\View $this * @var yii\widgets\ActiveForm $form * @var dektrium\user\models\LoginForm $model @@ -24,13 +24,13 @@ use yii\helpers\Html; user->isGuest): ?> 'login-widget-form', - 'action' => Url::to(['/user/security/login']), - 'enableAjaxValidation' => true, + 'id' => 'login-widget-form', + 'action' => Url::to(['/user/security/login']), + 'enableAjaxValidation' => true, 'enableClientValidation' => false, - 'validateOnBlur' => false, - 'validateOnType' => false, - 'validateOnChange' => false, + 'validateOnBlur' => false, + 'validateOnType' => false, + 'validateOnChange' => false, ]) ?> field($model, 'login')->textInput(['placeholder' => 'Login']) ?> @@ -44,7 +44,7 @@ use yii\helpers\Html; 'btn btn-danger btn-block', - 'data-method' => 'post' + 'class' => 'btn btn-danger btn-block', + 'data-method' => 'post', ]) ?>