mirror of
https://github.com/myronblair/novacpx
synced 2026-06-30 17:50:41 -05:00
fix: nested transaction crash and favicon 404
- accounts.php: remove outer beginTransaction() — AccountManager already wraps in its own transaction; nested transactions fail in SQLite with 'already an active transaction' - accounts.php: on AccountManager failure, manually delete the inserted user row instead - admin/reseller/user index.php: fix favicon href from /assets/img/favicon.svg to nova-favicon.svg Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LP9Q4kfCAYAjJnsbHBrViZ
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title>NovaCPX Admin</title>
|
<title>NovaCPX Admin</title>
|
||||||
<link rel="icon" type="image/svg+xml" href="/assets/img/favicon.svg">
|
<link rel="icon" type="image/svg+xml" href="/assets/img/nova-favicon.svg">
|
||||||
<link rel="stylesheet" href="/assets/css/nova.css">
|
<link rel="stylesheet" href="/assets/css/nova.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -73,26 +73,25 @@ match ($action) {
|
|||||||
if ($db->fetchOne("SELECT id FROM users WHERE email = ?", [$body['email']])) Response::error("Email already in use by another account");
|
if ($db->fetchOne("SELECT id FROM users WHERE email = ?", [$body['email']])) Response::error("Email already in use by another account");
|
||||||
if ($db->fetchOne("SELECT id FROM users WHERE username = ?", [$body['username']])) Response::error("Username already taken");
|
if ($db->fetchOne("SELECT id FROM users WHERE username = ?", [$body['username']])) Response::error("Username already taken");
|
||||||
|
|
||||||
// Wrap user creation + account provisioning in a single transaction
|
// Insert user first — AccountManager::create() wraps everything else in its own transaction
|
||||||
$db->beginTransaction();
|
$userId = (int)$db->insert(
|
||||||
try {
|
"INSERT INTO users (username, password, email, role, status, reseller_id) VALUES (?,?,?,?,?,?)",
|
||||||
$userId = (int)$db->insert(
|
[
|
||||||
"INSERT INTO users (username, password, email, role, status, reseller_id) VALUES (?,?,?,?,?,?)",
|
$body['username'],
|
||||||
[
|
password_hash($body['password'], PASSWORD_BCRYPT),
|
||||||
$body['username'],
|
$body['email'],
|
||||||
password_hash($body['password'], PASSWORD_BCRYPT),
|
'user',
|
||||||
$body['email'],
|
'active',
|
||||||
'user',
|
$user['role'] === 'reseller' ? $user['uid'] : null,
|
||||||
'active',
|
]
|
||||||
$user['role'] === 'reseller' ? $user['uid'] : null,
|
);
|
||||||
]
|
$body['user_id'] = $userId;
|
||||||
);
|
|
||||||
$body['user_id'] = $userId;
|
|
||||||
|
|
||||||
|
try {
|
||||||
$result = AccountManager::create($body);
|
$result = AccountManager::create($body);
|
||||||
$db->commit();
|
|
||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
$db->rollBack();
|
// Roll back the user insert if account provisioning failed
|
||||||
|
$db->execute("DELETE FROM users WHERE id = ?", [$userId]);
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ $_pname = novacpx_panel_name('NovaCPX');
|
|||||||
<meta name="keywords" content="reseller hosting panel, reseller control panel, manage hosting clients, white label hosting, NovaCPX reseller">
|
<meta name="keywords" content="reseller hosting panel, reseller control panel, manage hosting clients, white label hosting, NovaCPX reseller">
|
||||||
<meta name="robots" content="noindex, nofollow">
|
<meta name="robots" content="noindex, nofollow">
|
||||||
<title><?= $_pname ?> — Reseller</title>
|
<title><?= $_pname ?> — Reseller</title>
|
||||||
<link rel="icon" type="image/svg+xml" href="/assets/img/favicon.svg">
|
<link rel="icon" type="image/svg+xml" href="/assets/img/nova-favicon.svg">
|
||||||
<link rel="stylesheet" href="/assets/css/nova.css<?= $_v('/assets/css/nova.css') ?>">
|
<link rel="stylesheet" href="/assets/css/nova.css<?= $_v('/assets/css/nova.css') ?>">
|
||||||
<?php novacpx_branding_head() ?>
|
<?php novacpx_branding_head() ?>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ $_pname = novacpx_panel_name('NovaCPX');
|
|||||||
<meta name="keywords" content="hosting control panel, manage website, email hosting, domain management, database management, SSL certificate, FTP, web hosting dashboard">
|
<meta name="keywords" content="hosting control panel, manage website, email hosting, domain management, database management, SSL certificate, FTP, web hosting dashboard">
|
||||||
<meta name="robots" content="noindex, nofollow">
|
<meta name="robots" content="noindex, nofollow">
|
||||||
<title><?= $_pname ?> — My Hosting</title>
|
<title><?= $_pname ?> — My Hosting</title>
|
||||||
<link rel="icon" type="image/svg+xml" href="/assets/img/favicon.svg">
|
<link rel="icon" type="image/svg+xml" href="/assets/img/nova-favicon.svg">
|
||||||
<link rel="stylesheet" href="/assets/css/nova.css<?= $_v('/assets/css/nova.css') ?>">
|
<link rel="stylesheet" href="/assets/css/nova.css<?= $_v('/assets/css/nova.css') ?>">
|
||||||
<?php novacpx_branding_head() ?>
|
<?php novacpx_branding_head() ?>
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
Reference in New Issue
Block a user