fix: Ajustado login em produção/ambiente desenvolvimento.
fix: Ajustado login em produção/ambiente desenvolvimento.
This commit is contained in:
commit
b284b95d51
|
|
@ -6,13 +6,12 @@
|
|||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
// CORREÇÃO 1: Mude de 'user_id' para 'id' e defina como Primary
|
||||
$table->uuid('id')->primary();
|
||||
|
||||
$table->string('name');
|
||||
$table->json('permissions')->nullable();
|
||||
$table->string('email')->unique();
|
||||
|
|
@ -30,7 +29,11 @@ public function up(): void
|
|||
|
||||
Schema::create('sessions', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->foreignId('user_id')->nullable()->index();
|
||||
|
||||
// CORREÇÃO 2: Use foreignUuid para bater com o UUID da tabela users
|
||||
// (foreignId cria Inteiro, o que daria erro de tipo)
|
||||
$table->foreignUuid('user_id')->nullable()->index();
|
||||
|
||||
$table->string('ip_address', 45)->nullable();
|
||||
$table->text('user_agent')->nullable();
|
||||
$table->longText('payload');
|
||||
|
|
@ -38,9 +41,6 @@ public function up(): void
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public function run(): void
|
|||
'name' => 'admin',
|
||||
'permissions' => ['admin'],
|
||||
'email' => 'suporte@inglinesystems.com.br',
|
||||
'password' => Hash::make('*Ingline.Sys#9420%SECURITY#')
|
||||
'password' => '*Ingline.Sys#9420%SECURITY#'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,9 +9,6 @@
|
|||
use App\Http\Controllers\CreateUserController;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
Route::middleware(['auth:sanctum'])->group(function () {
|
||||
//Rotas LinePBX.
|
||||
});
|
||||
|
||||
Route::middleware(['auth'])->group(function () {
|
||||
|
||||
|
|
@ -26,6 +23,7 @@
|
|||
});
|
||||
|
||||
Route::controller(LoginController::class)->group(function () {
|
||||
|
||||
Route::get('/login', function () {
|
||||
if (Auth::check()) {
|
||||
return redirect('dashboard', 302);
|
||||
|
|
@ -38,7 +36,7 @@
|
|||
return redirect('dashboard', 302);
|
||||
}
|
||||
return view('login');
|
||||
})->name('login');
|
||||
});
|
||||
|
||||
Route::post('/login', [LoginController::class, 'login'])->name('login-post');
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue