mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-27 18:40:39 +00:00
UI improvements part 2
This commit is contained in:
@@ -38,7 +38,7 @@ class AuthServiceProvider extends ServiceProvider
|
||||
Gate::define($ability, function (?User $user, File | Folder $item, ?Share $share) use ($ability) {
|
||||
// If share link exist, then check share access
|
||||
if ($share) {
|
||||
return $this->share_guard($share, $item);
|
||||
return $this->shareGuard($share, $item);
|
||||
}
|
||||
|
||||
// Check user owner status
|
||||
@@ -47,7 +47,7 @@ class AuthServiceProvider extends ServiceProvider
|
||||
}
|
||||
|
||||
// Check team member ability to access into requested item
|
||||
return $this->team_member_guard($item, $user, $ability);
|
||||
return $this->teamMemberGuard($item, $user, $ability);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -58,9 +58,9 @@ class AuthServiceProvider extends ServiceProvider
|
||||
});
|
||||
}
|
||||
|
||||
private function share_guard(Share $share, Folder | File $item): bool
|
||||
private function shareGuard(Share $share, Folder | File $item): bool
|
||||
{
|
||||
if (! $share->is_protected && $share->user_id === $item->user_id) {
|
||||
if (! $share->is_protected) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ class AuthServiceProvider extends ServiceProvider
|
||||
return $share->user_id === $item->user_id;
|
||||
}
|
||||
|
||||
private function team_member_guard(Folder | File $item, ?User $user, $ability): bool
|
||||
private function teamMemberGuard(Folder | File $item, ?User $user, $ability): bool
|
||||
{
|
||||
$teamFolder = $item->getLatestParent();
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ namespace App\Users\Requests;
|
||||
use App\Users\Rules\EmailProvider;
|
||||
use App\Users\Rules\ReCaptchaRules;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use App\Users\Rules\PasswordValidationRules;
|
||||
use Illuminate\Validation\Rules\RequiredIf;
|
||||
use App\Users\Rules\PasswordValidationRules;
|
||||
|
||||
class RegisterUserRequest extends FormRequest
|
||||
{
|
||||
@@ -29,10 +29,10 @@ class RegisterUserRequest extends FormRequest
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'email' => ['required', 'string', 'email', 'max:255', 'unique:users,email', new EmailProvider],
|
||||
'name' => 'required|string|max:255',
|
||||
'password' => $this->passwordRules(),
|
||||
'reCaptcha' => [new RequiredIf(get_settings('allowed_recaptcha') == 1), 'string', app(ReCaptchaRules::class)]
|
||||
'email' => ['required', 'string', 'email', 'max:255', 'unique:users,email', new EmailProvider],
|
||||
'name' => 'required|string|max:255',
|
||||
'password' => $this->passwordRules(),
|
||||
'reCaptcha' => [new RequiredIf(get_settings('allowed_recaptcha') == 1), 'string', app(ReCaptchaRules::class)],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Users\Rules;
|
||||
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use Illuminate\Contracts\Validation\Rule;
|
||||
|
||||
@@ -17,16 +16,17 @@ class ReCaptchaRules implements Rule
|
||||
public function passes($attribute, $value)
|
||||
{
|
||||
$client = new Client();
|
||||
$response = $client->post('https://www.google.com/recaptcha/api/siteverify',
|
||||
$response = $client->post(
|
||||
'https://www.google.com/recaptcha/api/siteverify',
|
||||
[
|
||||
'form_params' => [
|
||||
'secret' => env('RECAPTCHA_CLIENT_SECRET', false),
|
||||
'secret' => env('RECAPTCHA_CLIENT_SECRET', false),
|
||||
'remoteip' => request()->getClientIp(),
|
||||
'response' => $value
|
||||
]
|
||||
'response' => $value,
|
||||
],
|
||||
]
|
||||
);
|
||||
$body = json_decode((string)$response->getBody());
|
||||
$body = json_decode((string) $response->getBody());
|
||||
|
||||
return $body->success;
|
||||
}
|
||||
@@ -35,4 +35,4 @@ class ReCaptchaRules implements Rule
|
||||
{
|
||||
return 'Are you a robot?';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user