From 726d69105494cde2a61f8372b9ac847dd6ef59fd Mon Sep 17 00:00:00 2001 From: Paul Spenke Date: Mon, 10 Jul 2023 21:34:23 +0800 Subject: [PATCH] move creds to env --- .env.dist | 2 ++ config.dist.php | 2 -- plugi-core/src/Modules/Auth/Auth.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.env.dist b/.env.dist index 5d5efb7..dbc3273 100644 --- a/.env.dist +++ b/.env.dist @@ -8,3 +8,5 @@ database_password = plugi database_charset = utf8 database_collation = utf8_unicode_ci database_prefix = +USERNAME = admin +PASSWORD = admin diff --git a/config.dist.php b/config.dist.php index 57785f1..a6a486f 100644 --- a/config.dist.php +++ b/config.dist.php @@ -41,8 +41,6 @@ return [ 'use_login' => true, 'class' => Plugi\Modules\Auth\Auth::class, 'url' => '/admin/auth', - 'username' => 'admin', - 'password' => 'admin' ], /* diff --git a/plugi-core/src/Modules/Auth/Auth.php b/plugi-core/src/Modules/Auth/Auth.php index e6ab21d..4fccb01 100644 --- a/plugi-core/src/Modules/Auth/Auth.php +++ b/plugi-core/src/Modules/Auth/Auth.php @@ -15,7 +15,7 @@ class Auth implements AuthContract { if (phpb_in_module('auth')) { if ($action === 'login' && isset($_POST['username']) && isset($_POST['password'])) { - if ($_POST['username'] === phpb_config('auth.username') && $_POST['password'] === phpb_config('auth.password')) { + if ($_POST['username'] === $_ENV['USERNAME'] && $_POST['password'] === $_ENV['PASSWORD']) { $_SESSION['phpb_logged_in'] = true; phpb_redirect(phpb_url('website_manager')); } else {