Skip to content

Commit

Permalink
Fix minor bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
eliseekn committed Nov 2, 2023
1 parent 58729ef commit 01b7569
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/Database/Factories/TokenFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function data(): array
return [
'email' => faker()->unique()->email,
'value' => generate_token(),
'expire' => carbon()->addHour()->toDateTimeString(),
'expires_at' => carbon()->addHour()->toDateTimeString(),
'description' => TokenDescription::PASSWORD_RESET_TOKEN->value
];
}
Expand Down
2 changes: 1 addition & 1 deletion app/Database/Migrations/TokensTable_20210403034738.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function create(): void
->addPrimaryKey()
->addString('email')
->addString('value')->unique()
->addDateTime('expire_at')->nullable()
->addDateTime('expires_at')->nullable()
->addString('description')->default(TokenDescription::PASSWORD_RESET_TOKEN->value)
->addTimestamps()
->run();
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Auth/EmailVerificationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function notify(): void
(new Token())->create([
'email'=> $this->request->queries('email'),
'value' => $tokenValue,
'expire' => carbon()->addDay()->toDateTimeString(),
'expires_at' => carbon()->addDay()->toDateTimeString(),
'description' => TokenDescription::EMAIL_VERIFICATION_TOKEN->value
]);
}
Expand All @@ -58,7 +58,7 @@ public function verify(UpdateAction $action): void
$this->response(__('invalid_password_reset_link'), 400);
}

if (carbon($token->getAttribute('expire_at'))->lt(carbon())) {
if (carbon($token->getAttribute('expires_at'))->lt(carbon())) {
$this->response(__('expired_password_reset_link'), 400);
}

Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Auth/ForgotPasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function notify(): void
(new Token())->create([
'email'=> $this->request->inputs('email'),
'value' => $tokenValue,
'expire' => carbon()->addHour()->toDateTimeString(),
'expires_at' => carbon()->addHour()->toDateTimeString(),
'description' => TokenDescription::PASSWORD_RESET_TOKEN->value
]);
}
Expand All @@ -58,7 +58,7 @@ public function reset(): void
$this->response(__('invalid_password_reset_link'), 400);
}

if (carbon($token->getAttribute('expire_at'))->lt(carbon())) {
if (carbon($token->getAttribute('expires_at'))->lt(carbon())) {
$this->response(__('expired_password_reset_link'), 400);
}

Expand Down
4 changes: 2 additions & 2 deletions core/Http/Validator/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public function __construct(

GUMP::add_validator(
$rule->name,
$rule->errorMessage,
$rule->rule(...)
$rule->rule(...),
$rule->errorMessage
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/Support/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static function attempt(Response $response, Request $request): bool
}

session()->forget(['auth_attempts', 'auth_attempts_timeout']);
session()->create('user', $user->toArray());
session()->create('user', $user->getAttribute());

if ($request->hasInput('remember')) {
cookies()->create('user', $user->getAttribute('email'), 3600 * 24 * 365);
Expand Down

0 comments on commit 01b7569

Please sign in to comment.