-
Notifications
You must be signed in to change notification settings - Fork 295
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
Feature/magic link #1116
base: 15.next-cake5
Are you sure you want to change the base?
Feature/magic link #1116
Conversation
3b648c4
to
8117aed
Compare
8117aed
to
373112b
Compare
@@ -13,7 +13,7 @@ jobs: | |||
strategy: | |||
fail-fast: false | |||
matrix: | |||
php-version: ['8.1', '8.2', '8.3'] | |||
php-version: ['8.2', '8.3', '8.4'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we'll need to keep 8.1 to max compatibility with cakephp 5
|
||
ReCaptcha | ||
---------------- | ||
ReCaptcha will be added automatically to the request login link form if `Users.reCaptcha.login` is enabled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add We strongly recommend having ReCaptcha enabled, because it's a public form that could be targeted by an attacker to send multiple requests
@@ -41,6 +41,7 @@ trait PasswordManagementTrait | |||
*/ | |||
public function changePassword($id = null) | |||
{ | |||
/** @var \CakeDC\Users\Model\Entity\User $user */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might not be a User entity if the user has the Users table override
@@ -42,6 +42,7 @@ public function profile($id = null) | |||
try { | |||
$appContain = (array)Configure::read('Auth.Profile.contain'); | |||
$socialContain = Configure::read('Users.Social.login') ? ['SocialAccounts'] : []; | |||
/** @var \CakeDC\Users\Model\Entity\User $user */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might not be a User entity if the user has the Users table override
public function sendLoginLink(string $name): void | ||
{ | ||
$table = $this->table(); | ||
/** @var \CakeDC\Users\Model\Entity\User|null $user */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might not be a User entity if the user has the Users table override
], [ | ||
'id' => $user->id, | ||
]); | ||
/** @var \CakeDC\Users\Model\Entity\User|null $user */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might not be a User entity if the user has the Users table override
*/ | ||
public function requestTokenSend(string $username): void | ||
{ | ||
/** @var \CakeDC\Users\Model\Entity\User|null $user */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might not be a User entity if the user has the Users table override
->find('byOneTimeToken', ['token' => $token]) | ||
->first(); | ||
|
||
if ($user && ($user->login_token_date >= DateTime::now()->subSeconds($lifeTime))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
transactional needed?
} | ||
|
||
return $query->where([ | ||
'OR' => [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the OR is not needed
@@ -73,7 +73,9 @@ public function __construct(ServerRequest $request, ?UsersTable $usersTable = nu | |||
$userSession = $request->getSession()->read('Webauthn2fa.User'); | |||
$usersTable = $usersTable ?? TableRegistry::getTableLocator() | |||
->get($userSession->getSource()); | |||
$this->user = $usersTable->get($userSession->id); | |||
/** @var \CakeDC\Users\Model\Entity\User $user */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might not be a User entity if the user has the Users table override
No description provided.