feat: add admin password change via /settings page
Backend: - DB: add UpdateAdminPasswordHash(id, hash) in queries_users.go - Auth: add ChangePassword(username, old, new) method that verifies old password, validates length >= 8, and stores bcrypt hash - Handlers: add handleChangePassword on PUT /api/auth/password (auth required) - Router: register route inside protected group Frontend: - api.ts: add changePassword(oldPassword, newPassword) - Settings.tsx: new page with form (current + new + confirm), client-side validation, success/error feedback - App.tsx: add /settings route - Layout.tsx: add 'Ajustes' nav item
This commit is contained in:
@@ -9,6 +9,7 @@ import Users from "./pages/Users";
|
||||
import Samba from "./pages/Samba";
|
||||
import Nfs from "./pages/Nfs";
|
||||
import Log from "./pages/Log";
|
||||
import Settings from "./pages/Settings";
|
||||
|
||||
type AuthState = { loading: boolean; authenticated: boolean; username: string };
|
||||
|
||||
@@ -54,6 +55,7 @@ export default function App() {
|
||||
<Route path="/samba" element={<Samba />} />
|
||||
<Route path="/nfs" element={<Nfs />} />
|
||||
<Route path="/log" element={<Log />} />
|
||||
<Route path="/settings" element={<Settings />} />
|
||||
<Route path="*" element={<Navigate to="/" replace />} />
|
||||
</Route>
|
||||
</Routes>
|
||||
|
||||
Reference in New Issue
Block a user