Documentation
- Installation
- Controller
- Views
- Database access
- Modules
- Autoloading
- Config management
- Localization
- Logging
- Environment
- Helpers
- Exceptions
- CLI interface
- Events
- Commands
- Authentication
- Caching
- Testing
- mail() wrapper
- SMTP mailer
- HTML helpers
- npm/webpack
Authentication
Via the Asatru CLI you can create an authentication model and migration.
php asatru make:auth
Be sure to run the migration command (preferably list) after you have issued the command. This will then create the database table.
php asatru migrate:list
The authentication components consist of migrations and models for authentication and session. It features multisession logins.
The authentication model provides you with the following methods:
//To register a new user
public static function register($username, $email, $password) {}
//Used to confirm validity via a confirmation token
public static function confirm($token) {}
//To log a user in
public static function login($email, $password) {}
//To log a user out
public static function logout() {}
//Get current authenticated user if any
public static function getAuthUser() {}
//Get a user data object by email
public static function getByEmail($email) {}
//Get a user data object by user ID
public static function getById($userId) {}
The session model provides you with the following methods:
//Logs the user in with current session
public static function loginSession(userId, session) {}
//Performs a logout from the current session
public static function logoutSession(session) {}
//Returns a data object from the given session
public static function findSession(session) {}
//Indicates if there is an active user session
public static function hasSession(userId, session) {}
//Clears all sessions of that given user
public static function clearForUser(userId) {}