You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
197 lines
9.1 KiB
197 lines
9.1 KiB
@extends('layouts.app') |
|
|
|
@section('title', 'My Profile — ' . config('app.name')) |
|
|
|
@section('content') |
|
<div class="max-w-4xl mx-auto px-4 py-8"> |
|
@include('partials.nav') |
|
|
|
<div class="mt-6 mb-6"> |
|
<h1 class="text-2xl font-bold text-white">My Profile</h1> |
|
<p class="text-slate-400 text-sm mt-1">LDAP account details and self-service actions</p> |
|
</div> |
|
|
|
@include('partials.flash') |
|
|
|
<div class="bg-slate-900 border border-slate-800 rounded-2xl p-6 mb-6"> |
|
<h2 class="text-lg font-semibold text-white mb-4">Account Information</h2> |
|
<dl class="grid grid-cols-1 sm:grid-cols-2 gap-4 text-sm"> |
|
<div> |
|
<dt class="text-slate-400">Username</dt> |
|
<dd class="text-white font-medium mt-1">{{ $profile['username'] }}</dd> |
|
</div> |
|
<div> |
|
<dt class="text-slate-400">Domain</dt> |
|
<dd class="text-white font-medium mt-1">{{ $profile['domain'] }}</dd> |
|
</div> |
|
<div> |
|
<dt class="text-slate-400">Role</dt> |
|
<dd class="mt-1"> |
|
@if ($profile['is_admin']) |
|
<span class="inline-flex rounded-full bg-cyan-950 border border-cyan-800 px-3 py-0.5 text-xs font-medium text-cyan-300"> |
|
Administrator |
|
</span> |
|
@else |
|
<span class="inline-flex rounded-full bg-slate-800 border border-slate-700 px-3 py-0.5 text-xs font-medium text-slate-300"> |
|
User |
|
</span> |
|
@endif |
|
</dd> |
|
</div> |
|
<div> |
|
<dt class="text-slate-400">Status</dt> |
|
<dd class="mt-1"> |
|
@if ($profile['enabled']) |
|
<span class="inline-flex rounded-full bg-emerald-950 border border-emerald-800 px-3 py-0.5 text-xs font-medium text-emerald-300"> |
|
Enabled |
|
</span> |
|
@else |
|
<span class="inline-flex rounded-full bg-red-950 border border-red-800 px-3 py-0.5 text-xs font-medium text-red-300"> |
|
Disabled |
|
</span> |
|
@endif |
|
</dd> |
|
</div> |
|
<div> |
|
<dt class="text-slate-400">Last Logon</dt> |
|
<dd class="text-white font-medium mt-1"> |
|
{{ $profile['last_logon'] ? $profile['last_logon'] . ' UTC' : '—' }} |
|
</dd> |
|
</div> |
|
</dl> |
|
|
|
@if (count($profile['groups']) > 0) |
|
<div class="mt-5"> |
|
<dt class="text-slate-400 text-sm mb-2">Groups</dt> |
|
<dd class="flex flex-wrap gap-2"> |
|
@foreach ($profile['groups'] as $group) |
|
<span class="rounded-lg bg-slate-800 border border-slate-700 px-3 py-1 text-xs text-slate-300"> |
|
{{ $group }} |
|
</span> |
|
@endforeach |
|
</dd> |
|
</div> |
|
@endif |
|
</div> |
|
|
|
<form method="POST" action="{{ route('profile.update') }}" |
|
class="bg-slate-900 border border-slate-800 rounded-2xl p-6 space-y-5 mb-6"> |
|
@csrf |
|
@method('PUT') |
|
|
|
<h2 class="text-lg font-semibold text-white">Edit Profile</h2> |
|
<p class="text-slate-400 text-sm -mt-2">Display name dan email LDAP disimpan ke Active Directory. Other email dan phone disimpan di aplikasi.</p> |
|
|
|
<div> |
|
<label for="display_name" class="block text-sm text-slate-300 mb-1">Display Name</label> |
|
<input type="text" name="display_name" id="display_name" required maxlength="255" |
|
value="{{ old('display_name', $profile['display_name']) }}" |
|
class="w-full rounded-lg bg-slate-800 border border-slate-700 px-4 py-2 text-sm text-white"> |
|
@error('display_name')<p class="text-red-400 text-xs mt-1">{{ $message }}</p>@enderror |
|
</div> |
|
|
|
<div> |
|
<label for="email" class="block text-sm text-slate-300 mb-1">Email (LDAP)</label> |
|
<input type="email" name="email" id="email" maxlength="255" |
|
value="{{ old('email', $profile['email']) }}" |
|
class="w-full rounded-lg bg-slate-800 border border-slate-700 px-4 py-2 text-sm text-white"> |
|
@error('email')<p class="text-red-400 text-xs mt-1">{{ $message }}</p>@enderror |
|
</div> |
|
|
|
<div> |
|
<label for="other_email" class="block text-sm text-slate-300 mb-1">Other Email</label> |
|
<input type="email" name="other_email" id="other_email" maxlength="255" |
|
value="{{ old('other_email', $meta['other_email'] ?? '') }}" |
|
class="w-full rounded-lg bg-slate-800 border border-slate-700 px-4 py-2 text-sm text-white" |
|
placeholder="Email konfirmasi alternatif"> |
|
@error('other_email')<p class="text-red-400 text-xs mt-1">{{ $message }}</p>@enderror |
|
</div> |
|
|
|
<div> |
|
<label for="phone" class="block text-sm text-slate-300 mb-1">Phone Number</label> |
|
<input type="text" name="phone" id="phone" maxlength="32" |
|
value="{{ old('phone', $meta['phone'] ?? '') }}" |
|
class="w-full rounded-lg bg-slate-800 border border-slate-700 px-4 py-2 text-sm text-white"> |
|
@error('phone')<p class="text-red-400 text-xs mt-1">{{ $message }}</p>@enderror |
|
</div> |
|
|
|
<button type="submit" class="rounded-lg bg-cyan-600 hover:bg-cyan-500 px-5 py-2 text-sm font-medium text-white"> |
|
Save Changes |
|
</button> |
|
</form> |
|
|
|
@php |
|
$ldapEmail = $profile['email'] !== '' ? $profile['email'] : null; |
|
$otherEmail = ($meta['other_email'] ?? '') !== '' ? $meta['other_email'] : null; |
|
$testRecipients = array_values(array_unique(array_filter([$ldapEmail, $otherEmail]))); |
|
$resetEmail = $ldapEmail ?? $otherEmail ?? ''; |
|
@endphp |
|
|
|
<div class="bg-slate-900 border border-slate-800 rounded-2xl p-6 mb-6"> |
|
<h2 class="text-lg font-semibold text-white mb-2">Test Email</h2> |
|
<p class="text-slate-400 text-sm mb-4"> |
|
Kirim email uji dari SMTP ke alamat yang terdaftar. |
|
@if (count($testRecipients) === 0) |
|
<span class="text-amber-400">Isi email LDAP atau other email, simpan profil, lalu uji kirim.</span> |
|
@else |
|
Akan dikirim ke: |
|
@foreach ($testRecipients as $recipient) |
|
<span class="text-cyan-300 font-mono text-xs">{{ $recipient }}</span>@if (! $loop->last), @endif |
|
@endforeach |
|
@endif |
|
</p> |
|
|
|
<form method="POST" action="{{ route('profile.test-email') }}"> |
|
@csrf |
|
<button type="submit" |
|
@disabled(count($testRecipients) === 0) |
|
class="rounded-lg bg-violet-700 hover:bg-violet-600 px-5 py-2 text-sm font-medium text-white disabled:opacity-40 disabled:cursor-not-allowed"> |
|
Send Test Email |
|
</button> |
|
</form> |
|
</div> |
|
|
|
<div class="bg-slate-900 border border-slate-800 rounded-2xl p-6 mb-6"> |
|
<h2 class="text-lg font-semibold text-white mb-2">Password</h2> |
|
<p class="text-slate-400 text-sm mb-4"> |
|
Send a password reset link to your registered email address. |
|
@if ($resetEmail === '') |
|
<span class="text-amber-400">Add an email above first.</span> |
|
@endif |
|
</p> |
|
|
|
<form method="POST" action="{{ route('profile.password-reset') }}"> |
|
@csrf |
|
<button type="submit" |
|
@disabled($resetEmail === '') |
|
class="rounded-lg border border-slate-700 px-5 py-2 text-sm text-slate-300 hover:bg-slate-800 disabled:opacity-40 disabled:cursor-not-allowed"> |
|
Send Password Reset Email |
|
</button> |
|
</form> |
|
</div> |
|
|
|
@include('partials.activity-log', ['activityLogs' => $activityLogs, 'activityError' => $activityError ?? null]) |
|
|
|
<aside class="mt-6 bg-slate-900 border border-slate-800 rounded-2xl p-5 notes-panel"> |
|
<h2 class="text-lg font-semibold text-white mb-4">Catatan</h2> |
|
<dl class="space-y-3 text-sm text-slate-400"> |
|
<div> |
|
<dt class="font-medium text-cyan-400 mb-1">Self-service</dt> |
|
<dd>Anda dapat mengubah display name, email LDAP, other email, dan phone sendiri.</dd> |
|
</div> |
|
<div> |
|
<dt class="font-medium text-violet-400 mb-1">Test email</dt> |
|
<dd>Simpan profil dulu agar alamat terbaru dipakai. Test dikirim ke email LDAP dan other email (jika keduanya diisi).</dd> |
|
</div> |
|
<div> |
|
<dt class="font-medium text-violet-400 mb-1">Reset password</dt> |
|
<dd>Link reset dikirim ke email LDAP atau other email. Berlaku 60 menit.</dd> |
|
</div> |
|
<div> |
|
<dt class="font-medium text-emerald-400 mb-1">Activity log</dt> |
|
<dd>Riwayat aksi terkait akun Anda dari audit log.</dd> |
|
</div> |
|
</dl> |
|
</aside> |
|
</div> |
|
@endsection
|
|
|