parent
7be7c2f278
commit
8496ff9fcd
11 changed files with 2815 additions and 9 deletions
@ -0,0 +1,35 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
namespace App\Livewire\Auth; |
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Auth; |
||||||
|
use Livewire\Component; |
||||||
|
|
||||||
|
class Login extends Component |
||||||
|
{ |
||||||
|
public $email = ''; |
||||||
|
public $password = ''; |
||||||
|
public $remember = false; |
||||||
|
|
||||||
|
protected $rules = [ |
||||||
|
'email' => 'required|email', |
||||||
|
'password' => 'required', |
||||||
|
]; |
||||||
|
|
||||||
|
public function login() |
||||||
|
{ |
||||||
|
$this->validate(); |
||||||
|
|
||||||
|
if (Auth::attempt(['email' => $this->email, 'password' => $this->password], $this->remember)) { |
||||||
|
request()->session()->regenerate(); |
||||||
|
return redirect()->intended('/dashboard'); |
||||||
|
} |
||||||
|
|
||||||
|
$this->addError('email', 'Email hoặc mật khẩu không đúng.'); |
||||||
|
} |
||||||
|
|
||||||
|
public function render() |
||||||
|
{ |
||||||
|
return view('livewire.auth.login')->layout('layouts.app'); |
||||||
|
} |
||||||
|
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,6 @@ |
|||||||
|
module.exports = { |
||||||
|
plugins: { |
||||||
|
'@tailwindcss/postcss': {}, |
||||||
|
autoprefixer: {}, |
||||||
|
}, |
||||||
|
}; |
@ -1,11 +1,14 @@ |
|||||||
@import 'tailwindcss'; |
@import "tailwindcss"; |
||||||
|
|
||||||
@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php'; |
/* Khai báo nguồn các file Blade để Tailwind nhận dạng các class CSS */ |
||||||
@source '../../storage/framework/views/*.php'; |
@source "../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php"; |
||||||
@source '../**/*.blade.php'; |
@source "../../storage/framework/views/*.php"; |
||||||
@source '../**/*.js'; |
@source "../**/*.blade.php"; |
||||||
|
@source "../**/*.js"; |
||||||
|
|
||||||
|
/* Khai báo biến tùy chỉnh cho theme, ví dụ font mặc định */ |
||||||
@theme { |
@theme { |
||||||
--font-sans: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', |
--font-sans: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; |
||||||
'Segoe UI Symbol', 'Noto Color Emoji'; |
|
||||||
} |
} |
||||||
|
|
||||||
|
/* Các lớp tùy chỉnh thêm vào đây nếu muốn */ |
||||||
|
@ -0,0 +1,21 @@ |
|||||||
|
<!DOCTYPE html> |
||||||
|
<html lang="vi"> |
||||||
|
|
||||||
|
<head> |
||||||
|
<meta charset="UTF-8"> |
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||||
|
<title>Đăng nhập hệ thống</title> |
||||||
|
|
||||||
|
@vite('resources/css/app.css') |
||||||
|
@livewireStyles |
||||||
|
</head> |
||||||
|
|
||||||
|
<body class="bg-gray-100 antialiased"> |
||||||
|
<div class="min-h-screen flex items-center justify-center py-12"> |
||||||
|
{{ $slot }} |
||||||
|
</div> |
||||||
|
|
||||||
|
@livewireScripts |
||||||
|
</body> |
||||||
|
|
||||||
|
</html> |
@ -0,0 +1,32 @@ |
|||||||
|
<div class="max-w-md w-full bg-white shadow-xl rounded-lg p-8"> |
||||||
|
<h2 class="text-2xl font-semibold text-center text-gray-900 mb-6">Đăng nhập hệ thống</h2> |
||||||
|
|
||||||
|
<form wire:submit.prevent="login" class="space-y-4"> |
||||||
|
<div> |
||||||
|
<label class="block text-sm font-medium text-gray-700">Email:</label> |
||||||
|
<input type="email" wire:model="email" required |
||||||
|
class="mt-1 block w-full rounded-md border border-gray-300 shadow-sm py-2 px-3 focus:ring-indigo-500 focus:border-indigo-500"> |
||||||
|
@error('email') |
||||||
|
<div class="text-red-500 text-sm">{{ $message }}</div> |
||||||
|
@enderror |
||||||
|
</div> |
||||||
|
|
||||||
|
<div> |
||||||
|
<label class="block text-sm font-medium text-gray-700">Mật khẩu:</label> |
||||||
|
<input type="password" wire:model="password" required |
||||||
|
class="mt-1 block w-full rounded-md border border-gray-300 shadow-sm py-2 px-3 focus:ring-indigo-500 focus:border-indigo-500"> |
||||||
|
@error('password') |
||||||
|
<div class="text-red-500 text-sm">{{ $message }}</div> |
||||||
|
@enderror |
||||||
|
</div> |
||||||
|
|
||||||
|
<div class="flex items-center"> |
||||||
|
<input type="checkbox" wire:model="remember" id="remember" class="h-4 w-4 text-indigo-600 border-gray-300 rounded"> |
||||||
|
<label for="remember" class="ml-2 text-sm text-gray-900">Ghi nhớ đăng nhập</label> |
||||||
|
</div> |
||||||
|
|
||||||
|
<button type="submit" class="w-full py-2 px-4 bg-indigo-600 text-white rounded hover:bg-indigo-700 transition duration-200"> |
||||||
|
Đăng nhập |
||||||
|
</button> |
||||||
|
</form> |
||||||
|
</div> |
@ -1,7 +1,9 @@ |
|||||||
<?php |
<?php |
||||||
|
|
||||||
use Illuminate\Support\Facades\Route; |
use Illuminate\Support\Facades\Route; |
||||||
|
use App\Livewire\Auth\Login; |
||||||
|
|
||||||
Route::get('/', function () { |
Route::get('/', function () { |
||||||
return view('welcome'); |
return view('welcome'); |
||||||
}); |
}); |
||||||
|
Route::get('/login', Login::class)->name('login')->middleware('guest'); |
||||||
|
@ -0,0 +1,10 @@ |
|||||||
|
module.exports = { |
||||||
|
content: [ |
||||||
|
"./resources/**/*.blade.php", |
||||||
|
"./resources/**/*.js", |
||||||
|
], |
||||||
|
theme: { |
||||||
|
extend: {}, |
||||||
|
}, |
||||||
|
plugins: [], |
||||||
|
}; |
Loading…
Reference in new issue