1. Go to this page and download the library: Download winter/wn-user-plugin library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
winter / wn-user-plugin example snippets
Route::group(['middleware' => ['web', 'Winter\User\Classes\AuthMiddleware']], function () {
// All routes here will
public function onCheckEmail()
{
return ['isTaken' => Auth::findUserByLogin(post('email')) ? 1 : 0];
}
// This will not throw an "Email already taken" error
$user = Auth::register([
'email' => '[email protected]',
'password' => 'changeme',
'password_confirmation' => 'changeme',
]);
$user->convertToRegistered();
$user->convertToRegistered(false);
Event::listen('winter.user.deactivate', function($user) {
// Hide all posts by the user
});
Event::listen('winter.user.beforeAuthenticate', function($component, $credentials) {
$login = array_get($credentials, 'login');
$password = array_get($credentials, 'password');
/*
* No such user exists
*/
if (!$user = Auth::findUserByLogin($login)) {
return;
}
/*
* The user is logging in with their old WordPress account
* for the first time. Rehash their password using the new
* Winter CMS system.
*/
if (WordPressLogin::check($user->password, $password)) {
$user->password = $user->password_confirmation = $password;
$user->forceSave();
}
});
bash
php artisan migrate
ini
title = "Restricted page"
url = "/users-only"
[session]
security = "user"
redirect = "home"
ini
title = "Account"
url = "/account/:code?"
[account]
redirect = "home"
paramCode = "code"
==
{% component 'account' %}
ini
title = "Forgotten your password?"
url = "/forgot-password/:code?"
[resetPassword]
paramCode = "code"
==
{% component 'resetPassword' %}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.