From f194a70cd4d739e0c90df4424bd6aeb0b816c5be Mon Sep 17 00:00:00 2001 From: konard Date: Tue, 28 Oct 2025 04:34:21 +0100 Subject: [PATCH 01/13] Initial commit with task details for issue #26 Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: undefined --- CLAUDE.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CLAUDE.md b/CLAUDE.md index a4a5ebf..a0d22a2 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -236,3 +236,13 @@ composer test ## Дальнейшее развитие Проект готов к расширению функциональности управления задачами. Текущая база включает полную систему аутентификации и базовые настройки пользователя, что обеспечивает прочную основу для добавления модуля задач. + +--- + +Issue to solve: undefined +Your prepared branch: issue-26-351b07be +Your prepared working directory: /tmp/gh-issue-solver-1761622455459 +Your forked repository: konard/TaskMateFrontend +Original repository (upstream): xierongchuan/TaskMateFrontend + +Proceed. \ No newline at end of file From 5d504ad650f81b81f06f98466a31b11f42d4c7ea Mon Sep 17 00:00:00 2001 From: konard Date: Tue, 28 Oct 2025 04:41:19 +0100 Subject: [PATCH 02/13] refactor: convert to frontend-only architecture with API authentication MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit transforms the application from a traditional Laravel backend with database authentication to a frontend-only architecture that communicates with an external API. Major changes: - **API Configuration**: Added API_URL to .env.example and created config/api.php for external API settings - **Authentication System**: Completely refactored authentication to use external API - LoginController and RegistrationController now call external API for authentication - User credentials and tokens are stored in session instead of database - Created custom ApiAuthenticate and ApiGuest middleware for session-based auth - Removed password reset and email verification controllers (handled by API) - **Database**: Removed users migration - only keeping sessions, cache, jobs, and settings migrations for Laravel infrastructure - **Settings System**: Updated to use session ID instead of user ID from database - Modified BotApiController to work with session-based identification - Updated Setting model helper methods to use session()->getId() - **Views**: - Updated login/register views to use "login" field instead of "email" to match API schema - Modified app header to display user info from session data instead of Auth::user() - **Routing**: - Replaced 'auth' and 'verified' middleware with custom 'api.auth' middleware - Removed all password reset and email verification routes - Cleaned up settings routes (removed profile, password, appearance - these are managed via API) - **Controllers**: - Updated ApiProxyController to get token from session instead of Setting model - Removed unused settings controllers (ProfileController, PasswordController, AppearanceController) The application now functions as a pure frontend that proxies all data requests to the external TaskMate Telegram Bot API, with authentication managed through API tokens stored in session storage. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .env.example | 4 ++ app/Http/Controllers/ApiProxyController.php | 33 ++++------ .../Auth/ConfirmationController.php | 34 ---------- app/Http/Controllers/Auth/LoginController.php | 64 +++++++++++++++---- .../Auth/NewPasswordController.php | 54 ---------------- .../Auth/PasswordResetLinkController.php | 28 -------- .../Auth/RegistrationController.php | 54 ++++++++++++---- .../Auth/VerificationController.php | 47 -------------- .../Settings/AppearanceController.php | 14 ---- .../Controllers/Settings/BotApiController.php | 30 ++++++--- .../Settings/PasswordController.php | 34 ---------- .../Settings/ProfileController.php | 62 ------------------ app/Http/Middleware/ApiAuthenticate.php | 31 +++++++++ app/Http/Middleware/ApiGuest.php | 25 ++++++++ app/Models/Setting.php | 16 ++--- bootstrap/app.php | 5 +- config/api.php | 16 +++++ .../0001_01_01_000000_create_users_table.php | 49 -------------- resources/views/auth/login.blade.php | 6 +- resources/views/auth/register.blade.php | 15 +++-- .../components/layouts/app/header.blade.php | 11 +++- routes/auth.php | 21 +----- routes/web.php | 11 +--- 23 files changed, 234 insertions(+), 430 deletions(-) delete mode 100644 app/Http/Controllers/Auth/ConfirmationController.php delete mode 100644 app/Http/Controllers/Auth/NewPasswordController.php delete mode 100644 app/Http/Controllers/Auth/PasswordResetLinkController.php delete mode 100644 app/Http/Controllers/Auth/VerificationController.php delete mode 100644 app/Http/Controllers/Settings/AppearanceController.php delete mode 100644 app/Http/Controllers/Settings/PasswordController.php delete mode 100644 app/Http/Controllers/Settings/ProfileController.php create mode 100644 app/Http/Middleware/ApiAuthenticate.php create mode 100644 app/Http/Middleware/ApiGuest.php create mode 100644 config/api.php delete mode 100644 database/migrations/0001_01_01_000000_create_users_table.php diff --git a/.env.example b/.env.example index ca01994..ba4f73e 100644 --- a/.env.example +++ b/.env.example @@ -63,3 +63,7 @@ AWS_BUCKET= AWS_USE_PATH_STYLE_ENDPOINT=false VITE_APP_NAME="${APP_NAME}" + +# External API Configuration +API_URL=http://localhost:8007/api/v1 +API_TIMEOUT=30 diff --git a/app/Http/Controllers/ApiProxyController.php b/app/Http/Controllers/ApiProxyController.php index 49fc055..75d7628 100644 --- a/app/Http/Controllers/ApiProxyController.php +++ b/app/Http/Controllers/ApiProxyController.php @@ -5,7 +5,6 @@ use Illuminate\Http\Request; use Illuminate\Http\JsonResponse; use Illuminate\Support\Facades\Http; -use App\Models\Setting; class ApiProxyController extends Controller { @@ -15,20 +14,19 @@ class ApiProxyController extends Controller public function proxy(Request $request, string $endpoint): JsonResponse { try { - // Get user's API settings - $apiUrl = Setting::getValue('api_url', 'http://host.docker.internal:8007/api/v1'); - $apiToken = Setting::getValue('auth_token'); + // Get API URL from configuration + $apiUrl = config('api.url'); + + // Get token from session + $apiToken = $request->session()->get('api_token'); if (!$apiToken) { return response()->json([ - 'error' => 'API token not configured', - 'message' => 'Please configure your Telegram Bot API token in settings' + 'error' => 'Authentication required', + 'message' => 'Please login to access this resource' ], 401); } - // Replace localhost with host.docker.internal for Docker environment - $apiUrl = str_replace('http://localhost:', 'http://host.docker.internal:', $apiUrl); - // Build the external URL $externalUrl = rtrim($apiUrl, '/') . '/' . ltrim($endpoint, '/'); @@ -46,7 +44,7 @@ public function proxy(Request $request, string $endpoint): JsonResponse // Make the external request $response = Http::withHeaders($headers) - ->timeout(30) + ->timeout(config('api.timeout')) ->send( $request->method(), $externalUrl, @@ -67,7 +65,6 @@ public function proxy(Request $request, string $endpoint): JsonResponse \Log::error('API Proxy Error: ' . $e->getMessage(), [ 'endpoint' => $endpoint, 'method' => $request->method(), - 'user_id' => auth()->id(), ]); return response()->json([ @@ -84,19 +81,18 @@ public function proxy(Request $request, string $endpoint): JsonResponse public function proxyUpload(Request $request, string $endpoint): JsonResponse { try { - // Get user's API settings - $apiUrl = Setting::getValue('api_url', 'http://host.docker.internal:8007/api/v1'); - $apiToken = Setting::getValue('auth_token'); + // Get API URL from configuration + $apiUrl = config('api.url'); + + // Get token from session + $apiToken = $request->session()->get('api_token'); if (!$apiToken) { return response()->json([ - 'error' => 'API token not configured' + 'error' => 'Authentication required' ], 401); } - // Replace localhost with host.docker.internal for Docker environment - $apiUrl = str_replace('http://localhost:', 'http://host.docker.internal:', $apiUrl); - $externalUrl = rtrim($apiUrl, '/') . '/' . ltrim($endpoint, '/'); // Prepare headers @@ -142,7 +138,6 @@ public function proxyUpload(Request $request, string $endpoint): JsonResponse } catch (\Exception $e) { \Log::error('API Proxy Upload Error: ' . $e->getMessage(), [ 'endpoint' => $endpoint, - 'user_id' => auth()->id(), ]); return response()->json([ diff --git a/app/Http/Controllers/Auth/ConfirmationController.php b/app/Http/Controllers/Auth/ConfirmationController.php deleted file mode 100644 index 0a54e65..0000000 --- a/app/Http/Controllers/Auth/ConfirmationController.php +++ /dev/null @@ -1,34 +0,0 @@ -validate([ - 'email' => $request->user()->email, - 'password' => $request->password, - ])) { - throw ValidationException::withMessages([ - 'password' => __('auth.password'), - ]); - } - - $request->session()->put('auth.password_confirmed_at', time()); - - return redirect()->intended(route('dashboard', absolute: false)); - } -} diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 46ab9e5..55a2ccf 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -6,7 +6,7 @@ use Illuminate\Auth\Events\Lockout; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; -use Illuminate\Support\Facades\Auth; +use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\RateLimiter; use Illuminate\Support\Str; use Illuminate\Validation\ValidationException; @@ -22,33 +22,73 @@ public function create(): View public function store(Request $request): RedirectResponse { $request->validate([ - 'email' => ['required', 'string', 'email'], + 'email' => ['required', 'string'], 'password' => ['required', 'string'], ]); $this->ensureIsNotRateLimited($request); - if (! Auth::attempt($request->only('email', 'password'), $request->boolean('remember'))) { + try { + // Call external API for authentication + $apiUrl = config('api.url'); + $response = Http::timeout(config('api.timeout')) + ->post("{$apiUrl}/session", [ + 'login' => $request->input('email'), + 'password' => $request->input('password'), + ]); + + if (!$response->successful()) { + RateLimiter::hit($this->throttleKey($request)); + + $errorMessage = $response->json('message') ?? trans('auth.failed'); + throw ValidationException::withMessages([ + 'email' => $errorMessage, + ]); + } + + $data = $response->json(); + + // Store authentication data in session + $request->session()->regenerate(); + $request->session()->put('api_token', $data['token'] ?? null); + $request->session()->put('user', $data['user'] ?? null); + $request->session()->put('authenticated', true); + + RateLimiter::clear($this->throttleKey($request)); + + return redirect()->intended(route('dashboard', absolute: false)); + + } catch (\Exception $e) { + if ($e instanceof ValidationException) { + throw $e; + } + RateLimiter::hit($this->throttleKey($request)); throw ValidationException::withMessages([ - 'email' => trans('auth.failed'), + 'email' => 'Unable to connect to authentication service. Please try again later.', ]); } - - RateLimiter::clear($this->throttleKey($request)); - - $request->session()->regenerate(); - - return redirect()->intended(route('dashboard', absolute: false)); } public function destroy(Request $request): RedirectResponse { - Auth::guard('web')->logout(); + try { + // Call API logout if we have a token + $token = $request->session()->get('api_token'); + if ($token) { + $apiUrl = config('api.url'); + Http::timeout(config('api.timeout')) + ->withToken($token) + ->delete("{$apiUrl}/session"); + } + } catch (\Exception $e) { + // Log error but continue with local logout + \Log::warning('API logout failed: ' . $e->getMessage()); + } + // Clear session $request->session()->invalidate(); - $request->session()->regenerateToken(); return redirect('/'); diff --git a/app/Http/Controllers/Auth/NewPasswordController.php b/app/Http/Controllers/Auth/NewPasswordController.php deleted file mode 100644 index 5178ab0..0000000 --- a/app/Http/Controllers/Auth/NewPasswordController.php +++ /dev/null @@ -1,54 +0,0 @@ - $request]); - } - - public function store(Request $request): RedirectResponse - { - $request->validate([ - 'token' => ['required'], - 'email' => ['required', 'email'], - 'password' => ['required', 'confirmed', Rules\Password::defaults()], - ]); - - // Here we will attempt to reset the user's password. If it is successful we - // will update the password on an actual user model and persist it to the - // database. Otherwise we will parse the error and return the response. - $status = Password::reset( - $request->only('email', 'password', 'password_confirmation', 'token'), - function (User $user) use ($request) { - $user->forceFill([ - 'password' => Hash::make($request->password), - 'remember_token' => Str::random(60), - ])->save(); - - event(new PasswordReset($user)); - } - ); - - // If the password was successfully reset, we will redirect the user back to - // the application's home authenticated view. If there is an error we can - // redirect them back to where they came from with their error message. - return $status == Password::PASSWORD_RESET - ? to_route('login')->with('status', __($status)) - : back()->withInput($request->only('email')) - ->withErrors(['email' => __($status)]); - } -} diff --git a/app/Http/Controllers/Auth/PasswordResetLinkController.php b/app/Http/Controllers/Auth/PasswordResetLinkController.php deleted file mode 100644 index 6ea25e2..0000000 --- a/app/Http/Controllers/Auth/PasswordResetLinkController.php +++ /dev/null @@ -1,28 +0,0 @@ -validate([ - 'email' => ['required', 'email'], - ]); - - Password::sendResetLink($request->only('email')); - - return back()->with('status', __('A reset link will be sent if the account exists.')); - } -} diff --git a/app/Http/Controllers/Auth/RegistrationController.php b/app/Http/Controllers/Auth/RegistrationController.php index 4c33bec..f78c5e0 100644 --- a/app/Http/Controllers/Auth/RegistrationController.php +++ b/app/Http/Controllers/Auth/RegistrationController.php @@ -3,13 +3,10 @@ namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; -use App\Models\User; -use Illuminate\Auth\Events\Registered; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; -use Illuminate\Support\Facades\Auth; -use Illuminate\Support\Facades\Hash; -use Illuminate\Validation\Rules; +use Illuminate\Support\Facades\Http; +use Illuminate\Validation\ValidationException; use Illuminate\View\View; class RegistrationController extends Controller @@ -21,18 +18,49 @@ public function create(): View public function store(Request $request): RedirectResponse { - $validated = $request->validate([ - 'name' => ['required', 'string', 'max:255'], - 'email' => ['required', 'string', 'lowercase', 'email', 'max:255', 'unique:'.User::class], - 'password' => ['required', 'confirmed', Rules\Password::defaults()], + $request->validate([ + 'login' => ['required', 'string', 'max:255'], + 'password' => ['required', 'confirmed', 'min:12'], ]); - $validated['password'] = Hash::make($validated['password']); + try { + // Call external API for registration + $apiUrl = config('api.url'); + $response = Http::timeout(config('api.timeout')) + ->post("{$apiUrl}/register", [ + 'login' => $request->input('login'), + 'password' => $request->input('password'), + ]); - event(new Registered(($user = User::create($validated)))); + if (!$response->successful()) { + $errors = $response->json('errors') ?? []; + $message = $response->json('message') ?? 'Registration failed'; - Auth::login($user); + if (empty($errors)) { + $errors = ['login' => [$message]]; + } - return redirect(route('dashboard', absolute: false)); + throw ValidationException::withMessages($errors); + } + + $data = $response->json(); + + // Store authentication data in session + $request->session()->regenerate(); + $request->session()->put('api_token', $data['token'] ?? null); + $request->session()->put('user', $data['user'] ?? null); + $request->session()->put('authenticated', true); + + return redirect(route('dashboard', absolute: false)); + + } catch (\Exception $e) { + if ($e instanceof ValidationException) { + throw $e; + } + + throw ValidationException::withMessages([ + 'login' => 'Unable to connect to registration service. Please try again later.', + ]); + } } } diff --git a/app/Http/Controllers/Auth/VerificationController.php b/app/Http/Controllers/Auth/VerificationController.php deleted file mode 100644 index ed60bf4..0000000 --- a/app/Http/Controllers/Auth/VerificationController.php +++ /dev/null @@ -1,47 +0,0 @@ -user()->hasVerifiedEmail() - ? redirect()->intended(route('dashboard', absolute: false)) - : view('auth.verify-email'); - } - - public function store(Request $request): RedirectResponse - { - if ($request->user()->hasVerifiedEmail()) { - return redirect()->intended(route('dashboard', absolute: false)); - } - - $request->user()->sendEmailVerificationNotification(); - - return back()->with('status', 'verification-link-sent'); - } - - public function verify(EmailVerificationRequest $request): RedirectResponse - { - if ($request->user()->hasVerifiedEmail()) { - return redirect()->intended(route('dashboard', absolute: false).'?verified=1'); - } - - if ($request->user()->markEmailAsVerified()) { - /** @var \Illuminate\Contracts\Auth\MustVerifyEmail $user */ - $user = $request->user(); - - event(new Verified($user)); - } - - return redirect()->intended(route('dashboard', absolute: false).'?verified=1'); - } -} diff --git a/app/Http/Controllers/Settings/AppearanceController.php b/app/Http/Controllers/Settings/AppearanceController.php deleted file mode 100644 index f8caff7..0000000 --- a/app/Http/Controllers/Settings/AppearanceController.php +++ /dev/null @@ -1,14 +0,0 @@ -get(); + // Use session ID as user_id for settings + $sessionId = $request->session()->getId(); + $settings = Setting::where('user_id', $sessionId)->get(); return response()->json([ 'data' => $settings @@ -34,9 +35,11 @@ public function index(): JsonResponse /** * Get specific setting by key. */ - public function show(string $key): JsonResponse + public function show(Request $request, string $key): JsonResponse { - $setting = Setting::where('user_id', Auth::id()) + // Use session ID as user_id for settings + $sessionId = $request->session()->getId(); + $setting = Setting::where('user_id', $sessionId) ->where('key', $key) ->first(); @@ -61,10 +64,13 @@ public function update(Request $request, string $key): JsonResponse return response()->json(['errors' => $validator->errors()], 422); } + // Use session ID as user_id for settings + $sessionId = $request->session()->getId(); $setting = Setting::setValue( $key, $request->input('value'), - $request->input('type', 'string') + $request->input('type', 'string'), + $sessionId ); return response()->json(['data' => $setting]); @@ -94,7 +100,9 @@ public function bulkUpdate(Request $request): JsonResponse ]; } - $results = Setting::setBulk($settingsData); + // Use session ID as user_id for settings + $sessionId = $request->session()->getId(); + $results = Setting::setBulk($settingsData, $sessionId); return response()->json(['data' => array_values($results)]); } @@ -102,9 +110,11 @@ public function bulkUpdate(Request $request): JsonResponse /** * Delete a setting. */ - public function destroy(string $key): JsonResponse + public function destroy(Request $request, string $key): JsonResponse { - $setting = Setting::where('user_id', Auth::id()) + // Use session ID as user_id for settings + $sessionId = $request->session()->getId(); + $setting = Setting::where('user_id', $sessionId) ->where('key', $key) ->first(); diff --git a/app/Http/Controllers/Settings/PasswordController.php b/app/Http/Controllers/Settings/PasswordController.php deleted file mode 100644 index 60d3685..0000000 --- a/app/Http/Controllers/Settings/PasswordController.php +++ /dev/null @@ -1,34 +0,0 @@ - $request->user(), - ]); - } - - public function update(Request $request): RedirectResponse - { - $validated = $request->validate([ - 'current_password' => ['required', 'current_password'], - 'password' => ['required', Rules\Password::defaults(), 'confirmed'], - ]); - - $request->user()->update([ - 'password' => Hash::make($validated['password']), - ]); - - return back()->with('status', 'password-updated'); - } -} diff --git a/app/Http/Controllers/Settings/ProfileController.php b/app/Http/Controllers/Settings/ProfileController.php deleted file mode 100644 index a0c1bc9..0000000 --- a/app/Http/Controllers/Settings/ProfileController.php +++ /dev/null @@ -1,62 +0,0 @@ - $request->user(), - ]); - } - - public function update(Request $request): RedirectResponse - { - $user = $request->user(); - - $validated = $request->validate([ - 'name' => ['required', 'string', 'max:255'], - 'email' => [ - 'required', - 'string', - 'lowercase', - 'email', - 'max:255', - Rule::unique(User::class)->ignore($user->id), - ], - ]); - - $user->fill($validated); - - if ($user->isDirty('email')) { - $user->email_verified_at = null; - } - - $user->save(); - - return to_route('settings.profile.edit')->with('status', __('Profile updated successfully')); - } - - public function destroy(Request $request): RedirectResponse - { - $user = $request->user(); - - Auth::logout(); - - $user->delete(); - - $request->session()->invalidate(); - $request->session()->regenerateToken(); - - return to_route('home'); - } -} diff --git a/app/Http/Middleware/ApiAuthenticate.php b/app/Http/Middleware/ApiAuthenticate.php new file mode 100644 index 0000000..eaaad9e --- /dev/null +++ b/app/Http/Middleware/ApiAuthenticate.php @@ -0,0 +1,31 @@ +session()->get('authenticated')) { + return redirect()->guest(route('login')); + } + + // Check if we have an API token + if (!$request->session()->get('api_token')) { + $request->session()->flush(); + return redirect()->guest(route('login')); + } + + return $next($request); + } +} diff --git a/app/Http/Middleware/ApiGuest.php b/app/Http/Middleware/ApiGuest.php new file mode 100644 index 0000000..0cda2d5 --- /dev/null +++ b/app/Http/Middleware/ApiGuest.php @@ -0,0 +1,25 @@ +session()->get('authenticated')) { + return redirect(route('dashboard')); + } + + return $next($request); + } +} diff --git a/app/Models/Setting.php b/app/Models/Setting.php index 711952b..ed1ac01 100644 --- a/app/Models/Setting.php +++ b/app/Models/Setting.php @@ -27,9 +27,9 @@ public function user() return $this->belongsTo(User::class); } - public static function getValue(string $key, mixed $default = null, ?int $userId = null) + public static function getValue(string $key, mixed $default = null, ?string $userId = null) { - $userId = $userId ?? auth()->id(); + $userId = $userId ?? session()->getId(); $setting = static::where('user_id', $userId) ->where('key', $key) @@ -48,9 +48,9 @@ public static function getValue(string $key, mixed $default = null, ?int $userId }; } - public static function setValue(string $key, mixed $value, string $type = 'string', ?int $userId = null) + public static function setValue(string $key, mixed $value, string $type = 'string', ?string $userId = null) { - $userId = $userId ?? auth()->id(); + $userId = $userId ?? session()->getId(); $processedValue = match ($type) { 'boolean' => $value ? 'true' : 'false', @@ -64,9 +64,9 @@ public static function setValue(string $key, mixed $value, string $type = 'strin ); } - public static function getBulk(array $keys, ?int $userId = null) + public static function getBulk(array $keys, ?string $userId = null) { - $userId = $userId ?? auth()->id(); + $userId = $userId ?? session()->getId(); return static::where('user_id', $userId) ->whereIn('key', $keys) @@ -77,9 +77,9 @@ public static function getBulk(array $keys, ?int $userId = null) ->toArray(); } - public static function setBulk(array $settings, ?int $userId = null) + public static function setBulk(array $settings, ?string $userId = null) { - $userId = $userId ?? auth()->id(); + $userId = $userId ?? session()->getId(); $results = []; foreach ($settings as $key => $data) { diff --git a/bootstrap/app.php b/bootstrap/app.php index 7b162da..a01b0f0 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -11,7 +11,10 @@ health: '/up', ) ->withMiddleware(function (Middleware $middleware) { - // + $middleware->alias([ + 'api.auth' => \App\Http\Middleware\ApiAuthenticate::class, + 'api.guest' => \App\Http\Middleware\ApiGuest::class, + ]); }) ->withExceptions(function (Exceptions $exceptions) { // diff --git a/config/api.php b/config/api.php new file mode 100644 index 0000000..8b03c00 --- /dev/null +++ b/config/api.php @@ -0,0 +1,16 @@ + env('API_URL', 'http://localhost:8007/api/v1'), + 'timeout' => env('API_TIMEOUT', 30), +]; diff --git a/database/migrations/0001_01_01_000000_create_users_table.php b/database/migrations/0001_01_01_000000_create_users_table.php deleted file mode 100644 index 05fb5d9..0000000 --- a/database/migrations/0001_01_01_000000_create_users_table.php +++ /dev/null @@ -1,49 +0,0 @@ -id(); - $table->string('name'); - $table->string('email')->unique(); - $table->timestamp('email_verified_at')->nullable(); - $table->string('password'); - $table->rememberToken(); - $table->timestamps(); - }); - - Schema::create('password_reset_tokens', function (Blueprint $table) { - $table->string('email')->primary(); - $table->string('token'); - $table->timestamp('created_at')->nullable(); - }); - - Schema::create('sessions', function (Blueprint $table) { - $table->string('id')->primary(); - $table->foreignId('user_id')->nullable()->index(); - $table->string('ip_address', 45)->nullable(); - $table->text('user_agent')->nullable(); - $table->longText('payload'); - $table->integer('last_activity')->index(); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::dropIfExists('users'); - Schema::dropIfExists('password_reset_tokens'); - Schema::dropIfExists('sessions'); - } -}; diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index df95561..2a4fe10 100644 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -12,16 +12,12 @@ class="bg-white dark:bg-gray-800 rounded-lg shadow-md border border-gray-200 dar @csrf
- +
- @if (Route::has('password.request')) - {{ __('Forgot password?') }} - @endif
diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php index 7939bc9..bd31fd7 100644 --- a/resources/views/auth/register.blade.php +++ b/resources/views/auth/register.blade.php @@ -11,19 +11,20 @@ class="bg-white dark:bg-gray-800 rounded-lg shadow-md border border-gray-200 dar
@csrf - +
- -
- - -
- + +

+ {{ __('This will be your username for logging in') }} +

+

+ {{ __('Minimum 12 characters with uppercase, lowercase, digits, and special characters') }} +

diff --git a/resources/views/components/layouts/app/header.blade.php b/resources/views/components/layouts/app/header.blade.php index 8249937..8ffa19f 100644 --- a/resources/views/components/layouts/app/header.blade.php +++ b/resources/views/components/layouts/app/header.blade.php @@ -17,14 +17,19 @@ class="p-2 rounded-md text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:
+ @php + $user = session('user', []); + $userName = $user['login'] ?? $user['name'] ?? 'User'; + $userInitials = collect(explode(' ', $userName))->map(fn($n) => substr($n, 0, 1))->take(2)->join(''); + @endphp