diff --git a/app/Http/Controllers/API/ServerController.php b/app/Http/Controllers/API/ServerController.php new file mode 100644 index 0000000..792b27e --- /dev/null +++ b/app/Http/Controllers/API/ServerController.php @@ -0,0 +1,22 @@ +withData(\App\Http\Resources\API\Setting::collection(collect($settings))); + } +} diff --git a/app/Http/Resources/API/Setting.php b/app/Http/Resources/API/Setting.php new file mode 100644 index 0000000..da3a2de --- /dev/null +++ b/app/Http/Resources/API/Setting.php @@ -0,0 +1,36 @@ + $this->name, + //'created_at' => $this->created_at, + //'updated_at' => $this->created_at, + 'description' => $this->description, + 'typ' => $this->typ, + 'value' => $this->value, + ]; + + if($this->typ == "checkbox") { + $data["value"] = (bool)$this->value; + } + + if($this->typ == "password") { + $data["value"] = null; + } + + return $data; + } +} \ No newline at end of file diff --git a/app/Models/Setting.php b/app/Models/Setting.php index c1bd21d..b3e6d91 100644 --- a/app/Models/Setting.php +++ b/app/Models/Setting.php @@ -28,6 +28,22 @@ class Setting extends Model '', ]; + /* + * Public setting keys + */ + static public $publicKeys = [ + 'registration_possible', + 'invites', + 'url', + 'name', + 'recaptcha_v2_register', + 'recaptcha_v2_login', + 'recaptcha_v2_key', + 'name_big', + 'name_small', + 'name_slogen' + ]; + static public function getSettingsAsArray() { $settings = Setting::query()->get(); @@ -39,6 +55,11 @@ class Setting extends Model } static public function getSettingValue($name) { + //Hack for old gui return Setting::query()->where("name", "=", $name)->firstOrFail()->value; } + + static public function getPublicSettings() { + return Setting::query()->whereIn("name", self::$publicKeys)->get(); + } } diff --git a/database/migrations/2019_05_22_121930_new_gui_settings.php b/database/migrations/2019_05_22_121930_new_gui_settings.php new file mode 100644 index 0000000..aa9c327 --- /dev/null +++ b/database/migrations/2019_05_22_121930_new_gui_settings.php @@ -0,0 +1,53 @@ +name = "name_big"; + $setting->description = "First Part of the Name, written big on the Webpage"; + $setting->typ = "textinput"; + $setting->value = \App\Models\Setting::getSettingValue("name"); + $setting->saveOrFail(); + $setting = new \App\Models\Setting(); + $setting->name = "name_small"; + $setting->description = "Secound Part of the Name, written smal on the Webpage"; + $setting->typ = "textinput"; + $setting->value = ""; + $setting->saveOrFail(); + \App\Models\Setting::query()->where("name", "=", "name")->delete(); + $setting = new \App\Models\Setting(); + $setting->name = "name_slogen"; + $setting->description = "Slogen show on the Webpage"; + $setting->typ = "textinput"; + $setting->value = "Zentraler authentication Service"; + $setting->saveOrFail(); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + $setting = new \App\Models\Setting(); + $setting->name = "name"; + $setting->description = "Name of this Service"; + $setting->value = \App\Models\Setting::getSettingValue("name_big").\App\Models\Setting::getSettingValue("name_small"); + $setting->saveOrFail(); + \App\Models\Setting::query()->where("name", "=", "name_big")->delete(); + \App\Models\Setting::query()->where("name", "=", "name_small")->delete(); + \App\Models\Setting::query()->where("name", "=", "name_slogen")->delete(); + } +} diff --git a/public/index.php b/public/index.php index 7b30079..dd915e1 100644 --- a/public/index.php +++ b/public/index.php @@ -26,4 +26,6 @@ $app = require __DIR__.'/../bootstrap/app.php'; | */ +header("Access-Control-Allow-Origin: *"); + $app->run(); diff --git a/resources/views/index.php b/resources/views/index.php index 9344c39..f07b2e3 100644 --- a/resources/views/index.php +++ b/resources/views/index.php @@ -2,15 +2,15 @@
-

+

- is a oAuht Provider to login with a single user to different Services. You just need one Account to use all Services, also other developers can add this Service to there services. + is a oAuht Provider to login with a single user to different Services. You just need one Account to use all Services, also other developers can add this Service to there services.

In the test phase of the Project you need an Invite-Code to create a new Account. diff --git a/resources/views/layout/top.php b/resources/views/layout/top.php index d5bae64..23f71c1 100644 --- a/resources/views/layout/top.php +++ b/resources/views/layout/top.php @@ -1,6 +1,6 @@ - <?php echo $settingsArray["name"]; ?> + <?php echo $settingsArray["name_big"].$settingsArray["name_small"]; ?> @@ -12,7 +12,7 @@