Skip to content

Commit

Permalink
Fix lonnieezell#324: field type is integer
Browse files Browse the repository at this point in the history
As PostgreSQL is strongly typed and doesn't have an implicit cast between
booleans and integers, we strictly use integers for the force_pass_reset
field.
  • Loading branch information
xlii-chl committed Feb 26, 2022
1 parent 6d7b7c4 commit ae37b5a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Controllers/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function attemptLogin()
}

// Is the user being forced to reset their password?
if ($this->auth->user()->force_pass_reset === true)
if ($this->auth->user()->force_pass_reset)
{
return redirect()->to(route_to('reset-password') .'?token='. $this->auth->user()->reset_hash)->withCookies();
}
Expand Down Expand Up @@ -345,7 +345,7 @@ public function attemptReset()
$user->reset_hash = null;
$user->reset_at = date('Y-m-d H:i:s');
$user->reset_expires = null;
$user->force_pass_reset = false;
$user->force_pass_reset = 0;
$users->save($user);

return redirect()->route('login')->with('message', lang('Auth.resetSuccess'));
Expand Down
2 changes: 1 addition & 1 deletion tests/_support/AuthTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ protected function createUser(array $info = [])
'email' => '[email protected]',
'username' => 'Fred',
'password' => 'secret',
'force_pass_reset' => false,
'force_pass_reset' => 0,
];
$info = array_merge($defaults, $info);

Expand Down

0 comments on commit ae37b5a

Please sign in to comment.