From 2426af7de8c9d426aaf534ff17b67f71c2e9f374 Mon Sep 17 00:00:00 2001 From: Yassine Doghri <yassine@doghri.fr> Date: Mon, 12 Oct 2020 12:29:56 +0000 Subject: [PATCH] fix(install): redirect to input baseUrl after instance config install was redirecting to default baseUrl because `redirect->back()` uses the `site_url()` function fix #53 --- app/Controllers/Install.php | 12 ++++++++++-- app/Views/install/instance_config.php | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/Controllers/Install.php b/app/Controllers/Install.php index 712033c22c..6cdb342266 100644 --- a/app/Controllers/Install.php +++ b/app/Controllers/Install.php @@ -163,13 +163,21 @@ class Install extends Controller ->with('errors', $this->validator->getErrors()); } + $baseUrl = $this->request->getPost('hostname'); self::writeEnv([ - 'app.baseURL' => $this->request->getPost('hostname'), + 'app.baseURL' => $baseUrl, 'app.adminGateway' => $this->request->getPost('admin_gateway'), 'app.authGateway' => $this->request->getPost('auth_gateway'), ]); - return redirect()->back(); + helper('text'); + + // redirect to full install url with new baseUrl input + return redirect(0)->to( + reduce_double_slashes( + $baseUrl . '/' . config('App')->installGateway + ) + ); } public function databaseConfig() diff --git a/app/Views/install/instance_config.php b/app/Views/install/instance_config.php index 19416b9f89..522bf87b8a 100644 --- a/app/Views/install/instance_config.php +++ b/app/Views/install/instance_config.php @@ -15,7 +15,7 @@ 'id' => 'hostname', 'name' => 'hostname', 'class' => 'form-input mb-4', - 'value' => old('hostname', set_value(host_url(), config('App')->baseURL)), + 'value' => old('hostname', host_url() ?? config('App')->baseURL), 'required' => 'required', ]) ?> -- GitLab