chore: remove login method setting
This commit is contained in:
@@ -10,9 +10,6 @@ return static function (): void {
|
||||
if (!$settings->defaultEnable()) {
|
||||
Http::errorPage('Plugin nie jest włączony dla tego serwera.', 403);
|
||||
}
|
||||
if ($settings->method() !== 'login_url') {
|
||||
Http::errorPage('Metoda logowania nie jest obsługiwana.', 500);
|
||||
}
|
||||
$ctx = DirectAdminContext::fromServer($_SERVER, $settings);
|
||||
|
||||
$auditBase = [
|
||||
|
||||
@@ -57,7 +57,6 @@ final class Settings
|
||||
{
|
||||
return [
|
||||
'DEFAULT_ENABLE' => 'true',
|
||||
'MAIL_LOGIN_METHOD' => 'login_url',
|
||||
'MAIL_LOGIN_TARGET_NAME' => 'mx1',
|
||||
'MAIL_LOGIN_TARGET_BASE_URL' => 'https://mx1.mojserwer.pl:2222',
|
||||
'MAIL_LOGIN_REDIRECT_URL' => '/',
|
||||
@@ -110,11 +109,6 @@ final class Settings
|
||||
return in_array(strtolower($this->getString('DEFAULT_ENABLE', 'true')), ['1', 'true', 'yes', 'on'], true);
|
||||
}
|
||||
|
||||
public function method(): string
|
||||
{
|
||||
return $this->getString('MAIL_LOGIN_METHOD', 'login_url');
|
||||
}
|
||||
|
||||
public function redirectUrl(): string
|
||||
{
|
||||
return $this->getString('MAIL_LOGIN_REDIRECT_URL', '/');
|
||||
@@ -258,9 +252,6 @@ final class Settings
|
||||
if (!in_array(strtolower($this->getString('DEFAULT_ENABLE', 'true')), ['0', '1', 'true', 'false', 'yes', 'no', 'on', 'off'], true)) {
|
||||
throw new InvalidArgumentException('DEFAULT_ENABLE must be a boolean value');
|
||||
}
|
||||
if ($this->method() !== 'login_url') {
|
||||
throw new InvalidArgumentException('MAIL_LOGIN_METHOD must be login_url');
|
||||
}
|
||||
if (!in_array($this->clientIpMode(), ['direct', 'trusted_proxy'], true)) {
|
||||
throw new InvalidArgumentException('MAIL_LOGIN_CLIENT_IP_MODE must be direct or trusted_proxy');
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<rect x="2" y="2" width="20" height="20" rx="5" fill="url(#mxLoginGradient)"/>
|
||||
<path d="M5 8.25a2 2 0 0 1 2-2h9.25a2 2 0 0 1 2 2v7.5a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2z" fill="#ffffff"/>
|
||||
<path d="M6.4 8.85 11.65 12.35 16.9 8.85" fill="none" stroke="#2f95c8" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M7.25 15.55h7.4" fill="none" stroke="#2f95c8" stroke-width="1.35" stroke-linecap="round" opacity=".55"/>
|
||||
<path d="M14.75 12h4.8m-1.7-1.7 1.7 1.7-1.7 1.7" fill="none" stroke="#ff8a00" stroke-width="2.1" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M5 8.25a2 2 0 0 1 2-2h9.25a2 2 0 0 1 2 2v7.5a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2z" fill="#ff8a00" stroke="#2f95c8" stroke-width=".35"/>
|
||||
<path d="M6.4 8.85 11.65 12.35 16.9 8.85" fill="none" stroke="#ffffff" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M7.25 15.55h7.4" fill="none" stroke="#ffffff" stroke-width="1.35" stroke-linecap="round" opacity=".75"/>
|
||||
<path d="M14.75 12h4.8m-1.7-1.7 1.7 1.7-1.7 1.7" fill="none" stroke="#ffffff" stroke-width="2.1" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 1016 B After Width: | Height: | Size: 1.0 KiB |
@@ -5,9 +5,6 @@
|
||||
# Czy plugin jest domyślnie dostępny dla wszystkich użytkowników.
|
||||
DEFAULT_ENABLE=true
|
||||
|
||||
# Metoda produkcyjna. Wersja 1 używa jednorazowego DirectAdmin login URL generowanego na MX.
|
||||
MAIL_LOGIN_METHOD=login_url
|
||||
|
||||
# Login URL jest tworzony wyłącznie przez direct SSH command:
|
||||
# serwer źródłowy łączy się po SSH do MX i uruchamia bezpośrednio /usr/bin/da login-url.
|
||||
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ name=MX-Autologin
|
||||
id=mxautologin
|
||||
type=user
|
||||
author=HITME.PL
|
||||
version=1.1.3
|
||||
version=1.1.4
|
||||
active=no
|
||||
installed=no
|
||||
user_run_as=root
|
||||
|
||||
@@ -8,7 +8,7 @@ test('plugin metadata and packaging docs match project rules', function (): void
|
||||
assert_contains('name=MX-Autologin', $conf);
|
||||
assert_contains('id=mxautologin', $conf);
|
||||
assert_contains('type=user', $conf);
|
||||
assert_contains('version=1.1.3', $conf);
|
||||
assert_contains('version=1.1.4', $conf);
|
||||
assert_contains('user_run_as=root', $conf);
|
||||
assert_contains('/Users/marek/GPT/ChatGPT/da_plugins/mail-login/src', $packing);
|
||||
assert_contains('/Users/marek/GPT/ChatGPT/da_plugins/mail-login/archives/X.Y.Z/mxautologin.tar.gz', $packing);
|
||||
@@ -86,6 +86,7 @@ test('plugin icon follows directadmin login screen palette', function (): void {
|
||||
assert_contains('#2ec4b6', $icon);
|
||||
assert_contains('#2f95c8', $icon);
|
||||
assert_contains('#ff8a00', $icon);
|
||||
assert_contains('fill="#ff8a00"', $icon);
|
||||
assert_contains('#ffffff', $icon);
|
||||
assert_not_contains('#14532d', $icon);
|
||||
});
|
||||
|
||||
@@ -11,7 +11,6 @@ test('settings expose secure defaults from plugin-settings.conf', function (): v
|
||||
assert_true($settings->ipMask());
|
||||
assert_same('MASKED', $settings->auditClientIp('198.51.100.10'));
|
||||
assert_true($settings->defaultEnable());
|
||||
assert_same('login_url', $settings->method());
|
||||
assert_same('root', $settings->sshUser());
|
||||
assert_same('https://mx1.mojserwer.pl:2222', $settings->targetBaseUrl());
|
||||
});
|
||||
@@ -77,14 +76,15 @@ test('settings do not expose mx helper mode', function (): void {
|
||||
assert_not_contains('MX_LOGIN_MODE', $config);
|
||||
});
|
||||
|
||||
test('settings reject disabled plugin and unsupported methods through access guard', function (): void {
|
||||
try {
|
||||
Settings::fromArray(['MAIL_LOGIN_METHOD' => 'password']);
|
||||
throw new RuntimeException('Expected unsupported method to fail');
|
||||
} catch (InvalidArgumentException $e) {
|
||||
assert_contains('MAIL_LOGIN_METHOD', $e->getMessage());
|
||||
}
|
||||
test('settings do not expose deprecated mail login method switch', function (): void {
|
||||
$defaults = Settings::defaults();
|
||||
$config = file_get_contents(PLUGIN_ROOT . '/plugin-settings.conf') ?: '';
|
||||
|
||||
assert_false(array_key_exists('MAIL_LOGIN_METHOD', $defaults));
|
||||
assert_not_contains('MAIL_LOGIN_METHOD', $config);
|
||||
});
|
||||
|
||||
test('settings expose disabled plugin flag through access guard', function (): void {
|
||||
$settings = Settings::fromArray(['DEFAULT_ENABLE' => 'false']);
|
||||
assert_false($settings->defaultEnable());
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user