Device Selection Modal

Login Oncesi Cihaz Secimi - Yeni Ozellik

21 Aralik 2025 - Muzibu.com.tr - v2.0

📝 Basit Anlatim (Herkes Icin)

Ne Degisti?

Eskiden: Yeni cihazdan giris yapildiginda eski cihaz otomatik atiliyordu.

Simdi: Yeni cihazdan giris yapildiginda kullaniciya soru soruluyor. "Hangi cihazi cikis yaptirmak istersiniz?" diye liste gosteriliyor.

Yeni Akis Nasil?

1

Kullanici yeni cihazdan giris yapar

2

Cihaz limiti asilirsa modal pencere acilir

3

Kullanici hangi cihazi cikis yaptirmak istedigini secer

4

Secilen cihaz cikis yaptirilir, kullanici siteye girer

Neden Bu Degisiklik?

Kullanici kontrolu artik kullanicida. Eskiden otomatik atiliyordu, simdi kullanici kendi seciyor. Bu daha iyi bir kullanici deneyimi sagliyor.

🔧 Teknik Detaylar (Gelistiriciler Icin)

Yapilan Degisiklikler

1. AuthenticatedSessionController::store()

Login sonrasi device limit kontrolu eklendi. Limit asilirsa login sayfasina flash data ile redirect.

app/Http/Controllers/Auth/AuthenticatedSessionController.php:174-200
if ($deviceService->isDeviceLimitExceeded($user)) {
    session()->flash('device_limit_exceeded', true);
    session()->flash('other_devices', $otherDevices);
    return redirect()->route('login');
}

2. AuthenticatedSessionController::create()

Device limit exceeded durumunda logged-in kullanici icin login sayfasina erisim izni.

app/Http/Controllers/Auth/AuthenticatedSessionController.php:22-31
$deviceLimitExceeded = session('device_limit_exceeded', false);
if (Auth::check() && !$deviceLimitExceeded) {
    return redirect('/');
}

3. DeviceService - Yeni Metodlar

LIFO otomatik silme kaldirildi, yeni metodlar eklendi.

Modules/Muzibu/app/Services/DeviceService.php
isDeviceLimitExceeded(User $user): bool

Limit kontrolu (silmeden)

terminateSessions(array $sessionIds, User $actor): int

Batch terminate (birden fazla)

4. Yeni API Endpoint

Birden fazla cihazi ayni anda cikis yaptirmak icin batch endpoint.

POST /api/auth/terminate-devices
{
    "session_ids": ["abc123...", "def456..."]
}
app/Http/Controllers/Api/Auth/AuthController.php:terminateDevices()

5. Login Blade - Device Selection Modal

Alpine.js ile device selection modal eklendi.

resources/views/themes/muzibu/auth/login.blade.php resources/views/themes/muzibu/auth/layout.blade.php

Login Akisi (Yeni)

1
Kullanici login form gonderir
2
authenticate() - Kimlik dogrulama
3
registerSession() - Yeni session kayit (LIFO yok)
4
isDeviceLimitExceeded() kontrolu
Limit OK → Normal redirect (intended URL)
Limit asildi → Login'e redirect + flash data
5
Modal gosterilir - Cihaz listesi
6
Kullanici cihaz secer → API call
7
Basarili → Intended URL'e yonlendirme

Eski vs Yeni Davranis

Eski Sistem

Login → Otomatik LIFO
Eski cihaz HABER VERILMEDEN atilir
Kullanici kontrolu YOK
Eski cihazda "baska cihazdan giris yapildi" mesaji

Yeni Sistem

Login → Modal acilir
Aktif cihazlar LISTELENIR
Kullanici SECER
Secilen cihaz(lar) cikis yaptirilir
Kullanici siteye girer

📁 Degisiklik Yapilan Dosyalar

app/Http/Controllers/Auth/AuthenticatedSessionController.php MODIFIED
app/Http/Controllers/Api/Auth/AuthController.php NEW METHOD
Modules/Muzibu/app/Services/DeviceService.php NEW METHODS
resources/views/themes/muzibu/auth/login.blade.php MODAL ADDED
resources/views/themes/muzibu/auth/layout.blade.php JS ADDED
routes/api.php NEW ROUTE