feat: initialize Infra Manager with React, Tailwind CSS, and Inertia.js
- Added main application entry point (app.jsx) and bootstrap file for React setup. - Created Wiki index page (Index.jsx) for documentation and file management. - Implemented utility functions for formatting and status handling in utils.js. - Set up Blade template (app.blade.php) for Inertia.js integration. - Defined API routes for metrics and terminal access in api.php. - Established console commands for scheduled tasks in console.php. - Created web routes for various application features including authentication, hypervisors, containers, cloud accounts, security, backups, and wiki management in web.php. - Developed setup scripts for Windows (setup.ps1) and Linux (setup.sh) environments. - Configured Tailwind CSS for styling with custom themes and animations in tailwind.config.js. - Set up Vite for asset bundling and development server in vite.config.js.
This commit is contained in:
60
app/Http/Controllers/Identity/PasswordController.php
Normal file
60
app/Http/Controllers/Identity/PasswordController.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Identity;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\PasswordEntry;
|
||||
use Illuminate\Http\Request;
|
||||
use Inertia\Inertia;
|
||||
|
||||
class PasswordController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return Inertia::render('Identity/Index', [
|
||||
'passwords' => auth()->user()->passwordEntries()->orderBy('title')->get(),
|
||||
'certificates' => [],
|
||||
'ssh_keys' => [],
|
||||
'stats' => [
|
||||
'passwords' => auth()->user()->passwordEntries()->count(),
|
||||
'certs' => 0,
|
||||
'expiring' => 0,
|
||||
'ssh_keys' => 0,
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'title' => 'required|string',
|
||||
'username' => 'nullable|string',
|
||||
'password' => 'required|string',
|
||||
'url' => 'nullable|url',
|
||||
'notes' => 'nullable|string',
|
||||
'category' => 'nullable|string',
|
||||
]);
|
||||
auth()->user()->passwordEntries()->create($validated);
|
||||
return back()->with('success', 'Password entry created.');
|
||||
}
|
||||
|
||||
public function reveal(PasswordEntry $password)
|
||||
{
|
||||
$this->authorize('view', $password);
|
||||
return response()->json(['password' => $password->getDecryptedPassword()]);
|
||||
}
|
||||
|
||||
public function update(Request $request, PasswordEntry $password)
|
||||
{
|
||||
$this->authorize('update', $password);
|
||||
$password->update($request->except('_token'));
|
||||
return back()->with('success', 'Entry updated.');
|
||||
}
|
||||
|
||||
public function destroy(PasswordEntry $password)
|
||||
{
|
||||
$this->authorize('delete', $password);
|
||||
$password->delete();
|
||||
return back()->with('success', 'Entry deleted.');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user