From 3bd843cb2ed7151a95a90cf29961fbf4e1939a9b Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Sun, 7 Mar 2021 16:51:28 -0500 Subject: [PATCH 01/20] first draft at rebranding --- Plugin.php | 100 +++++++------- README.md | 46 +++---- UPGRADE.md | 10 +- classes/AuthManager.php | 14 +- classes/AuthMiddleware.php | 2 +- classes/UserEventBase.php | 6 +- classes/UserRedirector.php | 2 +- components/Account.php | 70 +++++----- components/ResetPassword.php | 18 +-- components/Session.php | 34 ++--- composer.json | 8 +- config/config.php | 2 +- controllers/UserGroups.php | 8 +- controllers/Users.php | 34 ++--- controllers/usergroups/_list_toolbar.htm | 4 +- controllers/usergroups/config_form.yaml | 22 +-- controllers/usergroups/config_list.yaml | 8 +- controllers/usergroups/create.htm | 6 +- controllers/usergroups/preview.htm | 4 +- controllers/usergroups/update.htm | 8 +- controllers/users/_hint_activate.htm | 8 +- controllers/users/_hint_banned.htm | 8 +- controllers/users/_hint_guest.htm | 6 +- controllers/users/_hint_trashed.htm | 4 +- controllers/users/_list_toolbar.htm | 40 +++--- controllers/users/_preview_scoreboard.htm | 16 +-- controllers/users/_preview_toolbar.htm | 34 ++--- controllers/users/config_filter.yaml | 8 +- controllers/users/config_form.yaml | 16 +-- controllers/users/config_list.yaml | 8 +- controllers/users/create.htm | 6 +- controllers/users/preview.htm | 4 +- controllers/users/update.htm | 8 +- facades/Auth.php | 6 +- models/MailBlocker.php | 18 +-- models/Settings.php | 40 +++--- models/Throttle.php | 4 +- models/User.php | 28 ++-- models/UserGroup.php | 6 +- models/settings/fields.yaml | 48 +++---- models/user/columns.yaml | 20 +-- models/user/fields.yaml | 56 ++++---- models/usergroup/columns.yaml | 10 +- models/usergroup/fields.yaml | 8 +- notifyrules/UserActivatedEvent.php | 4 +- notifyrules/UserAttributeCondition.php | 6 +- notifyrules/UserRegisteredEvent.php | 4 +- phpunit.xml | 4 +- tests/UserPluginTestCase.php | 12 +- tests/unit/facades/AuthFacadeTest.php | 10 +- .../{ => v1.0.1}/create_throttle_table.php | 4 +- updates/{ => v1.0.1}/create_users_table.php | 4 +- .../{ => v1.0.11}/users_add_login_column.php | 6 +- .../users_rename_login_to_username.php | 4 +- updates/{ => v1.0.15}/users_add_surname.php | 4 +- .../create_mail_blockers_table.php | 4 +- .../{ => v1.1.1}/create_user_groups_table.php | 4 +- .../{ => v1.1.1}/seed_user_groups_table.php | 6 +- updates/{ => v1.2.0}/users_add_deleted_at.php | 4 +- .../update_timestamp_nullable.php | 4 +- updates/{ => v1.2.6}/users_add_last_seen.php | 6 +- updates/{ => v1.3.0}/users_add_guest_flag.php | 4 +- .../{ => v1.3.0}/users_add_superuser_flag.php | 4 +- updates/{ => v1.5.1}/users_add_ip_address.php | 4 +- updates/version.yaml | 130 +++++++++--------- 65 files changed, 524 insertions(+), 524 deletions(-) rename updates/{ => v1.0.1}/create_throttle_table.php (90%) rename updates/{ => v1.0.1}/create_users_table.php (91%) rename updates/{ => v1.0.11}/users_add_login_column.php (87%) rename updates/{ => v1.0.12}/users_rename_login_to_username.php (85%) rename updates/{ => v1.0.15}/users_add_surname.php (84%) rename updates/{ => v1.0.6}/create_mail_blockers_table.php (87%) rename updates/{ => v1.1.1}/create_user_groups_table.php (91%) rename updates/{ => v1.1.1}/seed_user_groups_table.php (78%) rename updates/{ => v1.2.0}/users_add_deleted_at.php (84%) rename updates/{ => v1.2.5}/update_timestamp_nullable.php (81%) rename updates/{ => v1.2.6}/users_add_last_seen.php (80%) rename updates/{ => v1.3.0}/users_add_guest_flag.php (84%) rename updates/{ => v1.3.0}/users_add_superuser_flag.php (85%) rename updates/{ => v1.5.1}/users_add_ip_address.php (88%) diff --git a/Plugin.php b/Plugin.php index b781a62..1142da4 100644 --- a/Plugin.php +++ b/Plugin.php @@ -1,4 +1,4 @@ - 'rainlab.user::lang.plugin.name', - 'description' => 'rainlab.user::lang.plugin.description', + 'name' => 'winter.user::lang.plugin.name', + 'description' => 'winter.user::lang.plugin.description', 'author' => 'Alexey Bobkov, Samuel Georges', 'icon' => 'icon-user', - 'homepage' => 'https://github.com/rainlab/user-plugin' + 'homepage' => 'https://github.com/wintercms/wn-user-plugin' ]; } public function register() { $alias = AliasLoader::getInstance(); - $alias->alias('Auth', 'RainLab\User\Facades\Auth'); + $alias->alias('Auth', 'Winter\User\Facades\Auth'); App::singleton('user.auth', function () { - return \RainLab\User\Classes\AuthManager::instance(); + return \Winter\User\Classes\AuthManager::instance(); }); App::singleton('redirect', function ($app) { @@ -61,7 +61,7 @@ public function register() }); /* - * Compatability with RainLab.Notify + * Compatability with Winter.Notify */ $this->bindNotificationEvents(); } @@ -69,30 +69,30 @@ public function register() public function registerComponents() { return [ - \RainLab\User\Components\Session::class => 'session', - \RainLab\User\Components\Account::class => 'account', - \RainLab\User\Components\ResetPassword::class => 'resetPassword' + \Winter\User\Components\Session::class => 'session', + \Winter\User\Components\Account::class => 'account', + \Winter\User\Components\ResetPassword::class => 'resetPassword' ]; } public function registerPermissions() { return [ - 'rainlab.users.access_users' => [ - 'tab' => 'rainlab.user::lang.plugin.tab', - 'label' => 'rainlab.user::lang.plugin.access_users' + 'winter.users.access_users' => [ + 'tab' => 'winter.user::lang.plugin.tab', + 'label' => 'winter.user::lang.plugin.access_users' ], - 'rainlab.users.access_groups' => [ - 'tab' => 'rainlab.user::lang.plugin.tab', - 'label' => 'rainlab.user::lang.plugin.access_groups' + 'winter.users.access_groups' => [ + 'tab' => 'winter.user::lang.plugin.tab', + 'label' => 'winter.user::lang.plugin.access_groups' ], - 'rainlab.users.access_settings' => [ - 'tab' => 'rainlab.user::lang.plugin.tab', - 'label' => 'rainlab.user::lang.plugin.access_settings' + 'winter.users.access_settings' => [ + 'tab' => 'winter.user::lang.plugin.tab', + 'label' => 'winter.user::lang.plugin.access_settings' ], - 'rainlab.users.impersonate_user' => [ - 'tab' => 'rainlab.user::lang.plugin.tab', - 'label' => 'rainlab.user::lang.plugin.impersonate_user' + 'winter.users.impersonate_user' => [ + 'tab' => 'winter.user::lang.plugin.tab', + 'label' => 'winter.user::lang.plugin.impersonate_user' ], ]; } @@ -101,25 +101,25 @@ public function registerNavigation() { return [ 'user' => [ - 'label' => 'rainlab.user::lang.users.menu_label', - 'url' => Backend::url('rainlab/user/users'), + 'label' => 'winter.user::lang.users.menu_label', + 'url' => Backend::url('winter/user/users'), 'icon' => 'icon-user', - 'iconSvg' => 'plugins/rainlab/user/assets/images/user-icon.svg', - 'permissions' => ['rainlab.users.*'], + 'iconSvg' => 'plugins/winter/user/assets/images/user-icon.svg', + 'permissions' => ['winter.users.*'], 'order' => 500, 'sideMenu' => [ 'users' => [ - 'label' => 'rainlab.user::lang.users.menu_label', + 'label' => 'winter.user::lang.users.menu_label', 'icon' => 'icon-user', - 'url' => Backend::url('rainlab/user/users'), - 'permissions' => ['rainlab.users.access_users'] + 'url' => Backend::url('winter/user/users'), + 'permissions' => ['winter.users.access_users'] ], 'usergroups' => [ - 'label' => 'rainlab.user::lang.groups.menu_label', + 'label' => 'winter.user::lang.groups.menu_label', 'icon' => 'icon-users', - 'url' => Backend::url('rainlab/user/usergroups'), - 'permissions' => ['rainlab.users.access_groups'] + 'url' => Backend::url('winter/user/usergroups'), + 'permissions' => ['winter.users.access_groups'] ] ] ] @@ -130,13 +130,13 @@ public function registerSettings() { return [ 'settings' => [ - 'label' => 'rainlab.user::lang.settings.menu_label', - 'description' => 'rainlab.user::lang.settings.menu_description', + 'label' => 'winter.user::lang.settings.menu_label', + 'description' => 'winter.user::lang.settings.menu_description', 'category' => SettingsManager::CATEGORY_USERS, 'icon' => 'icon-cog', - 'class' => 'RainLab\User\Models\Settings', + 'class' => 'Winter\User\Models\Settings', 'order' => 500, - 'permissions' => ['rainlab.users.access_settings'] + 'permissions' => ['winter.users.access_settings'] ] ]; } @@ -144,12 +144,12 @@ public function registerSettings() public function registerMailTemplates() { return [ - 'rainlab.user::mail.activate', - 'rainlab.user::mail.welcome', - 'rainlab.user::mail.restore', - 'rainlab.user::mail.new_user', - 'rainlab.user::mail.reactivate', - 'rainlab.user::mail.invite', + 'winter.user::mail.activate', + 'winter.user::mail.welcome', + 'winter.user::mail.restore', + 'winter.user::mail.new_user', + 'winter.user::mail.reactivate', + 'winter.user::mail.invite', ]; } @@ -163,12 +163,12 @@ public function registerNotificationRules() ], ], 'events' => [ - \RainLab\User\NotifyRules\UserActivatedEvent::class, - \RainLab\User\NotifyRules\UserRegisteredEvent::class, + \Winter\User\NotifyRules\UserActivatedEvent::class, + \Winter\User\NotifyRules\UserRegisteredEvent::class, ], 'actions' => [], 'conditions' => [ - \RainLab\User\NotifyRules\UserAttributeCondition::class + \Winter\User\NotifyRules\UserAttributeCondition::class ], ]; } @@ -180,8 +180,8 @@ protected function bindNotificationEvents() } Notifier::bindEvents([ - 'rainlab.user.activate' => \RainLab\User\NotifyRules\UserActivatedEvent::class, - 'rainlab.user.register' => \RainLab\User\NotifyRules\UserRegisteredEvent::class + 'winter.user.activate' => \Winter\User\NotifyRules\UserActivatedEvent::class, + 'winter.user.register' => \Winter\User\NotifyRules\UserRegisteredEvent::class ]); Notifier::instance()->registerCallback(function ($manager) { diff --git a/README.md b/README.md index 80d3596..d8cafb1 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # Front-end user plugin -[![Build Status](https://img.shields.io/github/workflow/status/rainlab/user-plugin/Tests)](https://github.com/rainlab/user-plugin/actions) -[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/rainlab/user-plugin/blob/master/LICENCE.md) +[![Build Status](https://img.shields.io/github/workflow/status/rainlab/user-plugin/Tests)](https://github.com/wintercms/wn-user-plugin/actions) +[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/wintercms/wn-user-plugin/blob/master/LICENCE.md) -Front-end user management for October CMS. +Front-end user management for Winter CMS. ## Requirements @@ -47,11 +47,11 @@ As a security precaution, you may restrict users from having sessions across mul #### Notifications -When a user is first activated -- either by registration, email confirmation or administrator approval -- they are sent a welcome email. To disable the welcome email, select "Do not send a notification" from the **Welcome mail template** dropdown. The default message template used is `rainlab.user::mail.welcome` and you can customize this by selecting **Mail > Mail Templates** from the settings menu. +When a user is first activated -- either by registration, email confirmation or administrator approval -- they are sent a welcome email. To disable the welcome email, select "Do not send a notification" from the **Welcome mail template** dropdown. The default message template used is `winter.user::mail.welcome` and you can customize this by selecting **Mail > Mail Templates** from the settings menu. ## Extended features -For extra functionality, consider also installing the [User Plus+ plugin](http://octobercms.com/plugin/rainlab-userplus) (`RainLab.UserPlus`). +For extra functionality, consider also installing the [User Plus+ plugin](http://octobercms.com/plugin/rainlab-userplus) (`Winter.UserPlus`). ## Session component @@ -90,7 +90,7 @@ The `security` property can be user, guest or all. The `redirect` property refer Access to routes can be restricted by applying the `AuthMiddleware`. - Route::group(['middleware' => 'RainLab\User\Classes\AuthMiddleware'], function () { + Route::group(['middleware' => 'Winter\User\Classes\AuthMiddleware'], function () { // All routes here will require authentication }); @@ -153,7 +153,7 @@ By default, the User plugin requires a minimum password length of 8 characters f ### Flash messages -This plugin makes use of October's [`Flash API`](http://octobercms.com/docs/markup/tag-flash). In order to display the error messages, you need to place the following snippet in your layout or page. +This plugin makes use of Winter CMS's [`Flash API`](http://octobercms.com/docs/markup/tag-flash). In order to display the error messages, you need to place the following snippet in your layout or page. {% flash %}
{{ message }}
@@ -219,7 +219,7 @@ Here the local handler method will take priority over the **account** component' ## Auth facade -There is an `Auth` facade you may use for common tasks, it primarily inherits the `October\Rain\Auth\Manager` class for functionality. +There is an `Auth` facade you may use for common tasks, it primarily inherits the `Winter\Storm\Auth\Manager` class for functionality. You may use `Auth::register` to register an account: @@ -290,7 +290,7 @@ When a user registers with the same email address using the `Auth::register` met > **Important**: If you are using guest accounts, it is important to disable sensitive functionality for user accounts that are not verified, since it may be possible for anyone to inherit a guest account. -You may also convert a guest to a registered user with the `convertToRegistered` method. This will generate a random password and sends an invitation using the `rainlab.user::mail.invite` template. +You may also convert a guest to a registered user with the `convertToRegistered` method. This will generate a random password and sends an invitation using the `winter.user::mail.invite` template. $user->convertToRegistered(); @@ -302,26 +302,26 @@ To disable the notification and password reset, pass the first argument as false This plugin will fire some global events that can be useful for interacting with other plugins. -- **rainlab.user.beforeRegister**: Before the user's registration is processed. Passed the `$data` variable by reference to enable direct modifications to the `$data` provided to the `Auth::register()` method. -- **rainlab.user.register**: The user has successfully registered. Passed the `$user` object and the submitted `$data` variable. -- **rainlab.user.beforeAuthenticate**: Before the user is attempting to authenticate using the Account component. -- **rainlab.user.login**: The user has successfully signed in. -- **rainlab.user.logout**: The user has successfully signed out. -- **rainlab.user.deactivate**: The user has opted-out of the site by deactivating their account. This should be used to disable any content the user may want removed. -- **rainlab.user.reactivate**: The user has reactivated their own account by signing back in. This should revive the users content on the site. -- **rainlab.user.getNotificationVars**: Fires when sending a user notification to enable passing more variables to the email templates. Passes the `$user` model the template will be for. -- **rainlab.user.view.extendListToolbar**: Fires when the user listing page's toolbar is rendered. -- **rainlab.user.view.extendPreviewToolbar**: Fires when the user preview page's toolbar is rendered. +- **winter.user.beforeRegister**: Before the user's registration is processed. Passed the `$data` variable by reference to enable direct modifications to the `$data` provided to the `Auth::register()` method. +- **winter.user.register**: The user has successfully registered. Passed the `$user` object and the submitted `$data` variable. +- **winter.user.beforeAuthenticate**: Before the user is attempting to authenticate using the Account component. +- **winter.user.login**: The user has successfully signed in. +- **winter.user.logout**: The user has successfully signed out. +- **winter.user.deactivate**: The user has opted-out of the site by deactivating their account. This should be used to disable any content the user may want removed. +- **winter.user.reactivate**: The user has reactivated their own account by signing back in. This should revive the users content on the site. +- **winter.user.getNotificationVars**: Fires when sending a user notification to enable passing more variables to the email templates. Passes the `$user` model the template will be for. +- **winter.user.view.extendListToolbar**: Fires when the user listing page's toolbar is rendered. +- **winter.user.view.extendPreviewToolbar**: Fires when the user preview page's toolbar is rendered. Here is an example of hooking an event: - Event::listen('rainlab.user.deactivate', function($user) { + Event::listen('winter.user.deactivate', function($user) { // Hide all posts by the user }); -A common requirement is to adapt another to a legacy authentication system. In the example below, the `WordPressLogin::check` method would check the user password using an alternative hashing method, and if successful, update to the new one used by October. +A common requirement is to adapt another to a legacy authentication system. In the example below, the `WordPressLogin::check` method would check the user password using an alternative hashing method, and if successful, update to the new one used by Winter CMS. - Event::listen('rainlab.user.beforeAuthenticate', function($component, $credentials) { + Event::listen('winter.user.beforeAuthenticate', function($component, $credentials) { $login = array_get($credentials, 'login'); $password = array_get($credentials, 'password'); @@ -335,7 +335,7 @@ A common requirement is to adapt another to a legacy authentication system. In t /* * The user is logging in with their old WordPress account * for the first time. Rehash their password using the new - * October system. + * Winter CMS system. */ if (WordPressLogin::check($user->password, $password)) { $user->password = $user->password_confirmation = $password; diff --git a/UPGRADE.md b/UPGRADE.md index 77782af..8425b34 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -8,19 +8,19 @@ The User plugin has been split apart in to smaller more manageable plugins. These fields are no longer provided by the User plugin: `company`, `phone`, `street_addr`, `city`, `zip`, `country`, `state`. This is a non-destructive upgrade so the columns will remain in the database untouched. -Country and State models have been removed and can be replaced by installing the plugin **RainLab.Location**. The remaining profiles fields can be replaced by installing the plugin **RainLab.UserPlus**. +Country and State models have been removed and can be replaced by installing the plugin **Winter.Location**. The remaining profiles fields can be replaced by installing the plugin **Winter.UserPlus**. In short, to retain the old functionaliy simply install the following plugins: -- RainLab.Location -- RainLab.UserPlus +- Winter.Location +- Winter.UserPlus ## Upgrading To 1.4 -The Notifications tab in User settings has been removed. This feature has been replaced by the [Notify plugin](https://octobercms.com/plugin/rainlab-notify). How to replace this feature: +The Notifications tab in User settings has been removed. This feature has been replaced by the [Notify plugin](https://github.com/wintercms/wn-notify-plugin). How to replace this feature: -1. Install the `RainLab.Notify` plugin +1. Install the `Winter.Notify` plugin 1. Navigate to Settings > Notification rules 1. Click **New notification** rule 1. Select User > **Activated** diff --git a/classes/AuthManager.php b/classes/AuthManager.php index 269955c..85a8533 100644 --- a/classes/AuthManager.php +++ b/classes/AuthManager.php @@ -1,8 +1,8 @@ - /*Account*/'rainlab.user::lang.account.account', - 'description' => /*User management form.*/'rainlab.user::lang.account.account_desc' + 'name' => /*Account*/'winter.user::lang.account.account', + 'description' => /*User management form.*/'winter.user::lang.account.account_desc' ]; } @@ -38,26 +38,26 @@ public function defineProperties() { return [ 'redirect' => [ - 'title' => /*Redirect to*/'rainlab.user::lang.account.redirect_to', - 'description' => /*Page name to redirect to after update, sign in or registration.*/'rainlab.user::lang.account.redirect_to_desc', + 'title' => /*Redirect to*/'winter.user::lang.account.redirect_to', + 'description' => /*Page name to redirect to after update, sign in or registration.*/'winter.user::lang.account.redirect_to_desc', 'type' => 'dropdown', 'default' => '' ], 'paramCode' => [ - 'title' => /*Activation Code Param*/'rainlab.user::lang.account.code_param', - 'description' => /*The page URL parameter used for the registration activation code*/ 'rainlab.user::lang.account.code_param_desc', + 'title' => /*Activation Code Param*/'winter.user::lang.account.code_param', + 'description' => /*The page URL parameter used for the registration activation code*/ 'winter.user::lang.account.code_param_desc', 'type' => 'string', 'default' => 'code' ], 'forceSecure' => [ - 'title' => /*Force secure protocol*/'rainlab.user::lang.account.force_secure', - 'description' => /*Always redirect the URL with the HTTPS schema.*/'rainlab.user::lang.account.force_secure_desc', + 'title' => /*Force secure protocol*/'winter.user::lang.account.force_secure', + 'description' => /*Always redirect the URL with the HTTPS schema.*/'winter.user::lang.account.force_secure_desc', 'type' => 'checkbox', 'default' => 0 ], 'requirePassword' => [ - 'title' => /*Confirm password on update*/'rainlab.user::lang.account.update_requires_password', - 'description' => /*Require the current password of the user when changing their profile.*/'rainlab.user::lang.account.update_requires_password_comment', + 'title' => /*Confirm password on update*/'winter.user::lang.account.update_requires_password', + 'description' => /*Require the current password of the user when changing their profile.*/'winter.user::lang.account.update_requires_password_comment', 'type' => 'checkbox', 'default' => 0 ], @@ -142,8 +142,8 @@ public function loginAttribute() public function loginAttributeLabel() { return Lang::get($this->loginAttribute() == UserSettings::LOGIN_EMAIL - ? /*Email*/'rainlab.user::lang.login.attribute_email' - : /*Username*/'rainlab.user::lang.login.attribute_username' + ? /*Email*/'winter.user::lang.login.attribute_email' + : /*Username*/'winter.user::lang.login.attribute_username' ); } @@ -235,12 +235,12 @@ public function onSignin() break; } - Event::fire('rainlab.user.beforeAuthenticate', [$this, $credentials]); + Event::fire('winter.user.beforeAuthenticate', [$this, $credentials]); $user = Auth::authenticate($credentials, $remember); if ($user->isBanned()) { Auth::logout(); - throw new AuthException(/*Sorry, this user is currently not activated. Please contact us for further assistance.*/'rainlab.user::lang.account.banned'); + throw new AuthException(/*Sorry, this user is currently not activated. Please contact us for further assistance.*/'winter.user::lang.account.banned'); } /* @@ -270,11 +270,11 @@ public function onRegister() { try { if (!$this->canRegister()) { - throw new ApplicationException(Lang::get(/*Registrations are currently disabled.*/'rainlab.user::lang.account.registration_disabled')); + throw new ApplicationException(Lang::get(/*Registrations are currently disabled.*/'winter.user::lang.account.registration_disabled')); } if ($this->isRegisterThrottled()) { - throw new ApplicationException(Lang::get(/*Registration is throttled. Please try again later.*/'rainlab.user::lang.account.registration_throttled')); + throw new ApplicationException(Lang::get(/*Registration is throttled. Please try again later.*/'winter.user::lang.account.registration_throttled')); } /* @@ -307,7 +307,7 @@ public function onRegister() /* * Register user */ - Event::fire('rainlab.user.beforeRegister', [&$data]); + Event::fire('winter.user.beforeRegister', [&$data]); $requireActivation = UserSettings::get('require_activation', true); $automaticActivation = UserSettings::get('activate_mode') == UserSettings::ACTIVATE_AUTO; @@ -315,7 +315,7 @@ public function onRegister() $adminActivation = UserSettings::get('activate_mode') == UserSettings::ACTIVATE_ADMIN; $user = Auth::register($data, $automaticActivation); - Event::fire('rainlab.user.register', [$user, $data]); + Event::fire('winter.user.register', [$user, $data]); /* * Activation is by the user, send the email @@ -323,15 +323,15 @@ public function onRegister() if ($userActivation) { $this->sendActivationEmail($user); - Flash::success(Lang::get(/*An activation email has been sent to your email address.*/'rainlab.user::lang.account.activation_email_sent')); + Flash::success(Lang::get(/*An activation email has been sent to your email address.*/'winter.user::lang.account.activation_email_sent')); } /* * Activation is by the admin, show message - * For automatic email on account activation RainLab.Notify plugin is needed + * For automatic email on account activation Winter.Notify plugin is needed */ if ($adminActivation) { - Flash::success(Lang::get(/*You have successfully registered. Your account is not yet active and must be approved by an administrator.*/'rainlab.user::lang.account.activation_by_admin')); + Flash::success(Lang::get(/*You have successfully registered. Your account is not yet active and must be approved by an administrator.*/'winter.user::lang.account.activation_by_admin')); } /* @@ -363,7 +363,7 @@ public function onActivate($code = null) try { $code = post('code', $code); - $errorFields = ['code' => Lang::get(/*Invalid activation code supplied.*/'rainlab.user::lang.account.invalid_activation_code')]; + $errorFields = ['code' => Lang::get(/*Invalid activation code supplied.*/'winter.user::lang.account.invalid_activation_code')]; /* * Break up the code parts @@ -387,7 +387,7 @@ public function onActivate($code = null) throw new ValidationException($errorFields); } - Flash::success(Lang::get(/*Successfully activated your account.*/'rainlab.user::lang.account.success_activation')); + Flash::success(Lang::get(/*Successfully activated your account.*/'winter.user::lang.account.success_activation')); /* * Sign in the user @@ -414,7 +414,7 @@ public function onUpdate() if ($this->updateRequiresPassword()) { if (!$user->checkHashValue('password', $data['password_current'])) { - throw new ValidationException(['password_current' => Lang::get('rainlab.user::lang.account.invalid_current_pass')]); + throw new ValidationException(['password_current' => Lang::get('winter.user::lang.account.invalid_current_pass')]); } } @@ -432,7 +432,7 @@ public function onUpdate() Auth::login($user->reload(), true); } - Flash::success(post('flash', Lang::get(/*Settings successfully saved!*/'rainlab.user::lang.account.success_saved'))); + Flash::success(post('flash', Lang::get(/*Settings successfully saved!*/'winter.user::lang.account.success_saved'))); /* * Redirect @@ -454,13 +454,13 @@ public function onDeactivate() } if (!$user->checkHashValue('password', post('password'))) { - throw new ValidationException(['password' => Lang::get('rainlab.user::lang.account.invalid_deactivation_pass')]); + throw new ValidationException(['password' => Lang::get('winter.user::lang.account.invalid_deactivation_pass')]); } Auth::logout(); $user->delete(); - Flash::success(post('flash', Lang::get(/*Successfully deactivated your account. Sorry to see you go!*/'rainlab.user::lang.account.success_deactivation'))); + Flash::success(post('flash', Lang::get(/*Successfully deactivated your account. Sorry to see you go!*/'winter.user::lang.account.success_deactivation'))); /* * Redirect @@ -477,14 +477,14 @@ public function onSendActivationEmail() { try { if (!$user = $this->user()) { - throw new ApplicationException(Lang::get(/*You must be logged in first!*/'rainlab.user::lang.account.login_first')); + throw new ApplicationException(Lang::get(/*You must be logged in first!*/'winter.user::lang.account.login_first')); } if ($user->is_activated) { - throw new ApplicationException(Lang::get(/*Your account is already activated!*/'rainlab.user::lang.account.already_active')); + throw new ApplicationException(Lang::get(/*Your account is already activated!*/'winter.user::lang.account.already_active')); } - Flash::success(Lang::get(/*An activation email has been sent to your email address.*/'rainlab.user::lang.account.activation_email_sent')); + Flash::success(Lang::get(/*An activation email has been sent to your email address.*/'winter.user::lang.account.activation_email_sent')); $this->sendActivationEmail($user); @@ -547,7 +547,7 @@ protected function sendActivationEmail($user) 'code' => $code ]; - Mail::send('rainlab.user::mail.activate', $data, function($message) use ($user) { + Mail::send('winter.user::mail.activate', $data, function($message) use ($user) { $message->to($user->email, $user->name); }); } diff --git a/components/ResetPassword.php b/components/ResetPassword.php index 152218a..805aafe 100644 --- a/components/ResetPassword.php +++ b/components/ResetPassword.php @@ -1,4 +1,4 @@ - /*Reset Password*/'rainlab.user::lang.reset_password.reset_password', - 'description' => /*Forgotten password form.*/'rainlab.user::lang.reset_password.reset_password_desc' + 'name' => /*Reset Password*/'winter.user::lang.reset_password.reset_password', + 'description' => /*Forgotten password form.*/'winter.user::lang.reset_password.reset_password_desc' ]; } @@ -29,8 +29,8 @@ public function defineProperties() { return [ 'paramCode' => [ - 'title' => /*Reset Code Param*/'rainlab.user::lang.reset_password.code_param', - 'description' => /*The page URL parameter used for the reset code*/'rainlab.user::lang.reset_password.code_param_desc', + 'title' => /*Reset Code Param*/'winter.user::lang.reset_password.code_param', + 'description' => /*The page URL parameter used for the reset code*/'winter.user::lang.reset_password.code_param_desc', 'type' => 'string', 'default' => 'code' ] @@ -76,7 +76,7 @@ public function onRestorePassword() $user = UserModel::findByEmail(post('email')); if (!$user || $user->is_guest) { - throw new ApplicationException(Lang::get(/*A user was not found with the given credentials.*/'rainlab.user::lang.account.invalid_user')); + throw new ApplicationException(Lang::get(/*A user was not found with the given credentials.*/'winter.user::lang.account.invalid_user')); } $code = implode('!', [$user->id, $user->getResetPasswordCode()]); @@ -90,7 +90,7 @@ public function onRestorePassword() 'code' => $code ]; - Mail::send('rainlab.user::mail.restore', $data, function($message) use ($user) { + Mail::send('winter.user::mail.restore', $data, function($message) use ($user) { $message->to($user->email, $user->full_name); }); } @@ -110,7 +110,7 @@ public function onResetPassword() throw new ValidationException($validation); } - $errorFields = ['code' => Lang::get(/*Invalid activation code supplied.*/'rainlab.user::lang.account.invalid_activation_code')]; + $errorFields = ['code' => Lang::get(/*Invalid activation code supplied.*/'winter.user::lang.account.invalid_activation_code')]; /* * Break up the code parts diff --git a/components/Session.php b/components/Session.php index 0236cfe..cd9f7e5 100644 --- a/components/Session.php +++ b/components/Session.php @@ -1,4 +1,4 @@ - 'rainlab.user::lang.session.session', - 'description' => 'rainlab.user::lang.session.session_desc' + 'name' => 'winter.user::lang.session.session', + 'description' => 'winter.user::lang.session.session_desc' ]; } @@ -36,26 +36,26 @@ public function defineProperties() { return [ 'security' => [ - 'title' => 'rainlab.user::lang.session.security_title', - 'description' => 'rainlab.user::lang.session.security_desc', + 'title' => 'winter.user::lang.session.security_title', + 'description' => 'winter.user::lang.session.security_desc', 'type' => 'dropdown', 'default' => 'all', 'options' => [ - 'all' => 'rainlab.user::lang.session.all', - 'user' => 'rainlab.user::lang.session.users', - 'guest' => 'rainlab.user::lang.session.guests' + 'all' => 'winter.user::lang.session.all', + 'user' => 'winter.user::lang.session.users', + 'guest' => 'winter.user::lang.session.guests' ] ], 'allowedUserGroups' => [ - 'title' => 'rainlab.user::lang.session.allowed_groups_title', - 'description' => 'rainlab.user::lang.session.allowed_groups_description', + 'title' => 'winter.user::lang.session.allowed_groups_title', + 'description' => 'winter.user::lang.session.allowed_groups_description', 'placeholder' => '*', 'type' => 'set', 'default' => [] ], 'redirect' => [ - 'title' => 'rainlab.user::lang.session.redirect_title', - 'description' => 'rainlab.user::lang.session.redirect_desc', + 'title' => 'winter.user::lang.session.redirect_title', + 'description' => 'winter.user::lang.session.redirect_desc', 'type' => 'dropdown', 'default' => '' ] @@ -102,7 +102,7 @@ public function onRun() /** * Returns the logged in user, if available, and touches * the last seen timestamp. - * @return RainLab\User\Models\User + * @return Winter\User\Models\User */ public function user() { @@ -142,12 +142,12 @@ public function onLogout() Auth::logout(); if ($user) { - Event::fire('rainlab.user.logout', [$user]); + Event::fire('winter.user.logout', [$user]); } $url = post('redirect', Request::fullUrl()); - Flash::success(Lang::get('rainlab.user::lang.session.logout')); + Flash::success(Lang::get('winter.user::lang.session.logout')); return Redirect::to($url); } @@ -166,7 +166,7 @@ public function onStopImpersonating() $url = post('redirect', Request::fullUrl()); - Flash::success(Lang::get('rainlab.user::lang.session.stop_impersonate_success')); + Flash::success(Lang::get('winter.user::lang.session.stop_impersonate_success')); return Redirect::to($url); } diff --git a/composer.json b/composer.json index 0b4f218..24cf25e 100644 --- a/composer.json +++ b/composer.json @@ -1,8 +1,8 @@ { - "name": "rainlab/user-plugin", - "type": "october-plugin", - "description": "User plugin for October CMS", - "homepage": "https://octobercms.com/plugin/rainlab-user", + "name": "winter/user-plugin", + "type": "winter-plugin", + "description": "User plugin for Winter CMS", + "homepage": "https://github.com/wintercms/wn-user-plugin", "keywords": ["october", "octobercms", "user"], "license": "MIT", "authors": [ diff --git a/config/config.php b/config/config.php index 2fef283..eac7624 100644 --- a/config/config.php +++ b/config/config.php @@ -1,6 +1,6 @@ addJs('/plugins/rainlab/user/assets/js/bulk-actions.js'); + $this->addJs('/plugins/winter/user/assets/js/bulk-actions.js'); $this->asExtension('ListController')->index(); } @@ -143,7 +143,7 @@ public function preview_onActivate($recordId = null) $model->attemptActivation($model->activation_code); - Flash::success(Lang::get('rainlab.user::lang.users.activated_success')); + Flash::success(Lang::get('winter.user::lang.users.activated_success')); if ($redirect = $this->makeRedirect('update-close', $model)) { return $redirect; @@ -159,7 +159,7 @@ public function preview_onUnban($recordId = null) $model->unban(); - Flash::success(Lang::get('rainlab.user::lang.users.unbanned_success')); + Flash::success(Lang::get('winter.user::lang.users.unbanned_success')); if ($redirect = $this->makeRedirect('update-close', $model)) { return $redirect; @@ -199,7 +199,7 @@ public function preview_onConvertGuest($recordId) $model->groups()->add($group); } - Flash::success(Lang::get('rainlab.user::lang.users.convert_guest_success')); + Flash::success(Lang::get('winter.user::lang.users.convert_guest_success')); if ($redirect = $this->makeRedirect('update-close', $model)) { return $redirect; @@ -211,7 +211,7 @@ public function preview_onConvertGuest($recordId) */ public function preview_onImpersonateUser($recordId) { - if (!$this->user->hasAccess('rainlab.users.impersonate_user')) { + if (!$this->user->hasAccess('winter.users.impersonate_user')) { return Response::make(Lang::get('backend::lang.page.access_denied.label'), 403); } @@ -219,7 +219,7 @@ public function preview_onImpersonateUser($recordId) Auth::impersonate($model); - Flash::success(Lang::get('rainlab.user::lang.users.impersonate_success')); + Flash::success(Lang::get('winter.user::lang.users.impersonate_success')); } /** @@ -231,7 +231,7 @@ public function preview_onUnsuspendUser($recordId) $model->unsuspend(); - Flash::success(Lang::get('rainlab.user::lang.users.unsuspend_success')); + Flash::success(Lang::get('winter.user::lang.users.unsuspend_success')); return Redirect::refresh(); } @@ -296,10 +296,10 @@ public function index_onBulkAction() } } - Flash::success(Lang::get('rainlab.user::lang.users.'.$bulkAction.'_selected_success')); + Flash::success(Lang::get('winter.user::lang.users.'.$bulkAction.'_selected_success')); } else { - Flash::error(Lang::get('rainlab.user::lang.users.'.$bulkAction.'_selected_empty')); + Flash::error(Lang::get('winter.user::lang.users.'.$bulkAction.'_selected_empty')); } return $this->listRefresh(); diff --git a/controllers/usergroups/_list_toolbar.htm b/controllers/usergroups/_list_toolbar.htm index 8ab7b77..da81c82 100644 --- a/controllers/usergroups/_list_toolbar.htm +++ b/controllers/usergroups/_list_toolbar.htm @@ -1,7 +1,7 @@
- +
diff --git a/controllers/usergroups/config_form.yaml b/controllers/usergroups/config_form.yaml index f6e3181..cec40d0 100644 --- a/controllers/usergroups/config_form.yaml +++ b/controllers/usergroups/config_form.yaml @@ -3,29 +3,29 @@ # =================================== # Record name -name: rainlab.user::lang.group.label +name: winter.user::lang.group.label # Model Form Field configuration -form: $/rainlab/user/models/usergroup/fields.yaml +form: $/winter/user/models/usergroup/fields.yaml # Model Class name -modelClass: RainLab\User\Models\UserGroup +modelClass: Winter\User\Models\UserGroup # Default redirect location -defaultRedirect: rainlab/user/usergroups +defaultRedirect: winter/user/usergroups # Create page create: - title: rainlab.user::lang.groups.create_title - redirect: rainlab/user/usergroups/update/:id - redirectClose: rainlab/user/usergroups + title: winter.user::lang.groups.create_title + redirect: winter/user/usergroups/update/:id + redirectClose: winter/user/usergroups # Update page update: - title: rainlab.user::lang.groups.update_title - redirect: rainlab/user/usergroups - redirectClose: rainlab/user/usergroups + title: winter.user::lang.groups.update_title + redirect: winter/user/usergroups + redirectClose: winter/user/usergroups # Preview page preview: - title: rainlab.user::lang.groups.update_title \ No newline at end of file + title: winter.user::lang.groups.update_title \ No newline at end of file diff --git a/controllers/usergroups/config_list.yaml b/controllers/usergroups/config_list.yaml index b765d35..93ac9aa 100644 --- a/controllers/usergroups/config_list.yaml +++ b/controllers/usergroups/config_list.yaml @@ -3,16 +3,16 @@ # =================================== # Model List Column configuration -list: $/rainlab/user/models/usergroup/columns.yaml +list: $/winter/user/models/usergroup/columns.yaml # Model Class name -modelClass: RainLab\User\Models\UserGroup +modelClass: Winter\User\Models\UserGroup # List Title -title: rainlab.user::lang.groups.list_title +title: winter.user::lang.groups.list_title # Link URL for each record -recordUrl: rainlab/user/usergroups/update/:id +recordUrl: winter/user/usergroups/update/:id # Message to display if the list is empty noRecordsMessage: backend::lang.list.no_records diff --git a/controllers/usergroups/create.htm b/controllers/usergroups/create.htm index f15ad81..1b11930 100644 --- a/controllers/usergroups/create.htm +++ b/controllers/usergroups/create.htm @@ -1,6 +1,6 @@ @@ -33,7 +33,7 @@ - + @@ -43,6 +43,6 @@

fatalError) ?>

-

+

diff --git a/controllers/usergroups/preview.htm b/controllers/usergroups/preview.htm index 8769529..f572bd7 100644 --- a/controllers/usergroups/preview.htm +++ b/controllers/usergroups/preview.htm @@ -1,6 +1,6 @@ @@ -14,6 +14,6 @@

fatalError) ?>

-

Return to user groups list

+

Return to user groups list

\ No newline at end of file diff --git a/controllers/usergroups/update.htm b/controllers/usergroups/update.htm index 6d81742..7032faf 100644 --- a/controllers/usergroups/update.htm +++ b/controllers/usergroups/update.htm @@ -1,6 +1,6 @@ @@ -38,10 +38,10 @@ class="oc-icon-trash-o btn-icon danger pull-right" data-request="onDelete" data-load-indicator="$formRecordName])) ?>" - data-request-confirm=""> + data-request-confirm=""> - + @@ -51,6 +51,6 @@

fatalError) ?>

