瀏覽代碼

Merge pull request #616 from 1day2die/development

Development
Dennis 2 年之前
父節點
當前提交
871bd680b8

+ 6 - 0
app/Classes/Settings/System.php

@@ -51,6 +51,9 @@ class System
             'show-imprint' => 'string',
             'show-privacy' => 'string',
             'show-tos' => 'string',
+            'alert-enabled' => 'string',
+            'alter-type' => 'string',
+            'alert-message' => 'string',
         ]);
 
         $validator->after(function ($validator) use ($request) {
@@ -96,6 +99,9 @@ class System
             "SETTINGS::SYSTEM:SHOW_IMPRINT" => "show-imprint",
             "SETTINGS::SYSTEM:SHOW_PRIVACY" => "show-privacy",
             "SETTINGS::SYSTEM:SHOW_TOS" => "show-tos",
+            "SETTINGS::SYSTEM:ALERT_ENABLED" => "alert-enabled",
+            "SETTINGS::SYSTEM:ALERT_TYPE" => "alert-type",
+            "SETTINGS::SYSTEM:ALERT_MESSAGE" => "alert-message",
         ];
 
         foreach ($values as $key => $value) {

+ 13 - 0
app/Http/Controllers/Auth/LoginController.php

@@ -41,6 +41,19 @@ class LoginController extends Controller
         $this->middleware('guest')->except('logout');
     }
 
+    /**
+     * Get the login username to be used by the controller.
+     *
+     * @return string
+     */
+    public function username()
+    {
+        $login = request()->input('email');
+        $field = filter_var($login, FILTER_VALIDATE_EMAIL) ? 'email' : 'name';
+        request()->merge([$field => $login]);
+        return $field;
+    }
+
     public function login(Request $request)
     {
         $validationRules = [

+ 1 - 1
app/Models/User.php

@@ -298,7 +298,7 @@ class User extends Authenticatable implements MustVerifyEmail
     public function getActivitylogOptions(): LogOptions
     {
         return LogOptions::defaults()
-            -> logOnly(['*'])
+            -> logOnly(['role', 'name', 'server_limit', 'pterodactyl_id', 'email'])
             -> logOnlyDirty()
             -> dontSubmitEmptyLogs();
     }

+ 1 - 1
config/app.php

@@ -97,7 +97,7 @@ return [
     |
     */
 
-    'available_locales' => array_map('basename', preg_replace('/\\.[^.\\s]{3,4}$/', '', glob(resource_path().'/lang/*.json', GLOB_BRACE))),
+    'available_locales' => array_map('basename', preg_replace('/\\.[^.\\s]{3,4}$/', '', glob(base_path("lang").'/*.json', GLOB_BRACE))),
 
     /*
     |--------------------------------------------------------------------------

+ 23 - 0
database/seeders/Seeds/SettingsSeeder.php

@@ -574,5 +574,28 @@ class SettingsSeeder extends Seeder
             'type' => 'boolean',
             'description' => 'Enable/disable Terms of Service in footer',
         ]);
+
+        Settings::firstOrCreate([
+            'key' => 'SETTINGS::SYSTEM:ALERT_ENABLED',
+        ], [
+            'value' => 'false',
+            'type' => 'boolean',
+            'description' => 'Enable/disable Alerts on Homepage',
+        ]);
+        Settings::firstOrCreate([
+            'key' => 'SETTINGS::SYSTEM:ALERT_TYPE',
+        ], [
+            'value' => 'dark',
+            'type' => 'text',
+            'description' => 'Changes the Color of the Alert',
+        ]);
+
+        Settings::firstOrCreate([
+            'key' => 'SETTINGS::SYSTEM:ALERT_MESSAGE',
+        ], [
+            'value' => '',
+            'type' => 'text',
+            'description' => 'Changes the Content the Alert',
+        ]);
     }
 }

+ 42 - 1
resources/views/admin/settings/tabs/system.blade.php

@@ -195,7 +195,7 @@
                     </div>
                     <div class="custom-control mb-3 p-0">
                         <label for="initial-server-limit">{{ __('Initial Server Limit') }}</label>
-                        <input x-model="initial-server-limit" id="initial-server-limit" name="initial-server-limit" type="number" min="0" max="99999999" 
+                        <input x-model="initial-server-limit" id="initial-server-limit" name="initial-server-limit" type="number" min="0" max="99999999"
                             value="{{ config('SETTINGS::USER:INITIAL_SERVER_LIMIT') }}"
                             class="form-control @error('initial-server-limit') is-invalid @enderror" required>
                     </div>
@@ -299,8 +299,49 @@
                             class="form-control @error('minimum-credits') is-invalid @enderror" required>
                     </div>
                 </div>
+                {{-- ALERT --}}
+                <div class="row mb-2">
+                    <div class="col text-center">
+                        <h1>Alert</h1>
+                    </div>
+                </div>
+                <div class="custom-control mb-3 p-0">
+                    <input value="true" id="alert-enabled" name="alert-enabled"
+                           {{ config('SETTINGS::SYSTEM:ALERT_ENABLED') == 'true' ? 'checked' : '' }} type="checkbox">
+                    <label for="enable-login-logo">{{ __('Enable the Alert Message on Homepage') }} </label>
+                </div>
+
+                <div class="custom-control mb-3 p-0">
+                    <label for="alert-type">{{ __('Alert Color') }}</label>
+                <select id="alert-type" style="width:100%" class="custom-select" name="alert-type" required
+                        autocomplete="off" @error('alert-type') is-invalid @enderror>
+                    <option value="primary" @if (config('SETTINGS::SYSTEM:ALERT_TYPE') == "primary") selected
+                        @endif>{{ __("Blue") }}</option>
+                    <option value="secondary" @if (config('SETTINGS::SYSTEM:ALERT_TYPE') == "secondary") selected
+                        @endif>{{ __("Grey") }}</option>
+                    <option value="success" @if (config('SETTINGS::SYSTEM:ALERT_TYPE') == "success") selected
+                        @endif>{{ __("Green") }}</option>
+                    <option value="danger" @if (config('SETTINGS::SYSTEM:ALERT_TYPE') == "danger") selected
+                        @endif>{{ __("Red") }}</option>
+                    <option value="warning" @if (config('SETTINGS::SYSTEM:ALERT_TYPE') == "warning") selected
+                        @endif>{{ __("Orange") }}</option>
+                    <option value="info" @if (config('SETTINGS::SYSTEM:ALERT_TYPE') == "info") selected
+                        @endif>{{ __("Cyan") }}</option>
+                </select>
+                </div>
+
+                <div class="custom-control mb-3 p-0">
+                    <label for="alert-message">{{ __('Alert Message (HTML might be used)') }}</label>
+                    <textarea x-model="alert-message" id="alert-message" name="alert-message"
+                           class="form-control @error('alert-message') is-invalid @enderror">
+                        {{ config('SETTINGS::SYSTEM:ALERT_MESSAGE', '') }}
+                        </textarea>
+                </div>
+
             </div>
 
+
+
             {{-- Design --}}
             <div class="col-md-3 px-3">
                 <div class="row mb-2">

+ 2 - 2
resources/views/auth/login.blade.php

@@ -31,9 +31,9 @@
 
                         <div class="form-group">
                             <div class="input-group mb-3">
-                                <input type="email" name="email"
+                                <input type="text" name="email"
                                     class="form-control @error('email') is-invalid @enderror"
-                                    placeholder="{{ __('Email') }}">
+                                    placeholder="{{ __('Email or Username') }}">
                                 <div class="input-group-append">
                                     <div class="input-group-text">
                                         <span class="fas fa-envelope"></span>

+ 6 - 0
resources/views/home.blade.php

@@ -26,6 +26,12 @@
 
         </div>
     @endif
+
+    @if(config("SETTINGS::SYSTEM:ALERT_ENABLED") && !empty(config("SETTINGS::SYSTEM:ALERT_MESSAGE")))
+        <div class="alert mt-4 alert-{{config("SETTINGS::SYSTEM:ALERT_TYPE")}}" role="alert">
+            {!! config("SETTINGS::SYSTEM:ALERT_MESSAGE") !!}
+        </div>
+    @endif
     <!-- MAIN CONTENT -->
     <section class="content">
         <div class="container-fluid">