관리-도구
편집 파일: test-login-live.php
<?php error_reporting(E_ALL); ini_set('display_errors', 1); if (!defined('DOMAIN_POINTED_DIRECTORY')) { define('DOMAIN_POINTED_DIRECTORY', 'public'); } try { // Boot Laravel if (file_exists(__DIR__.'/vendor/autoload.php')) { $vendor = __DIR__.'/vendor/autoload.php'; $bootstrap = __DIR__.'/bootstrap/app.php'; } else { $vendor = __DIR__.'/../vendor/autoload.php'; $bootstrap = __DIR__.'/../bootstrap/app.php'; } if (!file_exists($vendor)) { throw new Exception("vendor/autoload.php not found at $vendor"); } require $vendor; if (!file_exists($bootstrap)) { throw new Exception("bootstrap/app.php not found at $bootstrap"); } $app = require_once $bootstrap; $request = Illuminate\Http\Request::createFromGlobals(); $app->instance('request', $request); $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class); $kernel->bootstrap(); } catch (Throwable $e) { echo "<h3>Bootstrap Error:</h3>"; echo "<pre>" . $e->getMessage() . "\n" . $e->getTraceAsString() . "</pre>"; exit; } use App\Models\User; use Illuminate\Support\Facades\Hash; echo "<h2>Laravel Auth Diagnostics</h2>"; $email = 'jayakumar.a@sinceresyndication.com'; $password = '12345678'; // 1. Check user model lookup try { $user = User::where('email', $email)->first(); if (!$user) { echo "<p style='color:red;'>❌ User not found with email: $email</p>"; $users = User::limit(10)->get(); echo "Existing users in database:<br>"; foreach ($users as $u) { echo "- Email: '{$u->email}', Phone: '{$u->phone}'<br>"; } exit; } else { echo "<p style='color:green;'>✓ User found: Name: {$user->f_name} {$user->l_name}, Email: {$user->email}, Phone: {$user->phone}</p>"; } } catch (Throwable $e) { echo "<p style='color:red;'>❌ Error during User lookup: " . $e->getMessage() . "</p>"; exit; } // 2. Check password hash echo "Stored Hash in Database: <code>" . $user->password . "</code><br>"; $check = Hash::check($password, $user->password); if ($check) { echo "<p style='color:green;'>✓ Password check passed for '12345678'!</p>"; } else { echo "<p style='color:red;'>❌ Password check FAILED for '12345678'!</p>"; echo "Generated new hash of '12345678': <code>" . Hash::make($password) . "</code><br>"; } // 3. Check auth guard customer try { $loginMedia = $user->phone ? 'phone' : 'email'; echo "Attempting to login via customer guard using $loginMedia...<br>"; $attempt = auth('customer')->attempt([$loginMedia => $user->$loginMedia, 'password' => $password], false); if ($attempt) { echo "<p style='color:green;'>✓ auth('customer')->attempt passed!</p>"; } else { echo "<p style='color:red;'>❌ auth('customer')->attempt FAILED!</p>"; } } catch (Throwable $e) { echo "<p style='color:red;'>❌ Error during attempt: " . $e->getMessage() . "</p>"; }