mirror of
https://github.com/getnamingo/registry.git
synced 2025-05-13 08:07:00 +02:00
Quite a few fixes in the CP, logs now match the rest
This commit is contained in:
parent
d312db4f14
commit
09a3ae3cc4
5 changed files with 71 additions and 65 deletions
|
@ -32,8 +32,8 @@ class AuthController extends Controller
|
||||||
* @throws \DI\NotFoundException
|
* @throws \DI\NotFoundException
|
||||||
*/
|
*/
|
||||||
public function createLogin(Request $request, Response $response){
|
public function createLogin(Request $request, Response $response){
|
||||||
$isWebAuthnEnabled = envi('WEB_AUTHN_ENABLED') === 'true';
|
$isWebAuthnEnabled = (envi('WEB_AUTHN_ENABLED') === 'true') ? true : false;
|
||||||
return view($response, 'auth/login.twig', ['isWebaEnabled' => $isWebaEnabled]);
|
return view($response, 'auth/login.twig', ['isWebaEnabled' => $isWebAuthnEnabled]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2046,14 +2046,16 @@ class DomainsController extends Controller
|
||||||
[ $domain_id ]
|
[ $domain_id ]
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($results as $row) {
|
if (is_array($results) && !empty($results)) {
|
||||||
$status = $row['status'];
|
foreach ($results as $row) {
|
||||||
if (preg_match('/.*(UpdateProhibited|DeleteProhibited)$/', $status) || preg_match('/^pending/', $status)) {
|
$status = $row['status'];
|
||||||
$this->container->get('flash')->addMessage('error', 'It has a status that does not allow deletion, first change the status');
|
if (preg_match('/.*(UpdateProhibited|DeleteProhibited)$/', $status) || preg_match('/^pending/', $status)) {
|
||||||
return $response->withHeader('Location', '/domains')->withStatus(302);
|
$this->container->get('flash')->addMessage('error', 'It has a status that does not allow deletion, first change the status');
|
||||||
|
return $response->withHeader('Location', '/domains')->withStatus(302);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$grace_period = 30;
|
$grace_period = 30;
|
||||||
|
|
||||||
$db->delete(
|
$db->delete(
|
||||||
|
@ -2111,31 +2113,33 @@ class DomainsController extends Controller
|
||||||
'SELECT id FROM host WHERE domain_id = ?',
|
'SELECT id FROM host WHERE domain_id = ?',
|
||||||
[$domain_id]
|
[$domain_id]
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($hostIds as $host) {
|
|
||||||
$host_id = $host['id'];
|
|
||||||
|
|
||||||
// Delete operations
|
if (is_array($hostIds) && !empty($hostIds)) {
|
||||||
$db->delete(
|
foreach ($hostIds as $host) {
|
||||||
'host_addr',
|
$host_id = $host['id'];
|
||||||
[
|
|
||||||
'host_id' => $host_id
|
// Delete operations
|
||||||
]
|
$db->delete(
|
||||||
);
|
'host_addr',
|
||||||
$db->delete(
|
[
|
||||||
'host_status',
|
'host_id' => $host_id
|
||||||
[
|
]
|
||||||
'host_id' => $host_id
|
);
|
||||||
]
|
$db->delete(
|
||||||
);
|
'host_status',
|
||||||
$db->delete(
|
[
|
||||||
'domain_host_map',
|
'host_id' => $host_id
|
||||||
[
|
]
|
||||||
'host_id' => $host_id
|
);
|
||||||
]
|
$db->delete(
|
||||||
);
|
'domain_host_map',
|
||||||
|
[
|
||||||
|
'host_id' => $host_id
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete domain related records
|
// Delete domain related records
|
||||||
$db->delete(
|
$db->delete(
|
||||||
'domain_contact_map',
|
'domain_contact_map',
|
||||||
|
|
|
@ -185,10 +185,10 @@ class HomeController extends Controller
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function mode(Request $request, Response $response)
|
public function mode(Request $request, Response $response)
|
||||||
{
|
{
|
||||||
if ($_SESSION['_screen_mode'] == 'dark') {
|
if (isset($_SESSION['_screen_mode']) && $_SESSION['_screen_mode'] == 'dark') {
|
||||||
$_SESSION['_screen_mode'] = 'light';
|
$_SESSION['_screen_mode'] = 'light';
|
||||||
} else {
|
} else {
|
||||||
$_SESSION['_screen_mode'] = 'dark';
|
$_SESSION['_screen_mode'] = 'dark';
|
||||||
|
|
|
@ -692,14 +692,16 @@ class SystemController extends Controller
|
||||||
return $response->withHeader('Location', '/registry/tld/'.$tld_extension)->withStatus(302);
|
return $response->withHeader('Location', '/registry/tld/'.$tld_extension)->withStatus(302);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($data['dnssec_enable'] === 'on' && $data['bind9_enable'] === 'on') {
|
if (isset($data['dnssec_enable'], $data['bind9_enable'])) {
|
||||||
$dnssec_both = 1;
|
if ($data['dnssec_enable'] === 'on' && $data['bind9_enable'] === 'on') {
|
||||||
} elseif ($data['dnssec_enable'] === 'on' && $data['bind9_enable'] !== 'on') {
|
$dnssec_both = 1;
|
||||||
$this->container->get('flash')->addMessage('error', 'DNSSEC can be only enabled for BIND9');
|
} elseif ($data['dnssec_enable'] === 'on' && $data['bind9_enable'] !== 'on') {
|
||||||
return $response->withHeader('Location', '/registry/tld/'.$tld_extension)->withStatus(302);
|
$this->container->get('flash')->addMessage('error', 'DNSSEC can be only enabled for BIND9');
|
||||||
} elseif ($data['dnssec_enable'] !== 'on' && $data['bind9_enable'] === 'on') {
|
return $response->withHeader('Location', '/registry/tld/'.$tld_extension)->withStatus(302);
|
||||||
$this->container->get('flash')->addMessage('error', 'DNSSEC can be only enabled for BIND9');
|
} elseif ($data['dnssec_enable'] !== 'on' && $data['bind9_enable'] === 'on') {
|
||||||
return $response->withHeader('Location', '/registry/tld/'.$tld_extension)->withStatus(302);
|
$this->container->get('flash')->addMessage('error', 'DNSSEC can be only enabled for BIND9');
|
||||||
|
return $response->withHeader('Location', '/registry/tld/'.$tld_extension)->withStatus(302);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -3,14 +3,12 @@
|
||||||
namespace App\Lib;
|
namespace App\Lib;
|
||||||
|
|
||||||
use Monolog\ErrorHandler;
|
use Monolog\ErrorHandler;
|
||||||
use Monolog\Handler\StreamHandler;
|
use Monolog\Handler\RotatingFileHandler;
|
||||||
|
|
||||||
use Whoops\Handler\PrettyPageHandler;
|
use Whoops\Handler\PrettyPageHandler;
|
||||||
use Whoops\Run;
|
use Whoops\Run;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logger
|
* Logger
|
||||||
*
|
|
||||||
* @author Hezekiah O. <support@hezecom.com>
|
|
||||||
*/
|
*/
|
||||||
class Logger extends \Monolog\Logger
|
class Logger extends \Monolog\Logger
|
||||||
{
|
{
|
||||||
|
@ -26,14 +24,20 @@ class Logger extends \Monolog\Logger
|
||||||
{
|
{
|
||||||
parent::__construct($key);
|
parent::__construct($key);
|
||||||
|
|
||||||
|
// Set log path and maximum number of files to retain
|
||||||
|
$LOG_PATH = '/var/log/namingo';
|
||||||
|
$maxFiles = 30; // Number of days to keep logs
|
||||||
|
|
||||||
if (empty($config)) {
|
if (empty($config)) {
|
||||||
$LOG_PATH = '/var/log/namingo';
|
|
||||||
$config = [
|
$config = [
|
||||||
'logFile' => "{$LOG_PATH}/{$key}.log",
|
'logFile' => "{$LOG_PATH}/cp.log", // Base log name
|
||||||
'logLevel' => \Monolog\Logger::DEBUG
|
'logLevel' => \Monolog\Logger::DEBUG,
|
||||||
|
'maxFiles' => $maxFiles,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
$this->pushHandler(new StreamHandler($config['logFile'], $config['logLevel']));
|
|
||||||
|
// Use RotatingFileHandler for automatic rotation
|
||||||
|
$this->pushHandler(new RotatingFileHandler($config['logFile'], $config['maxFiles'], $config['logLevel']));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,31 +55,27 @@ class Logger extends \Monolog\Logger
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Output error bate on environment
|
* Output error based on environment
|
||||||
*/
|
*/
|
||||||
public static function systemLogs($enable = true)
|
public static function systemLogs($enable = true)
|
||||||
{
|
{
|
||||||
|
if ($enable) {
|
||||||
$LOG_PATH = '/var/log/namingo';
|
// Output pretty HTML error
|
||||||
$appEnv = envi('APP_ENV') ?? 'local';
|
|
||||||
|
|
||||||
if($enable) {
|
|
||||||
// output pretty html error
|
|
||||||
self::htmlError();
|
self::htmlError();
|
||||||
}else {
|
} else {
|
||||||
// Error Log to file
|
// Register system errors to rotating log file
|
||||||
self::$loggers['error'] = new Logger('errors');
|
$logger = new Logger('errors'); // Key 'errors' remains for compatibility
|
||||||
self::$loggers['error']->pushHandler(new StreamHandler("{$LOG_PATH}/cp.log"));
|
ErrorHandler::register($logger);
|
||||||
ErrorHandler::register(self::$loggers['error']);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display pretty html formatted errors during development
|
* Display pretty HTML formatted errors during development
|
||||||
*/
|
*/
|
||||||
public static function htmlError(){
|
public static function htmlError()
|
||||||
$run = new Run;
|
{
|
||||||
$run->pushHandler(new PrettyPageHandler);
|
$run = new Run();
|
||||||
|
$run->pushHandler(new PrettyPageHandler());
|
||||||
$run->register();
|
$run->register();
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue