Skip to content
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
8 changes: 5 additions & 3 deletions docs/en/migration-from-the-authcomponent.rst
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ this exception into a redirect using the ``unauthenticatedRedirect``
when configuring the ``AuthenticationService``.

You can also pass the current request target URI as a query parameter
using the ``queryParam`` option::
using the ``queryParam`` option. Note that the redirect parameter is only
appended for GET requests to prevent redirecting to non-GET actions after login::

// In the getAuthenticationService() method of your src/Application.php

Expand Down Expand Up @@ -308,8 +309,9 @@ leveraging the ``AuthenticationService``::
if ($result->isValid()) {
$authService = $this->Authentication->getAuthenticationService();

// Assuming you are using the `Password` identifier.
if ($authService->identifiers()->get('Password')->needsPasswordRehash()) {
// Get the identifier that was used for authentication.
$identifier = $authService->getIdentificationProvider();
if ($identifier !== null && $identifier->needsPasswordRehash()) {
// Rehash happens on save.
$user = $this->Users->get($this->Authentication->getIdentityData('id'));
$user->password = $this->request->getData('password');
Expand Down
9 changes: 6 additions & 3 deletions docs/fr/migration-from-the-authcomponent.rst
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,9 @@ pouvez convertir cette exception en redirection en utilisant
l'\ ``AuthenticationService``.

Vous pouvez aussi passer l'URI ciblée par la requête en cours en tant que
paramètre dans la query string de la redirection avec l'option ``queryParam``::
paramètre dans la query string de la redirection avec l'option ``queryParam``.
Notez que le paramètre de redirection n'est ajouté que pour les requêtes GET afin
d'éviter de rediriger vers des actions non-GET après la connexion::

// Dans la méthode getAuthenticationService() de votre src/Application.php

Expand Down Expand Up @@ -303,8 +305,9 @@ parti de l'\ ``AuthenticationService``::
if ($result->isValid()) {
$authService = $this->Authentication->getAuthenticationService();

// En supposant que vous utilisez l'identificateur `Password`.
if ($authService->identifiers()->get('Password')->needsPasswordRehash()) {
// Obtenir l'identificateur qui a été utilisé pour l'authentification.
$identifier = $authService->getIdentificationProvider();
if ($identifier !== null && $identifier->needsPasswordRehash()) {
// Le re-hachage se produit lors de la sauvegarde.
$user = $this->Users->get($this->Authentication->getIdentityData('id'));
$user->password = $this->request->getData('password');
Expand Down
8 changes: 5 additions & 3 deletions docs/ja/migration-from-the-authcomponent.rst
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ this exception into a redirect using the ``unauthenticatedRedirect``
when configuring the ``AuthenticationService``.

You can also pass the current request target URI as a query parameter
using the ``queryParam`` option::
using the ``queryParam`` option. Note that the redirect parameter is only
appended for GET requests to prevent redirecting to non-GET actions after login::

// In the getAuthenticationService() method of your src/Application.php

Expand Down Expand Up @@ -273,8 +274,9 @@ using the ``queryParam`` option::
if ($result->isValid()) {
$authService = $this->Authentication->getAuthenticationService();

// 識別子に `Password` を使用していると仮定します。
if ($authService->identifiers()->get('Password')->needsPasswordRehash()) {
// 認証に使用された識別子を取得します。
$identifier = $authService->getIdentificationProvider();
if ($identifier !== null && $identifier->needsPasswordRehash()) {
// セーブ時にリハッシュが発生します。
$user = $this->Users->get($this->Authentication->getIdentityData('id'));
$user->password = $this->request->getData('password');
Expand Down