Skip to content

Commit c8fc5cb

Browse files
authored
Merge pull request #747 from cakephp/docs
Fix up docs.
2 parents 86b48f2 + 50f638e commit c8fc5cb

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

docs/en/migration-from-the-authcomponent.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,8 @@ this exception into a redirect using the ``unauthenticatedRedirect``
263263
when configuring the ``AuthenticationService``.
264264

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

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

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

311-
// Assuming you are using the `Password` identifier.
312-
if ($authService->identifiers()->get('Password')->needsPasswordRehash()) {
312+
// Get the identifier that was used for authentication.
313+
$identifier = $authService->getIdentificationProvider();
314+
if ($identifier !== null && $identifier->needsPasswordRehash()) {
313315
// Rehash happens on save.
314316
$user = $this->Users->get($this->Authentication->getIdentityData('id'));
315317
$user->password = $this->request->getData('password');

docs/fr/migration-from-the-authcomponent.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,9 @@ pouvez convertir cette exception en redirection en utilisant
257257
l'\ ``AuthenticationService``.
258258

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

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

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

306-
// En supposant que vous utilisez l'identificateur `Password`.
307-
if ($authService->identifiers()->get('Password')->needsPasswordRehash()) {
308+
// Obtenir l'identificateur qui a été utilisé pour l'authentification.
309+
$identifier = $authService->getIdentificationProvider();
310+
if ($identifier !== null && $identifier->needsPasswordRehash()) {
308311
// Le re-hachage se produit lors de la sauvegarde.
309312
$user = $this->Users->get($this->Authentication->getIdentityData('id'));
310313
$user->password = $this->request->getData('password');

docs/ja/migration-from-the-authcomponent.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,8 @@ this exception into a redirect using the ``unauthenticatedRedirect``
229229
when configuring the ``AuthenticationService``.
230230

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

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

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

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

0 commit comments

Comments
 (0)