diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 99fbbc3..16622b9 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 @@ -45,19 +45,21 @@ jobs: with: php-version: ${{ matrix.phpVersions }} extensions: ${{ env.phpExtensions }} - tools: composer:v1 + tools: composer:v2 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 + rm ${{ env.winterCmsRelease }}.zip shopt -s dotglob - mv october-${{ env.octoberCmsRelease }}/* ./ + mv winter-${{ env.winterCmsRelease }}/* ./ + rmdir 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 @@ -71,12 +73,12 @@ 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/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 diff --git a/Plugin.php b/Plugin.php index b781a62..c780328 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', + 'replaces' => 'RainLab.User' ]; } 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 +62,7 @@ public function register() }); /* - * Compatability with RainLab.Notify + * Compatability with Winter.Notify */ $this->bindNotificationEvents(); } @@ -69,30 +70,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 +102,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 +131,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,17 +145,21 @@ 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', ]; } public function registerNotificationRules() { + if (!class_exists(\Winter\Notify\Classes\Notifier::class)) { + return []; + } + return [ 'groups' => [ 'user' => [ @@ -163,25 +168,25 @@ 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', ], ]; } protected function bindNotificationEvents() { - if (!class_exists(Notifier::class)) { + if (!class_exists(\Winter\Notify\Classes\Notifier::class)) { return; } 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..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/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/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 October CMS. +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 @@ -47,11 +47,7 @@ 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. - -## Extended features - -For extra functionality, consider also installing the [User Plus+ plugin](http://octobercms.com/plugin/rainlab-userplus) (`RainLab.UserPlus`). +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. ## Session component @@ -90,7 +86,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 +149,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`](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 }}
@@ -219,7 +215,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 +286,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 +298,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 +331,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/aliases.php b/aliases.php new file mode 100644 index 0000000..ef44874 --- /dev/null +++ b/aliases.php @@ -0,0 +1,28 @@ + 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', + 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/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..4726279 100644 --- a/composer.json +++ b/composer.json @@ -1,22 +1,32 @@ { - "name": "rainlab/user-plugin", - "type": "october-plugin", - "description": "User plugin for October CMS", - "homepage": "https://octobercms.com/plugin/rainlab-user", - "keywords": ["october", "octobercms", "user"], + "name": "winter/wn-user-plugin", + "type": "winter-plugin", + "description": "User plugin for Winter CMS", + "homepage": "https://github.com/wintercms/wn-user-plugin", + "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" 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 @@ @@ -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 @@ -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/create_user_groups_table.php b/updates/v1.1.1/create_user_groups_table.php similarity index 91% rename from updates/create_user_groups_table.php rename to updates/v1.1.1/create_user_groups_table.php index e7f8304..0e8420c 100644 --- a/updates/create_user_groups_table.php +++ b/updates/v1.1.1/create_user_groups_table.php @@ -1,7 +1,7 @@ -