organization = $organization; if ($password?->exists) { $this->password = $password; $this->name = $password->name; $this->username = $password->username ?? ''; // password_ciphertext intentionally left blank: never pre-fill a decrypted secret into the form. $this->url = $password->url ?? ''; $this->notes = $password->notes ?? ''; $this->is_favorite = $password->is_favorite; $password->logAction('viewed'); } } public function save(): void { $validated = $this->validate([ 'name' => 'required|string|max:255', 'username' => 'nullable|string|max:255', 'password_ciphertext' => $this->password?->exists ? 'nullable|string' : 'required|string', 'url' => 'nullable|url|max:255', 'notes' => 'nullable|string', 'is_favorite' => 'boolean', ]); if (blank($validated['password_ciphertext'])) { unset($validated['password_ciphertext']); } else { $validated['password_updated_at'] = now(); } if ($this->password?->exists) { $isRotation = isset($validated['password_ciphertext']); $this->password->update($validated); $this->password->logAction($isRotation ? 'rotated' : 'updated'); session()->flash('status', "Mot de passe « {$this->password->name} » mis à jour."); } else { $validated['created_by'] = auth()->id(); $validated['password_updated_at'] = now(); $created = $this->organization->passwords()->create($validated); $created->logAction('created'); session()->flash('status', "Mot de passe « {$this->name} » créé."); } $this->redirectRoute('organizations.passwords.index', $this->organization, navigate: true); } }; ?>

{{ $organization->name }}

{{ $password?->exists ? 'Modifier le mot de passe' : 'Nouveau mot de passe' }}

@error('name')

{{ $message }}

@enderror
@error('password_ciphertext')

{{ $message }}

@enderror
@error('url')

{{ $message }}

@enderror
Annuler
@if ($password?->exists)

Journal d'audit

@forelse ($password->auditLogs()->with('user')->latest()->limit(20)->get() as $log) @empty @endforelse
Action Utilisateur IP Quand
{{ $log->action }} {{ $log->user?->name ?? 'système' }} {{ $log->ip_address ?? '—' }} {{ $log->created_at->diffForHumans() }}
Aucune activité pour le moment.
@endif