File tree Expand file tree Collapse file tree 3 files changed +16
-9
lines changed
Expand file tree Collapse file tree 3 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -263,7 +263,8 @@ this exception into a redirect using the ``unauthenticatedRedirect``
263263when configuring the ``AuthenticationService ``.
264264
265265You 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');
Original file line number Diff line number Diff line change @@ -257,7 +257,9 @@ pouvez convertir cette exception en redirection en utilisant
257257l'\ ``AuthenticationService ``.
258258
259259Vous 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');
Original file line number Diff line number Diff line change @@ -229,7 +229,8 @@ this exception into a redirect using the ``unauthenticatedRedirect``
229229when configuring the ``AuthenticationService ``.
230230
231231You 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');
You can’t perform that action at this time.
0 commit comments