legacy-knowledge-base
公開されました Jul. 2, 2025

Liferay Portal 6.2 EE で reCAPTCHA v2 を設定する。

written-by

Joel Garman

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

legacy-article

learn-legacy-article-disclaimer-text

本記事では、Liferay Portal 6.2でreCAPTCHA version 2を設定する方法を概説します。 Googleはsunsetting reCAPTCHA v1で、2018年3月現在、すべてのv1 APIコールが動作しなくなっています。

この「End of Life」の発表を受けて、Liferay Portal 6.2 EEは LPS-55941 (LPE-16253) でアップデートされ、reCAPTCHA version 2を搭載しました。 Liferay Digital Enterpriseでは、すでにreCAPTCHA v2を利用しています。

解決策

Liferay Portal 6.2 EEでreCAPTCHA v2を活用するために

  1. Fix Pack Portal-164のインストール

  2. サーバーを停止し、fixpack portal-164以降をインストールします。 サーバーを再起動しないでください。

  3. 本番サイトの場合、Googleに特定のドメインの公開鍵と秘密鍵をリクエストします。 https://www.google.com/recaptcha/admin#list

  4. 本番環境でない場合は、GoogleのreCAPTCHAサポートサイトにアクセスしてテストキーを受け取ってください: https://developers.google.com/recaptcha/docs/faq

  5. 既存の portal-ext.properties ファイルをバックアップします。

  6. 手順2または3のreCAPTCHAエンジンとGoogle提供のキーを利用するためにportal-ext.propertiesを修正する(captcha.engine.recaptcha.url.*プロパティはアップグレードの一部として修正され、参考のために以下に含まれています)。 これらのプロパティは、ユーザーによる設定を必要としません)。

       # Set the engine used to generate captchas. reCAPTCHA uses an external
    
       # service that must be configured independently but provides an audible
    
       # alternative which makes the captcha accessible to the visually impaired.
    
       # See https://www.google.com/recaptcha/admin/create for details.
    
       #
    
       captcha.engine.impl=com.liferay.portal.captcha.recaptcha.ReCaptchaImpl
    
       #
    
       # reCAPTCHA
    
       #
    
       captcha.engine.recaptcha.key.private={enter-your-private-key-here}
    
       captcha.engine.recaptcha.key.public={enter-your-public-key-here}
    
       captcha.engine.recaptcha.url.script=https://www.google.com/recaptcha/api.js
    
       captcha.engine.recaptcha.url.noscript=https://www.google.com/recaptcha/api/fallback?k=
    
       captcha.engine.recaptcha.url.verify=https://www.google.com/recaptcha/api/siteverify
    
  7. アカウント作成、パスワードリセット、メッセージボードのアクティビティにcaptchaが必要な場合は、portal-extを変更して必要なcaptchaチェックを構成します。 デフォルトのポータルプロパティを以下に示しますが、ニーズに合わせて変更してください:
       #
    
       # Set the maximum number of captcha checks per portlet session. Set this
    
       # value to 0 to always check. Set this value to a number less than 0 to
    
       # never check. Unauthenticated users will always be checked on every request
    
       # if captcha checks is enabled.
    
       #
    
       captcha.max.challenges=1
    
    
       #
    
       # Set whether or not to use captcha checks for the following actions.
    
       #
    
       captcha.check.portal.create_account=true
    
       captcha.check.portal.send_password=true
    
       captcha.check.portlet.message_boards.edit_category=false
    
       captcha.check.portlet.message_boards.edit_message=false
  8. portal-ext ファイルを保存し、サーバーを再起動します。

  9. fixpackのインストール後、初めてreCAPTCHAリクエストに対応する場合は、ブラウザのキャッシュをクリアして、リクエストが正しく機能するようにする必要があります。

注)Fix Pack Portal-164をアンインストールする必要がある場合は、portal-extの旧バージョンの復元も必要です。 v1のreCAPTCHAキーは、reCAPTCHAリクエストが正しく機能するために、手順6で追加したv2のreCAPTCHAキーと置き換える必要があります。

did-this-article-resolve-your-issue

legacy-knowledge-base