\VisualCaptchaComponent

VisualCaptcha Component

画像認証画面へのリダイレクト、認証処理を行います。
利用方式、対象アクション、認証要素key名称を指定してください。

利用方式
対象アクション

Summary

Methods
Properties
Constants
initialize()
startup()
getReturnUrl()
check()
generate()
image()
audio()
$operationType
$controller
$targetAction
$assetPath
$imageField
$audioField
$visualCaptchaAction
OPERATION_REDIRECT
OPERATION_EMBEDDING
OPERATION_NONE
No protected methods found
No protected properties found
N/A
__utilReadJSON()
No private properties found
N/A

Constants

OPERATION_REDIRECT

OPERATION_REDIRECT

captcha operation type

OPERATION_EMBEDDING

OPERATION_EMBEDDING

OPERATION_NONE

OPERATION_NONE

Properties

$operationType

$operationType : string

利用方式

  • OPERATION_REDIRECT
    切り替わり方式
    認証が必要な画面を表示する前に、画像認証画面が自動的に表示される方式です。
    画像認証に成功した後、認証が必要な画面を表示します。
    この場合、画像認証画面、認証Postを当プラグインが処理するため、、 利用プラグインは、VisualCaptchaComponentを設定するのみです。
    対象アクション名も指定してください。

サンプルコード

public $components = array(
    'VisualCaptcha.VisualCaptcha' => array(
        'operationType' => VisualCaptchaComponent::OPERATION_REDIRECT,
        'targetAction' => 'answer',
        'identifyKey' => 'Questionnaire'???
    )
)
  • OPERATION_EMBEDDING
    埋め込み方式(デフォルト)
    認証が必要な画面に、画像認証パーツを埋め込む方式です。
    切り替わり方式だと画像認証画面だけが表示されることになるが、埋め込み方式は認証が必要な画面の任意の場所に埋め込めます。
    この場合は、VisualCaptchaComponentを設定、viewファイルへのvisual_captcha.ctpの埋め込み、 正しい回答がされたかのチェックを行う必要があります。

サンプルコード

Controller
public $components = array(
    'VisualCaptcha.VisualCaptcha' => array(
        'operationType' => VisualCaptchaComponent::OPERATION_EMBEDDING,
        'identifyKey' => 'VisualCaptcha'
    )
)
View
<?php
    echo $this->element(
        'VisualCaptcha.visual_captcha', array(
            'identifyKey' => 'VisualCaptcha'
        )
); ?>

Type

string

$controller

$controller : object

call controller w/ associations

Type

object

$targetAction

$targetAction : string

visual captcha redirect target controller action

Type

string

$assetPath

$assetPath : string

assetPath /r associations

Type

string

$imageField

$imageField : string

imageField Answer /r associations

Type

string

$audioField

$audioField : string

audioField Answer /r associations

Type

string

$visualCaptchaAction

$visualCaptchaAction : array

切り替えタイプのときの切り替え先画面のURLデフォルト値 デフォルトの画像認証画面では困る場合はこの構造データを変更してください

Type

array

Methods

initialize()

initialize(\Controller  $controller) : void

Called before the Controller::beforeFilter().

Parameters

\Controller $controller

Controller with components to initialize

startup()

startup(\Controller  $controller) : void

Called after the Controller::beforeFilter() and before the controller action

Parameters

\Controller $controller

Controller with components to startup

Throws

\ForbiddenException

getReturnUrl()

getReturnUrl() : string

getReturnUrl get return screen url

Returns

string

check()

check() : boolean

check input response

Returns

boolean

generate()

generate(integer  $count = 5) : string

generate visual captcha data and return it

Parameters

integer $count

display image count

Returns

string

image()

image(integer  $index) : string

generate visual captcha image data and return it

Parameters

integer $index

display image index

Returns

string

audio()

audio() : \streaming

generate audio captcha data and return it

Returns

\streaming —

data

__utilReadJSON()

__utilReadJSON(string  $filePath) : object

Read input file as JSON

Parameters

string $filePath

json file path

Returns

object