Skip to content
This repository has been archived by the owner on Nov 3, 2024. It is now read-only.

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
i-jurij committed Oct 10, 2024
1 parent 24d8f97 commit 92c3c88
Show file tree
Hide file tree
Showing 118 changed files with 2,351 additions and 7,732 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=first_lavarel
DB_DATABASE=first_laravel
DB_USERNAME=root
DB_PASSWORD=

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/public/hot
/public/storage
/storage/*.key
/storage/framework
/vendor
.env
.env.backup
Expand Down
1 change: 1 addition & 0 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Require all denied
17 changes: 12 additions & 5 deletions app/Http/Requests/Auth/LoginRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ public function authenticate(): void
{
$this->ensureIsNotRateLimited();

if (!Auth::attempt($this->only('email', 'password'), $this->boolean('remember'))) {
if (! Auth::attempt($this->only('email', 'password'), $this->boolean('remember'))) {
RateLimiter::hit($this->throttleKey());

throw ValidationException::withMessages(['email' => trans('auth.failed')]);
throw ValidationException::withMessages([
'email' => trans('auth.failed'),
]);
}

RateLimiter::clear($this->throttleKey());
Expand All @@ -57,22 +59,27 @@ public function authenticate(): void
*/
public function ensureIsNotRateLimited(): void
{
if (!RateLimiter::tooManyAttempts($this->throttleKey(), 5)) {
if (! RateLimiter::tooManyAttempts($this->throttleKey(), 5)) {
return;
}

event(new Lockout($this));

$seconds = RateLimiter::availableIn($this->throttleKey());

throw ValidationException::withMessages(['email' => trans('auth.throttle', ['seconds' => $seconds, 'minutes' => ceil($seconds / 60)])]);
throw ValidationException::withMessages([
'email' => trans('auth.throttle', [
'seconds' => $seconds,
'minutes' => ceil($seconds / 60),
]),
]);
}

/**
* Get the rate limiting throttle key for the request.
*/
public function throttleKey(): string
{
return Str::transliterate(Str::lower($this->input('email')).'|'.$this->ip());
return Str::transliterate(Str::lower($this->string('email')).'|'.$this->ip());
}
}
5 changes: 2 additions & 3 deletions app/Http/Requests/ProfileUpdateRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ class ProfileUpdateRequest extends FormRequest
public function rules(): array
{
return [
'name' => ['string', 'max:255'],
'email' => ['email', 'max:255', Rule::unique(User::class)->ignore($this->user()->id)],
'status' => ['string', 'max:255'],
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'lowercase', 'email', 'max:255', Rule::unique(User::class)->ignore($this->user()->id)],
];
}
}
12 changes: 3 additions & 9 deletions config/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
use Illuminate\Support\Str;

return [

/*
|--------------------------------------------------------------------------
| Default Database Connection Name
Expand Down Expand Up @@ -34,7 +33,6 @@
*/

'connections' => [

'sqlite' => [
'driver' => 'sqlite',
'url' => env('DATABASE_URL'),
Expand All @@ -48,9 +46,9 @@
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'database' => env('DB_DATABASE', 'first_laravel'),
'username' => env('DB_USERNAME', 'first_laravel'),
'password' => env('DB_PASSWORD', 'first_laravel'),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
Expand Down Expand Up @@ -92,7 +90,6 @@
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
],

],

/*
Expand Down Expand Up @@ -120,7 +117,6 @@
*/

'redis' => [

'client' => env('REDIS_CLIENT', 'phpredis'),

'options' => [
Expand All @@ -145,7 +141,5 @@
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
],

],

];
Loading

0 comments on commit 92c3c88

Please sign in to comment.