diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 2fce4158..6a1e1efd 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -93,7 +93,10 @@ class LoginController extends Controller public function autologin($uuid) { - + $user = User::where('autologin', $uuid)->first(); + Auth::login($user); + session(['current_user' => $user]); + return redirect()->route('dash'); } /** diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index f44d921c..24d4c413 100644 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -103,10 +103,11 @@ class SettingsController extends Controller */ public function clear($id) { + $user = $this->user(); $setting = Setting::find($id); if((bool)$setting->system !== true) { - $setting->value = ''; - $setting->save(); + $user->settings()->detach($setting->id); + $user->settings()->save($setting, ['uservalue' => '']); } $route = route('settings.index', [], false); return redirect($route) diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 2bfb9d2f..fce89c09 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -7,7 +7,6 @@ use Artisan; use Schema; use App\Setting; use App\User; -use Session; class AppServiceProvider extends ServiceProvider { @@ -18,7 +17,7 @@ class AppServiceProvider extends ServiceProvider */ public function boot() { - $alt_bg = ''; + if(!is_file(base_path('.env'))) { touch(base_path('.env')); @@ -34,11 +33,6 @@ class AppServiceProvider extends ServiceProvider } if(is_file(database_path('app.sqlite'))) { if(Schema::hasTable('settings')) { - die("s: ".\Session::get('current_user')); - //die("c: ".User::currentUser()); - if($bg_image = Setting::_fetch('background_image', User::currentUser())) { - $alt_bg = ' style="background-image: url(/storage/'.$bg_image.')"'; - } // check version to see if an upgrade is needed $db_version = Setting::_fetch('version'); @@ -49,16 +43,25 @@ class AppServiceProvider extends ServiceProvider } else { Artisan::call('migrate', array('--path' => 'database/migrations', '--force' => true, '--seed' => true)); } - $lang = Setting::fetch('language'); - \App::setLocale($lang); } if(!is_file(public_path('storage'))) { Artisan::call('storage:link'); } - view()->share('alt_bg', $alt_bg); - //var_dump(env('FORCE_HTTPS')); + // User specific settings need to go here as session isn't available at this point in the app + view()->composer('*', function ($view) + { + $alt_bg = ''; + if($bg_image = Setting::fetch('background_image')) { + $alt_bg = ' style="background-image: url(/storage/'.$bg_image.')"'; + } + $lang = Setting::fetch('language'); + \App::setLocale($lang); + + $view->with('alt_bg', $alt_bg ); + }); + if (env('FORCE_HTTPS') === true) { \URL::forceScheme('https'); diff --git a/database/migrations/2018_10_12_140451_create_setting_user_pivot_table.php b/database/migrations/2018_10_12_140451_create_setting_user_pivot_table.php index 94cd1cd0..64e858cb 100644 --- a/database/migrations/2018_10_12_140451_create_setting_user_pivot_table.php +++ b/database/migrations/2018_10_12_140451_create_setting_user_pivot_table.php @@ -19,7 +19,7 @@ class CreateSettingUserPivotTable extends Migration $table->integer('user_id')->unsigned()->index(); $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); $table->primary(['setting_id', 'user_id']); - $table->string('value')->nullable(); + $table->string('uservalue')->nullable(); }); } diff --git a/database/seeds/UsersSeeder.php b/database/seeds/UsersSeeder.php index 38428483..615b022b 100644 --- a/database/seeds/UsersSeeder.php +++ b/database/seeds/UsersSeeder.php @@ -16,8 +16,8 @@ class UsersSeeder extends Seeder if(!$user = User::find(1)) { $user = new User; $user->id = 1; - $user->name = 'User'; - $user->email = 'test@test.com'; + $user->name = 'Admin'; + $user->email = 'admin@test.com'; $user->save(); } else { //$user->save(); diff --git a/public/css/app.css b/public/css/app.css index f9a450ab..bbfd705f 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -233,6 +233,17 @@ body { background: #cfd2d4; } +#switchuser { + background: rgba(0, 0, 0, 0.6); + position: absolute; + padding: 5px; + color: white; + text-align: center; + top: 0; + left: 0; + right: 0; +} + #app { display: -webkit-box; display: -ms-flexbox; @@ -323,7 +334,7 @@ body { } #app main, #app #sortable { - padding: 10px; + padding: 30px 10px; display: -webkit-box; display: -ms-flexbox; display: flex; @@ -374,6 +385,68 @@ body { margin-top: 12px; } +.userlist { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: center; + -ms-flex-pack: center; + justify-content: center; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; +} + +.userlist .user { + background: rgba(0, 0, 0, 0.5); + display: -webkit-box; + display: -ms-flexbox; + display: flex; + padding: 15px; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -ms-flex-direction: column; + flex-direction: column; + -webkit-box-pack: center; + -ms-flex-pack: center; + justify-content: center; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + margin: 20px; + color: white; + text-decoration: none; + border-radius: 15px; + border: 5px solid rgba(255, 255, 255, 0.7); + -webkit-box-shadow: 0 0 10px 0px rgba(0, 0, 0, 0.4); + box-shadow: 0 0 10px 0px rgba(0, 0, 0, 0.4); +} + +.userlist .user-img { + width: 130px; + height: 130px; + margin-bottom: 20px; + border-radius: 50%; + margin: 10px 10px 15px; +} + +.userlist #password { + color: #2f313a; + width: 100%; + padding: 5px 10px; + margin: 15px -5px; +} + +.userlist .btn { + width: 100%; +} + +.userlist .forgot { + color: white; + font-size: 12px; + margin-top: 25px; +} + .item-container { position: relative; } diff --git a/public/mix-manifest.json b/public/mix-manifest.json index e906db68..4a6d1f2a 100644 --- a/public/mix-manifest.json +++ b/public/mix-manifest.json @@ -1,4 +1,4 @@ { - "/css/app.css": "/css/app.css?id=2aa9dedf14862069c2ff", + "/css/app.css": "/css/app.css?id=6bc80b2f799b708a8024", "/js/app.js": "/js/app.js?id=32cbf6f4924b46ae7e05" } \ No newline at end of file diff --git a/resources/assets/sass/_app.scss b/resources/assets/sass/_app.scss index c2f0dcdc..f81a66a0 100644 --- a/resources/assets/sass/_app.scss +++ b/resources/assets/sass/_app.scss @@ -7,7 +7,16 @@ html { body { background: $body-bg; } - +#switchuser { + background: rgba(0,0,0,0.6); + position: absolute; + padding: 5px; + color: white; + text-align: center; + top:0; + left: 0; + right: 0; +} #app { display: flex; min-height: 100vh; @@ -70,7 +79,7 @@ body { flex-direction: column; } main, #sortable { - padding: 10px; + padding: 30px 10px; display: flex; justify-content: center; align-items: center; @@ -104,6 +113,47 @@ body { } } +.userlist { + display: flex; + justify-content: center; + align-items: center; + .user { + background: rgba(0,0,0,0.5); + display: flex; + padding: 15px; + flex-direction: column; + justify-content: center; + align-items: center; + margin: 20px; + color: white; + text-decoration: none; + border-radius: 15px; + border: 5px solid rgba(255,255,255, 0.7); + box-shadow: 0 0 10px 0px rgba(0,0,0,0.4); + } + .user-img { + width: 130px; + height: 130px; + margin-bottom: 20px; + border-radius: 50%; + margin: 10px 10px 15px; + } + #password { + color: $app-text; + width: 100%; + padding: 5px 10px; + margin: 15px -5px; + } + .btn { + width: 100%; + } + .forgot { + color: white; + font-size: 12px; + margin-top: 25px; + } +} + .item-container { //width: 340px; //transition: width .35s ease-in-out; diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index 33605813..883bb16a 100644 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -1,55 +1,25 @@ @extends('layouts.app') @section('content') -
-
-
-
-
Login as {{ \App\User::currentUser()->name }}
- -
-
- {{ csrf_field() }} - -
- - -
- - - @if ($errors->has('password')) - - {{ $errors->first('password') }} - - @endif -
-
- -
-
-
- -
-
-
- -
-
- - - - Forgot Your Password? - -
-
-
-
-
+ +
+ {{ csrf_field() }} +
+ +
+ @if($user->avatar) + + @else + + @endif + {{ $user->name }} + +
-
+ + + @endsection diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index 0455a33a..18dfe6a4 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -71,7 +71,7 @@
@endif - Switch User + Switch User @yield('content')
diff --git a/resources/views/userselect.blade.php b/resources/views/userselect.blade.php index 3633003b..3295ad53 100644 --- a/resources/views/userselect.blade.php +++ b/resources/views/userselect.blade.php @@ -2,8 +2,17 @@ @section('content') +
@foreach($users as $user) - {{ $user->name }} + + @if($user->avatar) + + @else + + @endif + {{ $user->name }} + @endforeach +
@endsection \ No newline at end of file diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php index dc02dfb1..2c72175e 100644 --- a/vendor/composer/ClassLoader.php +++ b/vendor/composer/ClassLoader.php @@ -379,9 +379,9 @@ class ClassLoader $subPath = substr($subPath, 0, $lastPos); $search = $subPath.'\\'; if (isset($this->prefixDirsPsr4[$search])) { - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); foreach ($this->prefixDirsPsr4[$search] as $dir) { - if (file_exists($file = $dir . $pathEnd)) { + $length = $this->prefixLengthsPsr4[$first][$search]; + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { return $file; } } diff --git a/vendor/composer/LICENSE b/vendor/composer/LICENSE index f0157a6e..f27399a0 100644 --- a/vendor/composer/LICENSE +++ b/vendor/composer/LICENSE @@ -1,56 +1,21 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: Composer -Upstream-Contact: Jordi Boggiano -Source: https://github.com/composer/composer -Files: * -Copyright: 2016, Nils Adermann - 2016, Jordi Boggiano -License: Expat +Copyright (c) Nils Adermann, Jordi Boggiano -Files: src/Composer/Util/TlsHelper.php -Copyright: 2016, Nils Adermann - 2016, Jordi Boggiano - 2013, Evan Coury -License: Expat and BSD-2-Clause +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: -License: BSD-2-Clause - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - . - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - . - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - . - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. -License: Expat - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is furnished - to do so, subject to the following conditions: - . - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - . - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index a97d316b..63e5d719 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -19,6 +19,7 @@ return array( 'App\\Http\\Controllers\\TagController' => $baseDir . '/app/Http/Controllers/TagController.php', 'App\\Http\\Controllers\\UserController' => $baseDir . '/app/Http/Controllers/UserController.php', 'App\\Http\\Kernel' => $baseDir . '/app/Http/Kernel.php', + 'App\\Http\\Middleware\\CheckAllowed' => $baseDir . '/app/Http/Middleware/CheckAllowed.php', 'App\\Http\\Middleware\\EncryptCookies' => $baseDir . '/app/Http/Middleware/EncryptCookies.php', 'App\\Http\\Middleware\\RedirectIfAuthenticated' => $baseDir . '/app/Http/Middleware/RedirectIfAuthenticated.php', 'App\\Http\\Middleware\\TrimStrings' => $baseDir . '/app/Http/Middleware/TrimStrings.php', @@ -32,6 +33,7 @@ return array( 'App\\Providers\\RouteServiceProvider' => $baseDir . '/app/Providers/RouteServiceProvider.php', 'App\\Setting' => $baseDir . '/app/Setting.php', 'App\\SettingGroup' => $baseDir . '/app/SettingGroup.php', + 'App\\SettingUser' => $baseDir . '/app/SettingUser.php', 'App\\SupportedApps\\AirSonic' => $baseDir . '/app/SupportedApps/AirSonic.php', 'App\\SupportedApps\\Bazarr' => $baseDir . '/app/SupportedApps/Bazarr.php', 'App\\SupportedApps\\BookStack' => $baseDir . '/app/SupportedApps/BookStack.php', diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index d9ae0851..1c76b50a 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -372,6 +372,7 @@ class ComposerStaticInit4b6fb9210a1ea37c2db27b8ff53a1ecf 'App\\Http\\Controllers\\TagController' => __DIR__ . '/../..' . '/app/Http/Controllers/TagController.php', 'App\\Http\\Controllers\\UserController' => __DIR__ . '/../..' . '/app/Http/Controllers/UserController.php', 'App\\Http\\Kernel' => __DIR__ . '/../..' . '/app/Http/Kernel.php', + 'App\\Http\\Middleware\\CheckAllowed' => __DIR__ . '/../..' . '/app/Http/Middleware/CheckAllowed.php', 'App\\Http\\Middleware\\EncryptCookies' => __DIR__ . '/../..' . '/app/Http/Middleware/EncryptCookies.php', 'App\\Http\\Middleware\\RedirectIfAuthenticated' => __DIR__ . '/../..' . '/app/Http/Middleware/RedirectIfAuthenticated.php', 'App\\Http\\Middleware\\TrimStrings' => __DIR__ . '/../..' . '/app/Http/Middleware/TrimStrings.php', @@ -385,6 +386,7 @@ class ComposerStaticInit4b6fb9210a1ea37c2db27b8ff53a1ecf 'App\\Providers\\RouteServiceProvider' => __DIR__ . '/../..' . '/app/Providers/RouteServiceProvider.php', 'App\\Setting' => __DIR__ . '/../..' . '/app/Setting.php', 'App\\SettingGroup' => __DIR__ . '/../..' . '/app/SettingGroup.php', + 'App\\SettingUser' => __DIR__ . '/../..' . '/app/SettingUser.php', 'App\\SupportedApps\\AirSonic' => __DIR__ . '/../..' . '/app/SupportedApps/AirSonic.php', 'App\\SupportedApps\\Bazarr' => __DIR__ . '/../..' . '/app/SupportedApps/Bazarr.php', 'App\\SupportedApps\\BookStack' => __DIR__ . '/../..' . '/app/SupportedApps/BookStack.php',