mirror of
				https://github.com/linuxserver/Heimdall.git
				synced 2025-10-31 21:17:44 +09:00 
			
		
		
		
	Autologin togles working
This commit is contained in:
		| @@ -48,4 +48,9 @@ class LoginController extends Controller | |||||||
|         session(['current_user' => $user]); |         session(['current_user' => $user]); | ||||||
|         return redirect()->route('dash'); |         return redirect()->route('dash'); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     public function autologin($uuid) | ||||||
|  |     { | ||||||
|  |  | ||||||
|  |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -42,25 +42,30 @@ class UserController extends Controller | |||||||
|         $validatedData = $request->validate([ |         $validatedData = $request->validate([ | ||||||
|             'name' => 'required|max:255', |             'name' => 'required|max:255', | ||||||
|             'email' => 'required|email', |             'email' => 'required|email', | ||||||
|             'password' => 'nullable', |             'password' => 'nullable|confirmed', | ||||||
|             'password_confirmation' => 'nullable|confirmed' |             'password_confirmation' => 'nullable' | ||||||
|  |  | ||||||
|         ]); |         ]); | ||||||
|             //die(print_r($request->all())); |         $user = new User; | ||||||
|  |         $user->name = $request->input('name'); | ||||||
|  |         $user->email = $request->input('email'); | ||||||
|  |         $user->public_front = $request->input('public_front'); | ||||||
|  |  | ||||||
|  |         $password = $request->input('password'); | ||||||
|  |         if(!empty($password)) { | ||||||
|  |             $user->password = bcrypt(); | ||||||
|  |         } | ||||||
|  |  | ||||||
|         if($request->hasFile('file')) { |         if($request->hasFile('file')) { | ||||||
|             $path = $request->file('file')->store('avatars'); |             $path = $request->file('file')->store('avatars'); | ||||||
|             $request->merge([ |             $user->avatar = $path; | ||||||
|                 'avatar' => $path |  | ||||||
|             ]); |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if ((bool)$request->input('autologin_allow') === true) { |         if ((bool)$request->input('autologin_allow') === true) { | ||||||
|             $request->merge([ |             $user->autologin = (string)Str::uuid(); | ||||||
|                 'autologin' => (string)Str::uuid() |  | ||||||
|             ]);   |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         $user = User::create($request->all()); |         $user->save(); | ||||||
|          |          | ||||||
|         $route = route('dash', [], false); |         $route = route('dash', [], false); | ||||||
|         return redirect($route) |         return redirect($route) | ||||||
| @@ -103,28 +108,34 @@ class UserController extends Controller | |||||||
|         $validatedData = $request->validate([ |         $validatedData = $request->validate([ | ||||||
|             'name' => 'required|max:255', |             'name' => 'required|max:255', | ||||||
|             'email' => 'required|email', |             'email' => 'required|email', | ||||||
|             'password' => 'nullable', |             'password' => 'nullable|confirmed', | ||||||
|             'password_confirmation' => 'nullable|confirmed' |             'password_confirmation' => 'nullable' | ||||||
|         ]); |         ]); | ||||||
|             //die(print_r($request->all())); |             //die(print_r($request->all())); | ||||||
|  |  | ||||||
|  |         $user->name = $request->input('name'); | ||||||
|  |         $user->email = $request->input('email'); | ||||||
|  |         $user->public_front = $request->input('public_front'); | ||||||
|  |  | ||||||
|  |         $password = $request->input('password'); | ||||||
|  |         if(!empty($password)) { | ||||||
|  |             $user->password = bcrypt($password); | ||||||
|  |         } elseif($password == 'null') { | ||||||
|  |             $user->password = null; | ||||||
|  |         } | ||||||
|  |      | ||||||
|         if($request->hasFile('file')) { |         if($request->hasFile('file')) { | ||||||
|             $path = $request->file('file')->store('avatars'); |             $path = $request->file('file')->store('avatars'); | ||||||
|             $request->merge([ |             $user->avatar = $path; | ||||||
|                 'avatar' => $path |  | ||||||
|             ]); |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if ((bool)$request->input('autologin_allow') === true) { |         if ((bool)$request->input('autologin_allow') === true) { | ||||||
|             $autologin = (is_null($user->autologin)) ? (string)Str::uuid() : $user->autologin; |             $user->autologin = (is_null($user->autologin)) ? (string)Str::uuid() : $user->autologin; | ||||||
|         } else { |         } else { | ||||||
|             $autologin = null; |             $user->autologin = null; | ||||||
|         } |         } | ||||||
|         $request->merge([ |  | ||||||
|             'autologin' => $autologin |         $user->save(); | ||||||
|         ]);   |  | ||||||
|         $input = $request->except(['password_confirmation', 'autologin_allow']); |  | ||||||
|         //die(print_r($input)); |  | ||||||
|          |  | ||||||
|         $user->update($input); |  | ||||||
|  |  | ||||||
|         $route = route('dash', [], false); |         $route = route('dash', [], false); | ||||||
|         return redirect($route) |         return redirect($route) | ||||||
|   | |||||||
| @@ -19,7 +19,7 @@ class CreateUsersTable extends Migration | |||||||
|             $table->string('email')->unique(); |             $table->string('email')->unique(); | ||||||
|             $table->string('avatar')->nullable(); |             $table->string('avatar')->nullable(); | ||||||
|             $table->string('password')->nullable(); |             $table->string('password')->nullable(); | ||||||
|             $table->string('autologin')->nullable(); |             $table->string('autologin')->nullable()->index(); | ||||||
|             $table->boolean('public_front')->default(false); |             $table->boolean('public_front')->default(false); | ||||||
|             $table->rememberToken(); |             $table->rememberToken(); | ||||||
|             $table->timestamps(); |             $table->timestamps(); | ||||||
|   | |||||||
| @@ -56,7 +56,7 @@ | |||||||
|  |  | ||||||
|         <div class="input"> |         <div class="input"> | ||||||
|                 <label>{{ __('app.user.secure_front') }}</label> |                 <label>{{ __('app.user.secure_front') }}</label> | ||||||
|                 {!! Form::hidden('public_front', '1') !!} |                 {!! Form::hidden('public_front', '0') !!} | ||||||
|                 <label class="switch"> |                 <label class="switch"> | ||||||
|                     <?php |                     <?php | ||||||
|                     $checked = true; |                     $checked = true; | ||||||
|   | |||||||
| @@ -21,6 +21,7 @@ | |||||||
|                     <tr> |                     <tr> | ||||||
|                         <th>{{ __('app.user.name') }}</th> |                         <th>{{ __('app.user.name') }}</th> | ||||||
|                         <th>{{ __('app.apps.password') }}</th> |                         <th>{{ __('app.apps.password') }}</th> | ||||||
|  |                         <th>{{ __('app.apps.autologin_url') }}</th> | ||||||
|                         <th class="text-center" width="100">{{ __('app.settings.edit') }}</th> |                         <th class="text-center" width="100">{{ __('app.settings.edit') }}</th> | ||||||
|                         <th class="text-center" width="100">{{ __('app.delete') }}</th> |                         <th class="text-center" width="100">{{ __('app.delete') }}</th> | ||||||
|                     </tr> |                     </tr> | ||||||
| @@ -31,6 +32,13 @@ | |||||||
|                             <tr> |                             <tr> | ||||||
|                                 <td>{{ $user->name }}</td> |                                 <td>{{ $user->name }}</td> | ||||||
|                                 <td><i class="fa {{ (!is_null($user->password) ? 'fa-check' : 'fa-times') }}" /></td> |                                 <td><i class="fa {{ (!is_null($user->password) ? 'fa-check' : 'fa-times') }}" /></td> | ||||||
|  |                                 <td> | ||||||
|  |                                 @if(is_null($user->autologin)) | ||||||
|  |                                     <i class="fa fa-times" /> | ||||||
|  |                                 @else | ||||||
|  |                                     <a href="{{ route('user.autologin', $user->autologin) }}">{{ route('user.autologin', $user->autologin) }}</a> | ||||||
|  |                                 @endif | ||||||
|  |                                 </td> | ||||||
|                                 <td class="text-center"><a{{ $user->target }} href="{!! route('users.edit', [$user->id], false) !!}" title="{{ __('user.settings.edit') }} {!! $user->title !!}"><i class="fas fa-edit"></i></a></td> |                                 <td class="text-center"><a{{ $user->target }} href="{!! route('users.edit', [$user->id], false) !!}" title="{{ __('user.settings.edit') }} {!! $user->title !!}"><i class="fas fa-edit"></i></a></td> | ||||||
|                                 <td class="text-center"> |                                 <td class="text-center"> | ||||||
|                                         {!! Form::open(['method' => 'DELETE','route' => ['users.destroy', $user->id],'style'=>'display:inline']) !!} |                                         {!! Form::open(['method' => 'DELETE','route' => ['users.destroy', $user->id],'style'=>'display:inline']) !!} | ||||||
|   | |||||||
| @@ -13,6 +13,7 @@ | |||||||
|  |  | ||||||
| Route::get('/userselect/{user}', 'Auth\LoginController@setUser')->name('user.set'); | Route::get('/userselect/{user}', 'Auth\LoginController@setUser')->name('user.set'); | ||||||
| Route::get('/userselect', 'Auth\LoginController@index')->name('user.select'); | Route::get('/userselect', 'Auth\LoginController@index')->name('user.select'); | ||||||
|  | Route::get('/autologin/{uuid}', 'Auth\LoginController@autologin')->name('user.autologin'); | ||||||
|  |  | ||||||
| Route::get('/', 'ItemController@dash')->name('dash'); | Route::get('/', 'ItemController@dash')->name('dash'); | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								vendor/composer/ClassLoader.php
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/composer/ClassLoader.php
									
									
									
									
										vendored
									
									
								
							| @@ -379,9 +379,9 @@ class ClassLoader | |||||||
|                 $subPath = substr($subPath, 0, $lastPos); |                 $subPath = substr($subPath, 0, $lastPos); | ||||||
|                 $search = $subPath.'\\'; |                 $search = $subPath.'\\'; | ||||||
|                 if (isset($this->prefixDirsPsr4[$search])) { |                 if (isset($this->prefixDirsPsr4[$search])) { | ||||||
|  |                     $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); | ||||||
|                     foreach ($this->prefixDirsPsr4[$search] as $dir) { |                     foreach ($this->prefixDirsPsr4[$search] as $dir) { | ||||||
|                         $length = $this->prefixLengthsPsr4[$first][$search]; |                         if (file_exists($file = $dir . $pathEnd)) { | ||||||
|                         if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { |  | ||||||
|                             return $file; |                             return $file; | ||||||
|                         } |                         } | ||||||
|                     } |                     } | ||||||
|   | |||||||
							
								
								
									
										69
									
								
								vendor/composer/LICENSE
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										69
									
								
								vendor/composer/LICENSE
									
									
									
									
										vendored
									
									
								
							| @@ -1,21 +1,56 @@ | |||||||
|  | Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ | ||||||
|  | Upstream-Name: Composer | ||||||
|  | Upstream-Contact: Jordi Boggiano <j.boggiano@seld.be> | ||||||
|  | Source: https://github.com/composer/composer | ||||||
|  |  | ||||||
| Copyright (c) Nils Adermann, Jordi Boggiano | Files: * | ||||||
|  | Copyright: 2016, Nils Adermann <naderman@naderman.de> | ||||||
|  |            2016, Jordi Boggiano <j.boggiano@seld.be> | ||||||
|  | License: Expat | ||||||
|  |  | ||||||
| Permission is hereby granted, free of charge, to any person obtaining a copy | Files: src/Composer/Util/TlsHelper.php | ||||||
| of this software and associated documentation files (the "Software"), to deal | Copyright: 2016, Nils Adermann <naderman@naderman.de> | ||||||
| in the Software without restriction, including without limitation the rights |            2016, Jordi Boggiano <j.boggiano@seld.be> | ||||||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |            2013, Evan Coury <me@evancoury.com> | ||||||
| copies of the Software, and to permit persons to whom the Software is furnished | License: Expat and BSD-2-Clause | ||||||
| to do so, subject to the following conditions: |  | ||||||
|  |  | ||||||
| The above copyright notice and this permission notice shall be included in all | License: BSD-2-Clause | ||||||
| copies or substantial portions of the Software. |  Redistribution and use in source and binary forms, with or without modification, | ||||||
|  |  are permitted provided that the following conditions are met: | ||||||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |  . | ||||||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |      * Redistributions of source code must retain the above copyright notice, | ||||||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |        this list of conditions and the following disclaimer. | ||||||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |  . | ||||||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |      * Redistributions in binary form must reproduce the above copyright notice, | ||||||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |        this list of conditions and the following disclaimer in the documentation | ||||||
| THE SOFTWARE. |        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. | ||||||
|  |  | ||||||
|  | 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. | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user