@extends('layouts.main_dashboard.app') @php $isArabic = app()->getLocale() === 'ar'; $emailTwoFactorEnabled = $user->two_factor_method === 'email'; $authenticatorEnabled = $user->two_factor_method === 'authenticator' && $user->two_factor_confirmed_at; $twoFactorLabel = match ($user->two_factor_method) { 'email' => $isArabic ? 'رمز عبر البريد الإلكتروني' : 'Email Code', 'authenticator' => $user->two_factor_confirmed_at ? 'Google Authenticator' : ($isArabic ? 'Google Authenticator بانتظار التفعيل' : 'Google Authenticator Pending'), default => $isArabic ? 'غير مفعل' : 'Disabled', }; $securityStats = [ [ 'label' => $isArabic ? 'حالة البريد' : 'Email Status', 'value' => $user->hasVerifiedEmail() ? ($isArabic ? 'موثق' : 'Verified') : ($isArabic ? 'بانتظار التحقق' : 'Pending'), ], [ 'label' => $isArabic ? 'التحقق الثنائي' : 'Two-Factor', 'value' => $twoFactorLabel, ], [ 'label' => $isArabic ? 'الجلسات النشطة' : 'Active Sessions', 'value' => $sessions->count(), ], ]; @endphp @section('title', $isArabic ? 'إعدادات الأمان' : 'Security Settings') @section('page_heading', $isArabic ? 'إعدادات الأمان' : 'Security Settings') @section('skip_page_hero', true) @section('content')

{{ $isArabic ? 'إعدادات الأمان' : 'Security Settings' }}

{{ $isArabic ? 'غيّر كلمة المرور، راجع الجلسات النشطة، واختر طريقة التحقق الثنائي المناسبة. الصفحة مبسطة ومباشرة بدون خطوات إضافية غير ضرورية.' : 'Change your password, review active sessions, and choose the two-factor method that fits you. This page is intentionally direct and simplified.' }}

@foreach($securityStats as $stat)

{{ $stat['label'] }}

{{ $stat['value'] }}

@endforeach

{{ $isArabic ? 'تغيير كلمة المرور' : 'Change Password' }}

{{ $isArabic ? 'يفضل استخدام كلمة مرور قوية مع تسجيل الخروج من الأجهزة الأخرى عند الحاجة.' : 'Use a strong password and sign out of other devices when needed.' }}

@csrf @method('PUT')
@error('current_password')
{{ $message }}
@enderror
@error('new_password')
{{ $message }}
@enderror
{{ $isArabic ? 'يجب أن تحتوي كلمة المرور على 8 أحرف على الأقل، وتشمل حروفاً كبيرة وصغيرة وأرقاماً ورموزاً.' : 'Your password must be at least 8 characters long and include uppercase, lowercase, numbers, and symbols.' }}

{{ $isArabic ? 'التحقق الثنائي' : 'Two-Factor Authentication' }}

{{ $isArabic ? 'اختر طريقة الحماية الإضافية المناسبة لحسابك.' : 'Choose the additional protection method for your account.' }}

@csrf
{{ $isArabic ? 'البريد الإلكتروني' : 'Email' }}

{{ $isArabic ? 'استلام رمز تحقق عند كل تسجيل دخول عبر البريد الإلكتروني الموثق.' : 'Receive a verification code on every sign in through your verified email address.' }}

@csrf
Authenticator App

{{ $isArabic ? 'استخدم Google Authenticator أو أي تطبيق مشابه لإنشاء رموز متغيرة.' : 'Use Google Authenticator or a similar app to generate rotating codes.' }}

{{ $authenticatorEnabled ? ($isArabic ? 'إدارة التطبيق' : 'Manage App') : ($isArabic ? 'تفعيل التطبيق' : 'Enable App') }}
@if ($pendingEmailTwoFactor)

{{ ($pendingEmailTwoFactor['intent'] ?? 'enable') === 'enable' ? ($isArabic ? 'تأكيد تفعيل البريد' : 'Confirm Email Activation') : ($isArabic ? 'تأكيد إيقاف البريد' : 'Confirm Email Disable') }}

{{ $isArabic ? 'أدخل الرمز المكوّن من 6 أرقام الذي تم إرساله إلى بريدك الإلكتروني.' : 'Enter the 6-digit code sent to your email address.' }}

@csrf
@error('email_code')
{{ $message }}
@enderror
@endif @if ($pendingAuthenticatorSecret)

{{ $isArabic ? 'المفتاح السري' : 'Secret Key' }}

{{ $isArabic ? 'امسح رمز QR أو أدخل المفتاح يدوياً في التطبيق.' : 'Scan the QR code or enter the secret key manually in the app.' }}

{!! QrCode::size(150)->generate($otpAuthUrl) !!}
{{ $pendingAuthenticatorSecret }}
@csrf

{{ $isArabic ? 'تأكيد التطبيق' : 'Confirm App' }}

{{ $isArabic ? 'أدخل أول رمز يظهر في التطبيق لتفعيل الحماية.' : 'Enter the first code shown in the app to enable protection.' }}

@error('authenticator_code')
{{ $message }}
@enderror
@endif @if ($authenticatorEnabled)

{{ $isArabic ? 'إيقاف التطبيق' : 'Disable Authenticator' }}

{{ $isArabic ? 'أدخل الرمز الحالي من التطبيق لإيقاف التحقق الثنائي.' : 'Enter the current authenticator code to disable two-factor authentication.' }}

@csrf
@error('disable_authenticator_code')
{{ $message }}
@enderror
@endif

{{ $isArabic ? 'الجلسات النشطة' : 'Active Sessions' }}

{{ $isArabic ? 'راجع الأجهزة المرتبطة بالحساب حالياً، وسجّل الخروج من أي جهاز غير معروف.' : 'Review devices currently linked to your account and sign out from any unfamiliar one.' }}

@foreach ($sessions as $session)
{{ $session->agent->platform }} - {{ $session->agent->browser }}
@if ($session->is_current_device) {{ $isArabic ? 'هذا الجهاز' : 'This Device' }} @endif
{{ $session->ip_address }} · {{ $isArabic ? 'آخر نشاط' : 'Last active' }} {{ $session->last_active }}
@if (!$session->is_current_device)
@csrf @method('DELETE')
@endif
@endforeach
@endsection