mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-05-16 02:05:01 +00:00
Log in functionality
This commit is contained in:
@@ -85,6 +85,8 @@ class SetupWizardController extends Controller
|
||||
throw new HttpException(500, $e->getMessage());
|
||||
}
|
||||
|
||||
// TODO: add SANCTUM_STATEFUL_DOMAINS parameter
|
||||
|
||||
setEnvironmentValue([
|
||||
'DB_CONNECTION' => $request->connection,
|
||||
'DB_HOST' => $request->host,
|
||||
|
||||
@@ -23,19 +23,21 @@ class BrowseController extends Controller
|
||||
*/
|
||||
public function folder(Request $request, $id)
|
||||
{
|
||||
$root_id = $id === 'undefined' ? null : $id;
|
||||
|
||||
// Get folder trash items
|
||||
if ($request->query('trash')) {
|
||||
|
||||
// Get folders and files
|
||||
$folders = Folder::onlyTrashed()
|
||||
->with('parent')
|
||||
->where('parent_id', $id)
|
||||
->where('parent_id', $root_id)
|
||||
->sortable()
|
||||
->get();
|
||||
|
||||
$files = File::onlyTrashed()
|
||||
->with('parent')
|
||||
->where('folder_id', $id)
|
||||
->where('folder_id', $root_id)
|
||||
->sortable()
|
||||
->get();
|
||||
|
||||
@@ -45,12 +47,12 @@ class BrowseController extends Controller
|
||||
|
||||
// Get folders and files
|
||||
$folders = Folder::with(['parent:id,name', 'shared:token,id,item_id,permission,is_protected,expire_in'])
|
||||
->where('parent_id', $id)
|
||||
->where('parent_id', $root_id)
|
||||
->sortable()
|
||||
->get();
|
||||
|
||||
$files = File::with(['parent:id,name', 'shared:token,id,item_id,permission,is_protected,expire_in'])
|
||||
->where('folder_id', $id)
|
||||
->where('folder_id', $root_id)
|
||||
->sortable()
|
||||
->get();
|
||||
|
||||
|
||||
+4
-4
@@ -16,11 +16,11 @@ class Kernel extends HttpKernel
|
||||
*/
|
||||
protected $middleware = [
|
||||
\App\Http\Middleware\TrustProxies::class,
|
||||
\App\Http\Middleware\CheckForMaintenanceMode::class,
|
||||
\Fruitcake\Cors\HandleCors::class,
|
||||
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
||||
\App\Http\Middleware\TrimStrings::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
|
||||
\Fruitcake\Cors\HandleCors::class,
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -41,8 +41,8 @@ class Kernel extends HttpKernel
|
||||
|
||||
'api' => [
|
||||
EnsureFrontendRequestsAreStateful::class,
|
||||
\App\Http\Middleware\EncryptCookies::class,
|
||||
//'throttle:60,1',
|
||||
//'throttle:api',
|
||||
//\App\Http\Middleware\EncryptCookies::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
];
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
|
||||
|
||||
class PreventRequestsDuringMaintenance extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be reachable while maintenance mode is enabled.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
||||
@@ -13,13 +13,17 @@ class RedirectIfAuthenticated
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param string|null $guard
|
||||
* @param string|null ...$guards
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next, $guard = null)
|
||||
public function handle($request, Closure $next, ...$guards)
|
||||
{
|
||||
if (Auth::guard($guard)->check()) {
|
||||
return redirect(RouteServiceProvider::HOME);
|
||||
$guards = empty($guards) ? [null] : $guards;
|
||||
|
||||
foreach ($guards as $guard) {
|
||||
if (Auth::guard($guard)->check()) {
|
||||
return redirect('/files');
|
||||
}
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
|
||||
@@ -20,65 +20,51 @@ class UserResource extends JsonResource
|
||||
{
|
||||
// TODO: zrefaktorovat
|
||||
return [
|
||||
'data' => [
|
||||
'id' => (string)$this->id,
|
||||
'type' => 'user',
|
||||
'attributes' => [
|
||||
'data' => [
|
||||
'id' => $this->id,
|
||||
'type' => 'user',
|
||||
'attributes' => [
|
||||
'storage_capacity' => $this->settings->storage_capacity,
|
||||
'subscription' => $this->subscribed('main'),
|
||||
'incomplete_payment' => $this->hasIncompletePayment('main') ? route('cashier.payment', $this->subscription('main')->latestPayment()->id) : null,
|
||||
'stripe_customer' => is_null($this->stripe_id) ? false : true,
|
||||
'email' => env('APP_DEMO') ? obfuscate_email($this->email) : $this->email,
|
||||
'role' => $this->role,
|
||||
'folders' => $this->folder_tree,
|
||||
'storage' => $this->storage,
|
||||
'created_at_formatted' => format_date($this->created_at, '%d. %B. %Y'),
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
],
|
||||
'relationships' => [
|
||||
'settings' => [
|
||||
'data' => [
|
||||
'id' => $this->id,
|
||||
'type' => 'settings',
|
||||
'attributes' => [
|
||||
'avatar' => $this->settings->avatar,
|
||||
'billing_name' => $this->settings->name,
|
||||
'billing_address' => $this->settings->address,
|
||||
'billing_state' => $this->settings->state,
|
||||
'billing_city' => $this->settings->city,
|
||||
'billing_postal_code' => $this->settings->postal_code,
|
||||
'billing_country' => $this->settings->country,
|
||||
'billing_phone_number' => $this->settings->phone_number,
|
||||
'timezone' => $this->settings->timezone
|
||||
]
|
||||
]
|
||||
],
|
||||
'favourites' => [
|
||||
'data' => [
|
||||
'id' => $this->id,
|
||||
'type' => 'favourite_folders',
|
||||
'attributes' => [
|
||||
'folders' => $this->favouriteFolders->makeHidden(['pivot'])
|
||||
],
|
||||
],
|
||||
]
|
||||
]
|
||||
],
|
||||
'relationships' => [
|
||||
'settings' => [
|
||||
'data' => [
|
||||
'id' => $this->settings->user_id,
|
||||
'type' => 'settings',
|
||||
'attributes' => [
|
||||
'avatar' => $this->settings->avatar,
|
||||
'billing_name' => $this->settings->name,
|
||||
'billing_address' => $this->settings->address,
|
||||
'billing_state' => $this->settings->state,
|
||||
'billing_city' => $this->settings->city,
|
||||
'billing_postal_code' => $this->settings->postal_code,
|
||||
'billing_country' => $this->settings->country,
|
||||
'billing_phone_number' => $this->settings->phone_number,
|
||||
'timezone' => $this->settings->timezone
|
||||
]
|
||||
]
|
||||
],
|
||||
'storage' => [
|
||||
'data' => [
|
||||
'id' => '1',
|
||||
'type' => 'storage',
|
||||
'attributes' => $this->storage
|
||||
]
|
||||
],
|
||||
'favourites' => [
|
||||
'data' => [
|
||||
'id' => '1',
|
||||
'type' => 'folders_favourite',
|
||||
'attributes' => [
|
||||
'folders' => $this->favouriteFolders->makeHidden(['pivot'])
|
||||
],
|
||||
],
|
||||
],
|
||||
'tree' => [
|
||||
'data' => [
|
||||
'id' => '1',
|
||||
'type' => 'folders_tree',
|
||||
'attributes' => [
|
||||
'folders' => $this->folder_tree
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user