Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/LP-3-Login' into LP-3-Login
Browse files Browse the repository at this point in the history
  • Loading branch information
hafijul233 committed Oct 1, 2023
2 parents d37e4a9 + b40fedb commit 0726087
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/Http/Controllers/AuthenticatedSessionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ public function store(LoginRequest $request): LoginResource|JsonResponse
if ($attemptUser->wrong_password > config('fintech.auth.threshold.password', 10)) {

\Fintech\Auth\Facades\Auth::user()->update($attemptUser->id, [
'status' => UserStatus::InActive->value
'status' => UserStatus::InActive->value,
]);

return $this->failed(__('auth::messages.lockup'));
}

if (!Hash::check($request->input('password'), $attemptUser->password)) {
if (! Hash::check($request->input('password'), $attemptUser->password)) {

$request->hitRateLimited();
$wrongPasswordCount = $attemptUser->wrong_password + 1;
Expand All @@ -56,7 +56,7 @@ public function store(LoginRequest $request): LoginResource|JsonResponse

return $this->failed(__('auth::messages.warning', [
'attempt' => $wrongPasswordCount,
'threshold' => config('fintech.auth.threshold.password', 10)
'threshold' => config('fintech.auth.threshold.password', 10),
]));
}

Expand All @@ -70,7 +70,7 @@ public function store(LoginRequest $request): LoginResource|JsonResponse

Auth::login($attemptUser);

Auth::user()->tokens->each(fn($token) => $token->delete());
Auth::user()->tokens->each(fn ($token) => $token->delete());

Check failure on line 73 in src/Http/Controllers/AuthenticatedSessionController.php

View workflow job for this annotation

GitHub Actions / phpstan

Access to an undefined property Illuminate\Foundation\Auth\User::$tokens.

return new LoginResource(Auth::user());
}
Expand Down
2 changes: 1 addition & 1 deletion src/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class User extends Authenticatable implements Auditable
protected $casts = [
'email_verified_at' => 'datetime',
'mobile_verified_at' => 'datetime',
'wrong_password' => 'integer'
'wrong_password' => 'integer',
];

protected $attributes = [
Expand Down
4 changes: 2 additions & 2 deletions src/Services/UserService.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ public function read($id)

public function update($id, array $inputs = [])
{
if (isset($inputs['password']) && !empty($inputs['password'])) {
if (isset($inputs['password']) && ! empty($inputs['password'])) {
$inputs['password'] = Hash::make($inputs['password']);
}
if (isset($inputs['pin']) && !empty($inputs['pin'])) {
if (isset($inputs['pin']) && ! empty($inputs['pin'])) {
$inputs['pin'] = Hash::make($inputs['pin']);
}

Expand Down

0 comments on commit 0726087

Please sign in to comment.