Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
|
Public Member Functions | |
__construct (\Magento\Framework\Session\SessionManagerInterface $session, \Magento\Captcha\Helper\Data $captchaData, \Magento\Captcha\Model\ResourceModel\LogFactory $resLogFactory, $formId) | |
getBlockName () | |
isRequired ($login=null) | |
isShownToLoggedInUser () | |
isCaseSensitive () | |
getFont () | |
getExpiration () | |
getTimeout () | |
getImgDir () | |
getImgUrl () | |
isCorrect ($word) | |
getImgSrc () | |
logAttempt ($login) | |
setShowCaptchaInSession ($value=true) | |
getWordLen () | |
getWord () | |
![]() | |
generate () | |
Data Fields | |
const | SESSION_WORD = 'word' |
const | DEFAULT_WORD_LENGTH_FROM = 3 |
const | DEFAULT_WORD_LENGTH_TO = 5 |
Protected Member Functions | |
generateWord () | |
setWord ($word) | |
randomSize () | |
gc () | |
Protected Attributes | |
$captchaData | |
$expiration | |
$fsize = 22 | |
$formId | |
$resLogFactory | |
$keepSession = true | |
$session | |
Implementation of \Zend\Captcha\Image
@api
Definition at line 16 of file DefaultModel.php.
__construct | ( | \Magento\Framework\Session\SessionManagerInterface | $session, |
\Magento\Captcha\Helper\Data | $captchaData, | ||
\Magento\Captcha\Model\ResourceModel\LogFactory | $resLogFactory, | ||
$formId | |||
) |
\Magento\Framework\Session\SessionManagerInterface | $session | |
\Magento\Captcha\Helper\Data | $captchaData | |
ResourceModel\LogFactory | $resLogFactory | |
string | $formId |
Definition at line 88 of file DefaultModel.php.
|
protected |
Overlap of the parent method
Now deleting old captcha images make crontab script
Added SuppressWarnings since this method is declared in parent class and we can not use other method name. @SuppressWarnings(PHPMD.ShortMethodName)
Definition at line 546 of file DefaultModel.php.
|
protected |
Generate word used for captcha render
Definition at line 378 of file DefaultModel.php.
getBlockName | ( | ) |
Get Block Name
Implements CaptchaInterface.
Definition at line 117 of file DefaultModel.php.
getExpiration | ( | ) |
After this time isCorrect() is going to return FALSE even if word was guessed correctly
as "timeout" configuration parameter specifies timeout in minutes - we multiply it on 60 to set expiration in seconds
Definition at line 264 of file DefaultModel.php.
getFont | ( | ) |
Get font to use when generating captcha
Definition at line 244 of file DefaultModel.php.
getImgDir | ( | ) |
getImgSrc | ( | ) |
getImgUrl | ( | ) |
getTimeout | ( | ) |
getWord | ( | ) |
getWordLen | ( | ) |
Returns length for generating captcha word. This value may be dynamic.
Definition at line 406 of file DefaultModel.php.
isCaseSensitive | ( | ) |
Whether to respect case while checking the answer
Definition at line 234 of file DefaultModel.php.
isCorrect | ( | $word | ) |
Checks whether captcha was guessed correctly by user
string | $word |
Implements CaptchaInterface.
Definition at line 312 of file DefaultModel.php.
isRequired | ( | $login = null | ) |
Whether captcha is required to be inserted to this form
null | string | $login |
Definition at line 128 of file DefaultModel.php.
isShownToLoggedInUser | ( | ) |
Check if CAPTCHA has to be shown to logged in user on this form
Definition at line 151 of file DefaultModel.php.
logAttempt | ( | $login | ) |
Log attempt
string | $login |
Definition at line 344 of file DefaultModel.php.
|
protected |
Override function to generate less curly captcha that will not cut off
Definition at line 529 of file DefaultModel.php.
setShowCaptchaInSession | ( | $value = true | ) |
Set show_captcha flag in session
bool | $value |
Definition at line 362 of file DefaultModel.php.
|
protected |
Set captcha word
string | $word |
Definition at line 499 of file DefaultModel.php.
|
protected |
Definition at line 37 of file DefaultModel.php.
|
protected |
Definition at line 44 of file DefaultModel.php.
|
protected |
Definition at line 59 of file DefaultModel.php.
|
protected |
Definition at line 52 of file DefaultModel.php.
|
protected |
Definition at line 73 of file DefaultModel.php.
|
protected |
Definition at line 65 of file DefaultModel.php.
|
protected |
Definition at line 79 of file DefaultModel.php.
const DEFAULT_WORD_LENGTH_FROM = 3 |
Min captcha lengths default value
Definition at line 26 of file DefaultModel.php.
const DEFAULT_WORD_LENGTH_TO = 5 |
Max captcha lengths default value
Definition at line 31 of file DefaultModel.php.
const SESSION_WORD = 'word' |
Key in session for captcha code
Definition at line 21 of file DefaultModel.php.