fix: oprava kritických bezpečnostních chyb a bugů z code review
- SEC-1: nahrazen exec('fsutil') za PHP-native is_link()+realpath() v NasFileManager - eliminace command injection
- SEC-2: přidáno ověření aktuálního hesla při změně hesla (profile.php + DashProfile.jsx)
- BUG-1: attendance punch obalen do transakce s SELECT FOR UPDATE - prevence race condition při dvojkliku
- BUG-2: eliminován N+1 SQL dotaz pro VAT v invoice listu - výpočet přesunut do subquery
- BUG-5/6: delete a update attendance záznamů obaleny do transakcí - prevence nekonzistentního stavu
- BUG-7: opravena duplikace nabídky - přidáno chybějící pole unit v offer items
ESLint: 0 errors | PHPCS: 0 errors | Build: OK
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
12
dist/api/admin/profile.php
vendored
12
dist/api/admin/profile.php
vendored
@@ -34,10 +34,10 @@ try {
|
||||
$pdo = db();
|
||||
$userId = $authData['user_id'];
|
||||
|
||||
// Get existing user
|
||||
// Get existing user (vcetne password_hash pro overeni aktualniho hesla)
|
||||
$stmt = $pdo->prepare('
|
||||
SELECT id, username, email, first_name, last_name, role_id, is_active,
|
||||
last_login, created_at
|
||||
last_login, created_at, password_hash
|
||||
FROM users WHERE id = ?
|
||||
');
|
||||
$stmt->execute([$userId]);
|
||||
@@ -75,6 +75,14 @@ try {
|
||||
|
||||
// Update user
|
||||
if (!empty($input['password'])) {
|
||||
// Overeni aktualniho hesla
|
||||
if (empty($input['current_password'])) {
|
||||
errorResponse('Pro změnu hesla je nutné zadat aktuální heslo');
|
||||
}
|
||||
if (!password_verify($input['current_password'], $existingUser['password_hash'])) {
|
||||
errorResponse('Aktuální heslo není správné');
|
||||
}
|
||||
|
||||
// Validate password length
|
||||
if (strlen($input['password']) < 8) {
|
||||
errorResponse('Heslo musí mít alespoň 8 znaků');
|
||||
|
||||
Reference in New Issue
Block a user