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

Feature/magic link #1116

Draft
wants to merge 1 commit into
base: 15.next-cake5
Choose a base branch
from
Draft

Feature/magic link #1116

wants to merge 1 commit into from

Conversation

ajibarra
Copy link
Member

No description provided.

@ajibarra ajibarra changed the base branch from 14.next-cake5 to 15.next-cake5 February 14, 2025 05:55
@ajibarra ajibarra force-pushed the feature/magic-link branch 14 times, most recently from 3b648c4 to 8117aed Compare February 14, 2025 09:10
@@ -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']
Copy link
Member

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.
Copy link
Member

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 */
Copy link
Member

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 */
Copy link
Member

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 */
Copy link
Member

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 */
Copy link
Member

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 */
Copy link
Member

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))) {
Copy link
Member

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' => [
Copy link
Member

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 */
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants