What problem does it solve?
This Skill provides a robust and secure foundation for user authentication in CFWheels applications, automating the setup of user models, session management, and industry-standard password hashing. It ensures your application's user access is secure and reliable from the start.
Core Features & Use Cases
- Secure User Model: Generates a user model with essential validations (presence, uniqueness, format, length) and SHA-512 password hashing.
- Sessions Controller: Provides a complete sessions controller for handling user login, logout, and session management.
- Authentication Filter: Includes an authentication filter to easily protect specific routes and actions, ensuring only logged-in users can access sensitive areas.
- Use Case: Quickly set up a user login system. This skill provides the
User model with email and password validations, a SessionsController for new, create, and delete actions, and a requireAuth filter to protect sensitive pages, allowing you to focus on core application features.
Quick Start
In User model:
beforeSave("hashPassword");
public any function authenticate(required string email, required string string password) {
# ... authentication logic ...
}
In Sessions controller:
function create() {
var user = model("User").authenticate(email=params.email, password=params.password);
if (isObject(user)) {
session.userId = user.id;
redirectTo(controller="home");
}
}