Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RememberMe: Remove unused parameter #1135

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion application/modules/user/controllers/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function indexAction()
$userMapper = new UserMapper();
$userMapper->deleteselectsdelete(($this->getConfig()->get('userdeletetime')));

$result = LoginService::factory()->perform($this->getRequest()->getPost('login_emailname'), $this->getRequest()->getPost('login_password'), (bool)$this->getRequest()->getPost('rememberMe', 0));
$result = LoginService::factory()->perform($this->getRequest()->getPost('login_emailname'), $this->getRequest()->getPost('login_password'));

if ($result->isSuccessful()) {
$cookieStolenMapper = new CookieStolenMapper();
Expand Down
5 changes: 3 additions & 2 deletions application/modules/user/service/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace Modules\User\Service;

use Ilch\Database\Exception;
use Modules\User\Mappers\User as UserMapper;
use Modules\User\Service\Login\Result as LoginResult;

Expand Down Expand Up @@ -45,10 +46,10 @@ public function __construct(UserMapper $mapper, Password $passwordService)
* Performs the Login for a User
* @param string $userNameOrEmail
* @param string $password
* @param bool $remember
* @return LoginResult
* @throws Exception
*/
public function perform(string $userNameOrEmail, string $password, bool $remember = false): LoginResult
public function perform(string $userNameOrEmail, string $password): LoginResult
{
$user = $this->mapper->getUserByEmail($userNameOrEmail);

Expand Down
6 changes: 3 additions & 3 deletions application/modules/user/service/Remember.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Remember
* @throws \Exception
* @since 2.1.38
*/
public function rememberMe($userId)
public function rememberMe(int $userId)
{
$authTokenModel = new AuthTokenModel();

Expand All @@ -36,7 +36,7 @@ public function rememberMe($userId)
$authTokenModel->setUserid($userId);
$authTokenModel->setExpires(date('Y-m-d\TH:i:s', strtotime('+30 days')));

setcookieIlch('remember', $authTokenModel->getSelector().':'.base64_encode($authenticator), strtotime('+30 days'));
setcookieIlch('remember', $authTokenModel->getSelector() . ':' . base64_encode($authenticator), strtotime('+30 days'));

$authTokenMapper = new AuthTokenMapper();
$authTokenMapper->addAuthToken($authTokenModel);
Expand Down Expand Up @@ -74,7 +74,7 @@ public function reauthenticate()
$authTokenModel->setUserid($_SESSION['user_id']);
$authTokenModel->setExpires(date('Y-m-d\TH:i:s', strtotime('+30 days')));

setcookieIlch('remember', $authTokenModel->getSelector().':'.base64_encode($authenticator), strtotime('+30 days'));
setcookieIlch('remember', $authTokenModel->getSelector() . ':' . base64_encode($authenticator), strtotime('+30 days'));

$authTokenMapper->updateAuthToken($authTokenModel);
} else {
Expand Down