Files
rspade_system/app/RSpade/Core/Auth/RsxAuth.php
root 77b4d10af8 Refactor filename naming system and apply convention-based renames
Standardize settings file naming and relocate documentation files
Fix code quality violations from rsx:check
Reorganize user_management directory into logical subdirectories
Move Quill Bundle to core and align with Tom Select pattern
Simplify Site Settings page to focus on core site information
Complete Phase 5: Multi-tenant authentication with login flow and site selection
Add route query parameter rule and synchronize filename validation logic
Fix critical bug in UpdateNpmCommand causing missing JavaScript stubs
Implement filename convention rule and resolve VS Code auto-rename conflict
Implement js-sanitizer RPC server to eliminate 900+ Node.js process spawns
Implement RPC server architecture for JavaScript parsing
WIP: Add RPC server infrastructure for JS parsing (partial implementation)
Update jqhtml terminology from destroy to stop, fix datagrid DOM preservation
Add JQHTML-CLASS-01 rule and fix redundant class names
Improve code quality rules and resolve violations
Remove legacy fatal error format in favor of unified 'fatal' error type
Filter internal keys from window.rsxapp output
Update button styling and comprehensive form/modal documentation
Add conditional fly-in animation for modals
Fix non-deterministic bundle compilation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-13 19:10:02 +00:00

73 lines
1.7 KiB
PHP
Executable File

<?php
/**
* CODING CONVENTION:
* This file follows the coding convention where variable_names and function_names
* use snake_case (underscore_wherever_possible).
*/
namespace App\RSpade\Core\Auth;
use Illuminate\Support\Facades\Hash;
use App\RSpade\Core\Models\Login_User_Model;
use App\RSpade\Core\Session\Session;
/**
* RSX Authentication service
*
* Provides authentication logic for login/logout.
* Authenticates against login_users table (authentication identity).
* All session management is handled by the Session class directly.
*/
class RsxAuth
{
/**
* Attempt to authenticate a user
*
* @param array $credentials
* @return bool
*/
public static function attempt(array $credentials)
{
$email = $credentials['email'] ?? null;
$password = $credentials['password'] ?? null;
if (!$email || !$password) {
return false;
}
// Authenticate against login_users table (authentication identity)
$login_user = Login_User_Model::where('email', $email)->first();
if (!$login_user || !Hash::check($password, $login_user->password)) {
return false;
}
return self::login($login_user);
}
/**
* Log in a user and create session
*
* @param Login_User_Model $login_user
* @return bool
*/
public static function login(Login_User_Model $login_user)
{
// Use Session to set the login user (will create session if needed)
Session::set_login_user_id($login_user->id);
return true;
}
/**
* Log out the current user
*
* @return void
*/
public static function logout()
{
// Use Session to logout
Session::logout();
}
}