From f77ccb6929f827774a2cb850efb5da79aef2eb96 Mon Sep 17 00:00:00 2001 From: Bozhidar Date: Mon, 5 Aug 2024 14:40:58 +0300 Subject: [PATCH] Update HostingSubscription.php --- web/app/Models/HostingSubscription.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/web/app/Models/HostingSubscription.php b/web/app/Models/HostingSubscription.php index 43cef72..3abc600 100644 --- a/web/app/Models/HostingSubscription.php +++ b/web/app/Models/HostingSubscription.php @@ -53,7 +53,7 @@ class HostingSubscription extends Model $model->system_username = $create['system_username']; $model->system_password = $create['system_password']; } else { - return false; + throw new \Exception('System username or password not created'); } }); @@ -167,6 +167,17 @@ class HostingSubscription extends Model if (strpos($createLinuxWebUserOutput, 'Creating home directory') !== false) { + // Check user is created + $getLinuxUser = new GetLinuxUser(); + $getLinuxUser->setUsername($systemUsername); + $linuxUser = $getLinuxUser->handle(); + if (empty($linuxUser)) { + return [ + 'error' => true, + 'message' => 'System username not created.' + ]; + } + return [ 'system_username' => $systemUsername, 'system_password' => $systemPassword