← スキル一覧に戻る

wheels-auth-generator
by wheels-dev
wheels-auth-generatorは、other分野における実用的なスキルです。複雑な課題への対応力を強化し、業務効率と成果の質を改善します。
⭐ 200🍴 106📅 2026年1月23日
SKILL.md
name: Wheels Auth Generator description: 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.
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
スコア
総合スコア
75/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
○説明文
100文字以上の説明がある
0/10
✓人気
GitHub Stars 100以上
+5
✓最近の活動
1ヶ月以内に更新
+10
✓フォーク
10回以上フォークされている
+5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
✓タグ
1つ以上のタグが設定されている
+5
レビュー
💬
レビュー機能は近日公開予定です
