Skip to content

Site Auth

Introduction

Site uses session auth to authenticate any instance of the User class. The AuthMannager class is responsible of doing the auth process and save the auth user instance on the current session below is and example of how a simple auth goes

use AuthManager;
//...
AuthManager::authenticate($credentials = [
'login' => 'username',
'password' => 'password',
], true); // or false for remember me token

on the code above the login key on credentials array can be name|email depend on the LOGIN_USERNAME constant value of the UserSettings class. Also some other useful functions within the same AuthManager:

use AuthManager;
//...
AuthMnager::check(); // returns true if the user is authenticated.
AuthManager::login($user, true); // Login using this $user model, the second argument for remember me cookie.

The sign in process took place on the Auth class within the keerill/users plugin specifically on the onSignin method