-

+

diff --git a/controllers/users/_hint_activate.htm b/controllers/users/_hint_activate.htm index 2c0c64a..d3da025 100644 --- a/controllers/users/_hint_activate.htm +++ b/controllers/users/_hint_activate.htm @@ -2,14 +2,14 @@
-

+

- + . + >.

diff --git a/controllers/users/_hint_banned.htm b/controllers/users/_hint_banned.htm index bb5af21..9ea87ae 100644 --- a/controllers/users/_hint_banned.htm +++ b/controllers/users/_hint_banned.htm @@ -2,14 +2,14 @@
-

+

- + . + >.

diff --git a/controllers/users/_hint_guest.htm b/controllers/users/_hint_guest.htm index c039484..9655706 100644 --- a/controllers/users/_hint_guest.htm +++ b/controllers/users/_hint_guest.htm @@ -2,13 +2,13 @@
-

+

- + . + >.

diff --git a/controllers/users/_hint_trashed.htm b/controllers/users/_hint_trashed.htm index 114b5ab..9ca6e5f 100644 --- a/controllers/users/_hint_trashed.htm +++ b/controllers/users/_hint_trashed.htm @@ -2,8 +2,8 @@
-

-

+

+

diff --git a/controllers/users/_list_toolbar.htm b/controllers/users/_list_toolbar.htm index 211b878..51601f4 100644 --- a/controllers/users/_list_toolbar.htm +++ b/controllers/users/_list_toolbar.htm @@ -1,8 +1,8 @@
- + diff --git a/controllers/users/_preview_scoreboard.htm b/controllers/users/_preview_scoreboard.htm index 0f66625..f0ce76a 100644 --- a/controllers/users/_preview_scoreboard.htm +++ b/controllers/users/_preview_scoreboard.htm @@ -1,9 +1,9 @@
-

