diff --git a/docs/en/migration-from-the-authcomponent.rst b/docs/en/migration-from-the-authcomponent.rst index 5d75c9fc..ab7d3b31 100644 --- a/docs/en/migration-from-the-authcomponent.rst +++ b/docs/en/migration-from-the-authcomponent.rst @@ -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 @@ -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'); diff --git a/docs/fr/migration-from-the-authcomponent.rst b/docs/fr/migration-from-the-authcomponent.rst index 48f361bd..013ef7b7 100644 --- a/docs/fr/migration-from-the-authcomponent.rst +++ b/docs/fr/migration-from-the-authcomponent.rst @@ -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 @@ -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'); diff --git a/docs/ja/migration-from-the-authcomponent.rst b/docs/ja/migration-from-the-authcomponent.rst index 6228d9db..328990f7 100644 --- a/docs/ja/migration-from-the-authcomponent.rst +++ b/docs/ja/migration-from-the-authcomponent.rst @@ -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 @@ -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');