wheels-auth-generator

wheels-dev's avatarfrom wheels-dev

Generate authentication system with user model, sessions controller, and password hashing. Use when implementing user authentication, login/logout, or session management. Provides secure authentication patterns and bcrypt support.

⭐200stars🔀107forks📁View on GitHub🕐Updated Jan 1, 2026

When & Why to Use This Skill

The Wheels Auth Generator is a specialized Claude skill designed to automate the creation of secure authentication systems for CFWheels applications. It streamlines the development process by generating robust user models, session controllers, and password hashing logic. By providing standardized patterns for login, logout, and session management, it ensures that developers can implement secure user access control with minimal manual effort while adhering to industry best practices.

Use Cases

  • 1. Rapid Prototyping: Quickly scaffold a complete authentication module for new web projects to accelerate the initial development phase.
  • 2. Security Standardization: Implement consistent and secure password hashing (SHA-512) and session handling across multiple applications to reduce vulnerability risks.
  • 3. User Management Integration: Seamlessly add user registration, email validation, and secure login/logout functionality to existing ColdFusion-based web apps.
  • 4. Access Control Implementation: Automatically generate authentication filters to protect sensitive routes and ensure only authorized users can access specific controller actions.
nameWheels Auth Generator
descriptionGenerate authentication system with user model, sessions controller, and password hashing. Use when implementing user authentication, login/logout, or session management. Provides secure authentication patterns and bcrypt support.

Wheels Auth Generator

When to Use This Skill

Activate when:

  • User requests authentication/login system
  • User wants user registration
  • User mentions: auth, login, logout, session, password, signup

User Model with Authentication

component extends="Model" {

    function config() {
        validatesPresenceOf(property="email,password");
        validatesUniquenessOf(property="email");
        validatesFormatOf(
            property="email",
            regEx="^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$"
        );
        validatesLengthOf(property="password", minimum=8);
        validatesConfirmationOf(property="password");

        beforeSave("hashPassword");
    }

    private function hashPassword() {
        if (structKeyExists(this, "password") && len(this.password) && !isHashed(this.password)) {
            this.password = hash(this.password, "SHA-512");
        }
    }

    private boolean function isHashed(required string password) {
        return len(arguments.password) == 128;
    }

    public any function authenticate(required string email, required string password) {
        var user = this.findOne(where="email = '#arguments.email#'");

        if (!isObject(user)) return false;

        var hashedAttempt = hash(arguments.password, "SHA-512");

        return (user.password == hashedAttempt) ? user : false;
    }
}

Sessions Controller

component extends="Controller" {

    function new() {
        // Show login form
    }

    function create() {
        var user = model("User").authenticate(
            email=params.email,
            password=params.password
        );

        if (isObject(user)) {
            session.userId = user.id;
            flashInsert(success="Welcome back!");
            redirectTo(controller="home", action="index");
        } else {
            flashInsert(error="Invalid email or password");
            renderPage(action="new");
        }
    }

    function delete() {
        structDelete(session, "userId");
        flashInsert(success="You have been logged out");
        redirectTo(controller="home", action="index");
    }
}

Authentication Filter

// In any controller requiring authentication
function config() {
    filters(through="requireAuth");
}

private function requireAuth() {
    if (!structKeyExists(session, "userId")) {
        flashInsert(error="Please log in");
        redirectTo(controller="sessions", action="new");
    }
}

Generated by: Wheels Auth Generator Skill v1.0