+

name): ?>

name) ?>

-

+

@@ -13,28 +13,28 @@

created_at): ?>
-

+

created_at->toFormattedDateString() ?>

Status: is_guest): ?> - + is_activated): ?> - + - +

last_seen): ?>
-

+

last_seen->diffForHumans() ?>

- isOnline() ? e(trans('rainlab.user::lang.user.is_online')) : e(trans('rainlab.user::lang.user.is_offline')) ?> + isOnline() ? e(trans('winter.user::lang.user.is_online')) : e(trans('winter.user::lang.user.is_offline')) ?>

diff --git a/controllers/users/_preview_toolbar.htm b/controllers/users/_preview_toolbar.htm index 2d76680..40888a3 100644 --- a/controllers/users/_preview_toolbar.htm +++ b/controllers/users/_preview_toolbar.htm @@ -1,20 +1,20 @@
- + - + -user->hasAccess('rainlab.users.impersonate_user')): ?> +user->hasAccess('winter.users.impersonate_user')): ?> - + @@ -22,9 +22,9 @@ - + @@ -32,17 +32,17 @@ /* @todo
Deactivate Ban user Delete @@ -52,20 +52,20 @@ makePartial('~/path/to/partial'); * }); * */ - $this->fireViewEvent('rainlab.user.view.extendPreviewToolbar', [ + $this->fireViewEvent('winter.user.view.extendPreviewToolbar', [ 'record' => $formModel ]); ?> diff --git a/controllers/users/config_filter.yaml b/controllers/users/config_filter.yaml index 797e46f..a5c4480 100755 --- a/controllers/users/config_filter.yaml +++ b/controllers/users/config_filter.yaml @@ -6,22 +6,22 @@ scopes: groups: # Filter name - label: rainlab.user::lang.group.label + label: winter.user::lang.group.label # Model Class name - modelClass: RainLab\User\Models\UserGroup + modelClass: Winter\User\Models\UserGroup # Model attribute to display for the name nameFrom: name # Filter scope scope: filterByGroup created_date: - label: rainlab.user::lang.user.created_at + label: winter.user::lang.user.created_at type: daterange conditions: created_at >= ':after' AND created_at <= ':before' activated: # Filter name - label: rainlab.user::lang.user.status_activated + label: winter.user::lang.user.status_activated # Filter type type: switch # SQL conditions diff --git a/controllers/users/config_form.yaml b/controllers/users/config_form.yaml index 7b92abf..5923d79 100644 --- a/controllers/users/config_form.yaml +++ b/controllers/users/config_form.yaml @@ -3,23 +3,23 @@ # =================================== # Record name -name: rainlab.user::lang.user.label +name: winter.user::lang.user.label # Model Form Field configuration -form: $/rainlab/user/models/user/fields.yaml +form: $/winter/user/models/user/fields.yaml # Model Class name -modelClass: RainLab\User\Models\User +modelClass: Winter\User\Models\User # Default redirect location -defaultRedirect: rainlab/user/users +defaultRedirect: winter/user/users # Create page create: - redirect: rainlab/user/users/preview/:id - redirectClose: rainlab/user/users + redirect: winter/user/users/preview/:id + redirectClose: winter/user/users # Update page update: - redirect: rainlab/user/users/update/:id - redirectClose: rainlab/user/users/preview/:id + redirect: winter/user/users/update/:id + redirectClose: winter/user/users/preview/:id diff --git a/controllers/users/config_list.yaml b/controllers/users/config_list.yaml index 349ae9e..8d2488b 100644 --- a/controllers/users/config_list.yaml +++ b/controllers/users/config_list.yaml @@ -3,16 +3,16 @@ # =================================== # List Title -title: rainlab.user::lang.users.list_title +title: winter.user::lang.users.list_title # Model List Column configuration -list: $/rainlab/user/models/user/columns.yaml +list: $/winter/user/models/user/columns.yaml # Model Class name -modelClass: RainLab\User\Models\User +modelClass: Winter\User\Models\User # Link URL for each record -recordUrl: rainlab/user/users/preview/:id +recordUrl: winter/user/users/preview/:id # Message to display if the list is empty noRecordsMessage: backend::lang.list.no_records diff --git a/controllers/users/create.htm b/controllers/users/create.htm index f010a3c..d8af81a 100644 --- a/controllers/users/create.htm +++ b/controllers/users/create.htm @@ -1,6 +1,6 @@
    -
  • +
  • pageTitle)) ?>
@@ -36,7 +36,7 @@ - +
@@ -59,6 +59,6 @@

fatalError)) ?>

-

+

diff --git a/controllers/users/preview.htm b/controllers/users/preview.htm index 3ff3530..3c5ee41 100644 --- a/controllers/users/preview.htm +++ b/controllers/users/preview.htm @@ -1,6 +1,6 @@ @@ -55,7 +55,7 @@

fatalError) ?>

-

+

diff --git a/controllers/users/update.htm b/controllers/users/update.htm index 6be1c68..40035ce 100644 --- a/controllers/users/update.htm +++ b/controllers/users/update.htm @@ -1,6 +1,6 @@ @@ -38,13 +38,13 @@ - + @@ -67,6 +67,6 @@

fatalError)) ?>

-

+

diff --git a/facades/Auth.php b/facades/Auth.php index 5f32208..903b2d3 100644 --- a/facades/Auth.php +++ b/facades/Auth.php @@ -1,9 +1,9 @@ -require_activation = config('rainlab.user::requireActivation', true); - $this->activate_mode = config('rainlab.user::activateMode', self::ACTIVATE_AUTO); - $this->use_throttle = config('rainlab.user::useThrottle', true); - $this->block_persistence = config('rainlab.user::blockPersistence', false); - $this->allow_registration = config('rainlab.user::allowRegistration', true); - $this->login_attribute = config('rainlab.user::loginAttribute', self::LOGIN_EMAIL); - $this->remember_login = config('rainlab.user::rememberLogin', self::REMEMBER_ALWAYS); - $this->use_register_throttle = config('rainlab.user::useRegisterThrottle', true); + $this->require_activation = config('winter.user::requireActivation', true); + $this->activate_mode = config('winter.user::activateMode', self::ACTIVATE_AUTO); + $this->use_throttle = config('winter.user::useThrottle', true); + $this->block_persistence = config('winter.user::blockPersistence', false); + $this->allow_registration = config('winter.user::allowRegistration', true); + $this->login_attribute = config('winter.user::loginAttribute', self::LOGIN_EMAIL); + $this->remember_login = config('winter.user::rememberLogin', self::REMEMBER_ALWAYS); + $this->use_register_throttle = config('winter.user::useRegisterThrottle', true); } public function getActivateModeOptions() { return [ self::ACTIVATE_AUTO => [ - 'rainlab.user::lang.settings.activate_mode_auto', - 'rainlab.user::lang.settings.activate_mode_auto_comment' + 'winter.user::lang.settings.activate_mode_auto', + 'winter.user::lang.settings.activate_mode_auto_comment' ], self::ACTIVATE_USER => [ - 'rainlab.user::lang.settings.activate_mode_user', - 'rainlab.user::lang.settings.activate_mode_user_comment' + 'winter.user::lang.settings.activate_mode_user', + 'winter.user::lang.settings.activate_mode_user_comment' ], self::ACTIVATE_ADMIN => [ - 'rainlab.user::lang.settings.activate_mode_admin', - 'rainlab.user::lang.settings.activate_mode_admin_comment' + 'winter.user::lang.settings.activate_mode_admin', + 'winter.user::lang.settings.activate_mode_admin_comment' ] ]; } @@ -68,8 +68,8 @@ public function getActivateModeAttribute($value) public function getLoginAttributeOptions() { return [ - self::LOGIN_EMAIL => ['rainlab.user::lang.login.attribute_email'], - self::LOGIN_USERNAME => ['rainlab.user::lang.login.attribute_username'] + self::LOGIN_EMAIL => ['winter.user::lang.login.attribute_email'], + self::LOGIN_USERNAME => ['winter.user::lang.login.attribute_username'] ]; } @@ -77,13 +77,13 @@ public function getRememberLoginOptions() { return [ self::REMEMBER_ALWAYS => [ - 'rainlab.user::lang.settings.remember_always', + 'winter.user::lang.settings.remember_always', ], self::REMEMBER_NEVER => [ - 'rainlab.user::lang.settings.remember_never', + 'winter.user::lang.settings.remember_never', ], self::REMEMBER_ASK => [ - 'rainlab.user::lang.settings.remember_ask', + 'winter.user::lang.settings.remember_ask', ] ]; } diff --git a/models/Throttle.php b/models/Throttle.php index d9b4916..3813565 100644 --- a/models/Throttle.php +++ b/models/Throttle.php @@ -1,6 +1,6 @@ -trashed()) { $this->restore(); - Mail::sendTo($this, 'rainlab.user::mail.reactivate', [ + Mail::sendTo($this, 'winter.user::mail.reactivate', [ 'name' => $this->name ]); - Event::fire('rainlab.user.reactivate', [$this]); + Event::fire('winter.user.reactivate', [$this]); } else { parent::afterLogin(); } - Event::fire('rainlab.user.login', [$this]); + Event::fire('winter.user.login', [$this]); } /** @@ -323,7 +323,7 @@ public function afterLogin() public function afterDelete() { if ($this->isSoftDelete()) { - Event::fire('rainlab.user.deactivate', [$this]); + Event::fire('winter.user.deactivate', [$this]); return; } @@ -493,7 +493,7 @@ public function getNotificationVars() /* * Extensibility */ - $result = Event::fire('rainlab.user.getNotificationVars', [$this]); + $result = Event::fire('winter.user.getNotificationVars', [$this]); if ($result && is_array($result)) { $vars = call_user_func_array('array_merge', $result) + $vars; } @@ -502,12 +502,12 @@ public function getNotificationVars() } /** - * Sends an invitation to the user using template "rainlab.user::mail.invite". + * Sends an invitation to the user using template "winter.user::mail.invite". * @return void */ protected function sendInvitation() { - Mail::sendTo($this, 'rainlab.user::mail.invite', $this->getNotificationVars()); + Mail::sendTo($this, 'winter.user::mail.invite', $this->getNotificationVars()); } /** diff --git a/models/UserGroup.php b/models/UserGroup.php index 20496a4..78fbc70 100644 --- a/models/UserGroup.php +++ b/models/UserGroup.php @@ -1,6 +1,6 @@ - - + ./tests @@ -36,4 +36,4 @@ - \ No newline at end of file + diff --git a/tests/UserPluginTestCase.php b/tests/UserPluginTestCase.php index 3d5d201..92f0eb6 100644 --- a/tests/UserPluginTestCase.php +++ b/tests/UserPluginTestCase.php @@ -1,9 +1,9 @@ -logout(); + \Winter\User\Classes\AuthManager::instance()->logout(); // register the auth facade $alias = AliasLoader::getInstance(); - $alias->alias('Auth', 'RainLab\User\Facades\Auth'); + $alias->alias('Auth', 'Winter\User\Facades\Auth'); App::singleton('user.auth', function () { - return \RainLab\User\Classes\AuthManager::instance(); + return \Winter\User\Classes\AuthManager::instance(); }); } } \ No newline at end of file diff --git a/tests/unit/facades/AuthFacadeTest.php b/tests/unit/facades/AuthFacadeTest.php index 0a501b4..8b6e671 100644 --- a/tests/unit/facades/AuthFacadeTest.php +++ b/tests/unit/facades/AuthFacadeTest.php @@ -1,8 +1,8 @@ -assertEquals(1, User::count()); - $this->assertInstanceOf('RainLab\User\Models\User', $user); + $this->assertInstanceOf('Winter\User\Models\User', $user); // and that user should have the following data $this->assertFalse($user->is_activated); @@ -50,7 +50,7 @@ public function testRegisteringAGuest() // our one guest should be returned $this->assertEquals(1, User::count()); - $this->assertInstanceOf('RainLab\User\Models\User', $guest); + $this->assertInstanceOf('Winter\User\Models\User', $guest); // and that guest should have the following data $this->assertTrue($guest->is_guest); diff --git a/updates/create_throttle_table.php b/updates/v1.0.1/create_throttle_table.php similarity index 90% rename from updates/create_throttle_table.php rename to updates/v1.0.1/create_throttle_table.php index 339ae01..7176625 100644 --- a/updates/create_throttle_table.php +++ b/updates/v1.0.1/create_throttle_table.php @@ -1,7 +1,7 @@ - Date: Fri, 12 Mar 2021 23:31:20 -0500 Subject: [PATCH 02/20] rename db tables in code; add migration to rename db tables --- updates/v1.0.6/create_mail_blockers_table.php | 4 +-- updates/v1.2.5/update_timestamp_nullable.php | 2 +- updates/v1.6.0/rename_tables.php | 25 +++++++++++++++++++ updates/version.yaml | 7 +++++- 4 files changed, 34 insertions(+), 4 deletions(-) create mode 100755 updates/v1.6.0/rename_tables.php diff --git a/updates/v1.0.6/create_mail_blockers_table.php b/updates/v1.0.6/create_mail_blockers_table.php index 2a978d7..3a7d428 100644 --- a/updates/v1.0.6/create_mail_blockers_table.php +++ b/updates/v1.0.6/create_mail_blockers_table.php @@ -8,7 +8,7 @@ class CreateMailBlockersTable extends Migration public function up() { - Schema::create('rainlab_user_mail_blockers', function($table) + Schema::create('winter_user_mail_blockers', function($table) { $table->engine = 'InnoDB'; $table->increments('id'); @@ -21,7 +21,7 @@ public function up() public function down() { - Schema::dropIfExists('rainlab_user_mail_blockers'); + Schema::dropIfExists('winter_user_mail_blockers'); } } diff --git a/updates/v1.2.5/update_timestamp_nullable.php b/updates/v1.2.5/update_timestamp_nullable.php index d7854ce..86404eb 100644 --- a/updates/v1.2.5/update_timestamp_nullable.php +++ b/updates/v1.2.5/update_timestamp_nullable.php @@ -11,7 +11,7 @@ public function up() DbDongle::convertTimestamps('users'); DbDongle::convertTimestamps('user_groups'); - DbDongle::convertTimestamps('rainlab_user_mail_blockers'); + DbDongle::convertTimestamps('winter_user_mail_blockers'); } public function down() diff --git a/updates/v1.6.0/rename_tables.php b/updates/v1.6.0/rename_tables.php new file mode 100755 index 0000000..4dafa7b --- /dev/null +++ b/updates/v1.6.0/rename_tables.php @@ -0,0 +1,25 @@ + Date: Fri, 12 Mar 2021 23:33:19 -0500 Subject: [PATCH 03/20] update version label --- updates/version.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/updates/version.yaml b/updates/version.yaml index a9b674e..25e6262 100644 --- a/updates/version.yaml +++ b/updates/version.yaml @@ -75,7 +75,7 @@ "1.5.3": "Fixes a bug in the user update functionality if password is not changed. Added highlighting for banned users in user list." "1.5.4": "Multiple translation improvements. Added view events to extend user preview and user listing toolbars." "1.6.0": - - "Rebranded version of RainLab.User." + - "Rebrand to Winter.User" - v1.6.0/rename_tables.php From 545c3713dac2ac22ff21c582202971d9d94afdf1 Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Fri, 12 Mar 2021 23:48:49 -0500 Subject: [PATCH 04/20] add replaces directive --- Plugin.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Plugin.php b/Plugin.php index 1142da4..6356c87 100644 --- a/Plugin.php +++ b/Plugin.php @@ -25,7 +25,8 @@ public function pluginDetails() 'description' => 'winter.user::lang.plugin.description', 'author' => 'Alexey Bobkov, Samuel Georges', 'icon' => 'icon-user', - 'homepage' => 'https://github.com/wintercms/wn-user-plugin' + 'homepage' => 'https://github.com/wintercms/wn-user-plugin', + 'replaces' => 'RainLab.User' ]; } From e1aebc230c35e97d506bc95fb2b45a4a6a86537e Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Sat, 13 Mar 2021 00:08:24 -0500 Subject: [PATCH 05/20] add legacy class aliases --- init.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 init.php diff --git a/init.php b/init.php new file mode 100644 index 0000000..8013afa --- /dev/null +++ b/init.php @@ -0,0 +1,21 @@ + Date: Sun, 14 Mar 2021 18:21:36 -0400 Subject: [PATCH 06/20] add class aliases --- init.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/init.php b/init.php index 8013afa..5fb8407 100644 --- a/init.php +++ b/init.php @@ -1,17 +1,16 @@ Date: Mon, 15 Mar 2021 08:46:26 -0400 Subject: [PATCH 07/20] comment out the alias causing trouble --- init.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/init.php b/init.php index 5fb8407..0422662 100644 --- a/init.php +++ b/init.php @@ -1,20 +1,22 @@ Date: Mon, 15 Mar 2021 09:39:44 -0400 Subject: [PATCH 08/20] - create reverse alias for external plugin references - do not create class aliases if original plugin still installed --- init.php | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/init.php b/init.php index 0422662..89ba0df 100644 --- a/init.php +++ b/init.php @@ -1,22 +1,26 @@ Date: Mon, 15 Mar 2021 10:29:25 -0400 Subject: [PATCH 09/20] do not create class alias if it exists already --- init.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/init.php b/init.php index 89ba0df..950cfa4 100644 --- a/init.php +++ b/init.php @@ -1,7 +1,9 @@ Date: Tue, 16 Mar 2021 20:52:43 +0800 Subject: [PATCH 10/20] Fix a couple of missed URL changes --- README.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index d8cafb1..7e575ad 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ # Front-end user plugin -[![Build Status](https://img.shields.io/github/workflow/status/rainlab/user-plugin/Tests)](https://github.com/wintercms/wn-user-plugin/actions) +[![Build Status](https://img.shields.io/github/workflow/status/wintercms/wn-user-plugin/Tests)](https://github.com/wintercms/wn-user-plugin/actions) [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/wintercms/wn-user-plugin/blob/master/LICENCE.md) Front-end user management for Winter CMS. ## Requirements -This plugin requires the [Ajax Framework](https://octobercms.com/docs/cms/ajax) to be included in your layout/page in order to handle form requests. +This plugin requires the [Ajax Framework](https://wintercms.com/docs/cms/ajax) to be included in your layout/page in order to handle form requests. ## Managing users @@ -49,10 +49,6 @@ As a security precaution, you may restrict users from having sessions across mul When a user is first activated -- either by registration, email confirmation or administrator approval -- they are sent a welcome email. To disable the welcome email, select "Do not send a notification" from the **Welcome mail template** dropdown. The default message template used is `winter.user::mail.welcome` and you can customize this by selecting **Mail > Mail Templates** from the settings menu. -## Extended features - -For extra functionality, consider also installing the [User Plus+ plugin](http://octobercms.com/plugin/rainlab-userplus) (`Winter.UserPlus`). - ## Session component The session component should be added to a layout that has registered users. It has no default markup. @@ -153,7 +149,7 @@ By default, the User plugin requires a minimum password length of 8 characters f ### Flash messages -This plugin makes use of Winter CMS's [`Flash API`](http://octobercms.com/docs/markup/tag-flash). In order to display the error messages, you need to place the following snippet in your layout or page. +This plugin makes use of Winter CMS's [`Flash API`](https://wintercms.com/docs/markup/tag-flash). In order to display the error messages, you need to place the following snippet in your layout or page. {% flash %}
{{ message }}
From fa83ada2d839e953fed14d6979eb4a26a81ada04 Mon Sep 17 00:00:00 2001 From: Ben Thomson Date: Tue, 16 Mar 2021 20:52:53 +0800 Subject: [PATCH 11/20] Update Composer details --- composer.json | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 24cf25e..4726279 100644 --- a/composer.json +++ b/composer.json @@ -1,22 +1,32 @@ { - "name": "winter/user-plugin", + "name": "winter/wn-user-plugin", "type": "winter-plugin", "description": "User plugin for Winter CMS", "homepage": "https://github.com/wintercms/wn-user-plugin", - "keywords": ["october", "octobercms", "user"], + "keywords": ["winter cms", "winter", "plugin", "user", "authentication"], "license": "MIT", "authors": [ { "name": "Alexey Bobkov", "email": "aleksey.bobkov@gmail.com", - "role": "Co-founder" + "role": "Original Author" }, { "name": "Samuel Georges", "email": "daftspunky@gmail.com", - "role": "Co-founder" + "role": "Original Author" + }, + { + "name": "Winter CMS Maintainers", + "homepage": "https://wintercms.com", + "role": "Maintainer" } ], + "support": { + "issues": "https://github.com/wintercms/wn-user-plugin/issues", + "discord": "https://discord.gg/D5MFSPH6Ux", + "source": "https://github.com/wintercms/wn-user-plugin" + }, "require": { "php": ">=5.5.9", "composer/installers": "~1.0" From 695f8e2c49ed20876e5387a1655ee948cd2c9140 Mon Sep 17 00:00:00 2001 From: Ben Thomson Date: Tue, 16 Mar 2021 20:53:06 +0800 Subject: [PATCH 12/20] Formatting tweak --- updates/v1.6.0/rename_tables.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/updates/v1.6.0/rename_tables.php b/updates/v1.6.0/rename_tables.php index 4dafa7b..1a0d4ad 100755 --- a/updates/v1.6.0/rename_tables.php +++ b/updates/v1.6.0/rename_tables.php @@ -8,7 +8,8 @@ class RenameTables extends Migration public function up() { $from = 'rainlab_user_mail_blockers'; - $to = 'winter_user_mail_blockers'; + $to = 'winter_user_mail_blockers'; + if (Schema::hasTable($from)) { Schema::rename($from, $to); } @@ -17,7 +18,8 @@ public function up() public function down() { $from = 'winter_user_mail_blockers'; - $to = 'rainlab_user_mail_blockers'; + $to = 'rainlab_user_mail_blockers'; + if (Schema::hasTable($from)) { Schema::rename($from, $to); } From 45db0406ba6fe7fe435660d3502873c00ebec559 Mon Sep 17 00:00:00 2001 From: Ben Thomson Date: Tue, 16 Mar 2021 20:55:08 +0800 Subject: [PATCH 13/20] Maintain parity with module aliases Modules in Winter CMS use an aliases.php file to define aliases. To keep continuity, we'll use the init.php file to simply bring in the aliases.php file. --- aliases.php | 27 +++++++++++++++++++++++++++ init.php | 29 ++--------------------------- 2 files changed, 29 insertions(+), 27 deletions(-) create mode 100644 aliases.php diff --git a/aliases.php b/aliases.php new file mode 100644 index 0000000..aaa7d62 --- /dev/null +++ b/aliases.php @@ -0,0 +1,27 @@ + 'RainLab\User\Plugin', + Winter\User\Classes\AuthManager::class => 'RainLab\User\Classes\AuthManager', + Winter\User\Classes\AuthMiddleware::class => 'RainLab\User\Classes\AuthMiddleware', + Winter\User\Classes\UserEventBase::class => 'RainLab\User\Classes\UserEventBase', + Winter\User\Classes\UserRedirector::class => 'RainLab\User\Classes\UserRedirector', + Winter\User\Components\Account::class => 'RainLab\User\Components\Account', + Winter\User\Components\ResetPassword::class => 'RainLab\User\Components\ResetPassword', + Winter\User\Components\Session::class => 'RainLab\User\Components\Session', + Winter\User\Controllers\Users::class => 'RainLab\User\Controllers\Users', + Winter\User\Controllers\UserGroups::class => 'RainLab\User\Controllers\UserGroups', + Winter\User\Models\User::class => 'RainLab\User\Models\User', + Winter\User\Models\MailBlocker::class => 'RainLab\User\Models\MailBlocker', + Winter\User\Models\Throttle::class => 'RainLab\User\Models\Throttle', + Winter\User\Models\Settings::class => 'RainLab\User\Models\Settings', +]; + +foreach ($aliases as $original => $alias) { + if (!class_exists($alias)) { + class_alias($original, $alias); + } +} \ No newline at end of file diff --git a/init.php b/init.php index 950cfa4..6955e90 100644 --- a/init.php +++ b/init.php @@ -1,28 +1,3 @@ Date: Tue, 16 Mar 2021 20:55:17 +0800 Subject: [PATCH 14/20] Adjust test suite --- .github/workflows/tests.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 99fbbc3..ac5ca82 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,12 +13,12 @@ jobs: strategy: max-parallel: 6 matrix: - phpVersions: ['7.2', '7.3', '7.4'] + phpVersions: ['7.2', '7.3', '7.4', '8.0'] fail-fast: false env: phpExtensions: mbstring, intl, gd, xml, sqlite cacheKey: ext-cache-v1 - octoberCmsRelease: develop + winterCmsRelease: develop steps: - name: Checkout changes uses: actions/checkout@v2 @@ -48,16 +48,16 @@ jobs: tools: composer:v1 coverage: none - - name: Install October CMS + - name: Install Winter CMS run: | - wget https://github.com/octobercms/october/archive/${{ env.octoberCmsRelease }}.zip - unzip ${{ env.octoberCmsRelease }}.zip + wget https://github.com/wintercms/winter/archive/${{ env.winterCmsRelease }}.zip + unzip ${{ env.winterCmsRelease }}.zip shopt -s dotglob - mv october-${{ env.octoberCmsRelease }}/* ./ + mv winter-${{ env.winterCmsRelease }}/* ./ shopt -u dotglob cp config/cms.php config/testing/cms.php - mkdir -p plugins/rainlab - mv user-plugin plugins/rainlab/user + mkdir -p plugins/winter + mv user-plugin plugins/winter/user - name: Get Composer cache directory id: composercache @@ -74,9 +74,9 @@ jobs: run: composer install --no-interaction --no-progress --no-suggest - name: Run linting - run: ./vendor/bin/parallel-lint plugins/rainlab/user + run: ./vendor/bin/parallel-lint plugins/winter/user - name: Run unit tests run: | - cd plugins/rainlab/user + cd plugins/winter/user ../../../vendor/bin/phpunit \ No newline at end of file From 913c0a1c51a214c9856242620ca914a2227f3006 Mon Sep 17 00:00:00 2001 From: Ben Thomson Date: Tue, 16 Mar 2021 21:02:34 +0800 Subject: [PATCH 15/20] Safely handle notification rules when Notify plugin is missing --- Plugin.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Plugin.php b/Plugin.php index 6356c87..7ebbce1 100644 --- a/Plugin.php +++ b/Plugin.php @@ -9,7 +9,6 @@ use Illuminate\Foundation\AliasLoader; use Winter\User\Classes\UserRedirector; use Winter\User\Models\MailBlocker; -use Winter\Notify\Classes\Notifier; class Plugin extends PluginBase { @@ -156,6 +155,10 @@ public function registerMailTemplates() public function registerNotificationRules() { + if (!class_exists('Winter\Notify\Classes\Notifier')) { + return []; + } + return [ 'groups' => [ 'user' => [ @@ -176,16 +179,16 @@ public function registerNotificationRules() protected function bindNotificationEvents() { - if (!class_exists(Notifier::class)) { + if (!class_exists('Winter\Notify\Classes\Notifier')) { return; } - Notifier::bindEvents([ + \Winter\Notify\Classes\Notifier::bindEvents([ 'winter.user.activate' => \Winter\User\NotifyRules\UserActivatedEvent::class, 'winter.user.register' => \Winter\User\NotifyRules\UserRegisteredEvent::class ]); - Notifier::instance()->registerCallback(function ($manager) { + \Winter\Notify\Classes\Notifier::instance()->registerCallback(function ($manager) { $manager->registerGlobalParams([ 'user' => Auth::getUser() ]); From bad3fb31962a7bbaece6c4d4fe1a4fdbd3352397 Mon Sep 17 00:00:00 2001 From: Ben Thomson Date: Tue, 16 Mar 2021 21:06:52 +0800 Subject: [PATCH 16/20] Change class references to strings so they don't instantiate if missing --- Plugin.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Plugin.php b/Plugin.php index 7ebbce1..4f34e67 100644 --- a/Plugin.php +++ b/Plugin.php @@ -167,12 +167,12 @@ public function registerNotificationRules() ], ], 'events' => [ - \Winter\User\NotifyRules\UserActivatedEvent::class, - \Winter\User\NotifyRules\UserRegisteredEvent::class, + 'Winter\User\NotifyRules\UserActivatedEvent', + 'Winter\User\NotifyRules\UserRegisteredEvent', ], 'actions' => [], 'conditions' => [ - \Winter\User\NotifyRules\UserAttributeCondition::class + 'Winter\User\NotifyRules\UserAttributeCondition', ], ]; } @@ -184,8 +184,8 @@ protected function bindNotificationEvents() } \Winter\Notify\Classes\Notifier::bindEvents([ - 'winter.user.activate' => \Winter\User\NotifyRules\UserActivatedEvent::class, - 'winter.user.register' => \Winter\User\NotifyRules\UserRegisteredEvent::class + 'winter.user.activate' => 'Winter\User\NotifyRules\UserActivatedEvent', + 'winter.user.register' => 'Winter\User\NotifyRules\UserRegisteredEvent', ]); \Winter\Notify\Classes\Notifier::instance()->registerCallback(function ($manager) { From 67af403d57e4f68eba4d592bb3bb8f7d8215a5d0 Mon Sep 17 00:00:00 2001 From: Ben Thomson Date: Tue, 16 Mar 2021 22:02:04 +0800 Subject: [PATCH 17/20] Use Composer 2 for tests, clean up after Winter CMS install --- .github/workflows/tests.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ac5ca82..16622b9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -45,15 +45,17 @@ jobs: with: php-version: ${{ matrix.phpVersions }} extensions: ${{ env.phpExtensions }} - tools: composer:v1 + tools: composer:v2 coverage: none - name: Install Winter CMS run: | wget https://github.com/wintercms/winter/archive/${{ env.winterCmsRelease }}.zip unzip ${{ env.winterCmsRelease }}.zip + rm ${{ env.winterCmsRelease }}.zip shopt -s dotglob mv winter-${{ env.winterCmsRelease }}/* ./ + rmdir winter-${{ env.winterCmsRelease }} shopt -u dotglob cp config/cms.php config/testing/cms.php mkdir -p plugins/winter @@ -71,7 +73,7 @@ jobs: restore-keys: ${{ runner.os }}-composer- - name: Install Composer dependencies - run: composer install --no-interaction --no-progress --no-suggest + run: composer install --no-interaction --no-progress - name: Run linting run: ./vendor/bin/parallel-lint plugins/winter/user From ff9e127c82381948881410978bc60d73ef2ed3b4 Mon Sep 17 00:00:00 2001 From: Ben Thomson Date: Tue, 16 Mar 2021 22:07:07 +0800 Subject: [PATCH 18/20] Safeguard against renaming tables where the target already exists --- updates/v1.6.0/rename_tables.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/updates/v1.6.0/rename_tables.php b/updates/v1.6.0/rename_tables.php index 1a0d4ad..fc43a62 100755 --- a/updates/v1.6.0/rename_tables.php +++ b/updates/v1.6.0/rename_tables.php @@ -10,7 +10,7 @@ public function up() $from = 'rainlab_user_mail_blockers'; $to = 'winter_user_mail_blockers'; - if (Schema::hasTable($from)) { + if (Schema::hasTable($from) && !Schema::hasTable($to)) { Schema::rename($from, $to); } } @@ -20,7 +20,7 @@ public function down() $from = 'winter_user_mail_blockers'; $to = 'rainlab_user_mail_blockers'; - if (Schema::hasTable($from)) { + if (Schema::hasTable($from) && !Schema::hasTable($to)) { Schema::rename($from, $to); } } From a1acc1e56446ca380b4e14819ec72e7d06bf4958 Mon Sep 17 00:00:00 2001 From: Ben Thomson Date: Tue, 16 Mar 2021 22:09:34 +0800 Subject: [PATCH 19/20] Re-add reverse alias --- aliases.php | 1 + 1 file changed, 1 insertion(+) diff --git a/aliases.php b/aliases.php index aaa7d62..ef44874 100644 --- a/aliases.php +++ b/aliases.php @@ -4,6 +4,7 @@ * use the new Winter.User classes. */ $aliases = [ + 'RainLab\Notify\Classes\EventBase' => Winter\Notify\Classes\EventBase::class, Winter\User\Plugin::class => 'RainLab\User\Plugin', Winter\User\Classes\AuthManager::class => 'RainLab\User\Classes\AuthManager', Winter\User\Classes\AuthMiddleware::class => 'RainLab\User\Classes\AuthMiddleware', From c4318e56e3810b336bcaeabdab6d35ac4c45e629 Mon Sep 17 00:00:00 2001 From: Ben Thomson Date: Tue, 16 Mar 2021 22:16:05 +0800 Subject: [PATCH 20/20] Partially revert defensive changes "::class" and use cases can be used even if they don't exist. --- Plugin.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Plugin.php b/Plugin.php index 4f34e67..c780328 100644 --- a/Plugin.php +++ b/Plugin.php @@ -9,6 +9,7 @@ use Illuminate\Foundation\AliasLoader; use Winter\User\Classes\UserRedirector; use Winter\User\Models\MailBlocker; +use Winter\Notify\Classes\Notifier; class Plugin extends PluginBase { @@ -155,7 +156,7 @@ public function registerMailTemplates() public function registerNotificationRules() { - if (!class_exists('Winter\Notify\Classes\Notifier')) { + if (!class_exists(\Winter\Notify\Classes\Notifier::class)) { return []; } @@ -167,8 +168,8 @@ public function registerNotificationRules() ], ], 'events' => [ - 'Winter\User\NotifyRules\UserActivatedEvent', - 'Winter\User\NotifyRules\UserRegisteredEvent', + \Winter\User\NotifyRules\UserActivatedEvent::class, + \Winter\User\NotifyRules\UserRegisteredEvent::class, ], 'actions' => [], 'conditions' => [ @@ -179,16 +180,16 @@ public function registerNotificationRules() protected function bindNotificationEvents() { - if (!class_exists('Winter\Notify\Classes\Notifier')) { + if (!class_exists(\Winter\Notify\Classes\Notifier::class)) { return; } - \Winter\Notify\Classes\Notifier::bindEvents([ - 'winter.user.activate' => 'Winter\User\NotifyRules\UserActivatedEvent', - 'winter.user.register' => 'Winter\User\NotifyRules\UserRegisteredEvent', + Notifier::bindEvents([ + 'winter.user.activate' => \Winter\User\NotifyRules\UserActivatedEvent::class, + 'winter.user.register' => \Winter\User\NotifyRules\UserRegisteredEvent::class, ]); - \Winter\Notify\Classes\Notifier::instance()->registerCallback(function ($manager) { + Notifier::instance()->registerCallback(function ($manager) { $manager->registerGlobalParams([ 'user' => Auth::getUser() ]);