new Captcha()
- Source:
Example
AV.Captcha.request().then(captcha => {
captcha.bind({
textInput: 'code', // the id for textInput
image: 'captcha',
verifyButton: 'verify',
}, {
success: (validateCode) => {}, // next step
error: (error) => {}, // present error.message to user
});
});
Members
captchaToken :string
- Source:
The captchaToken of the captcha.
Type:
- string
url :string
- Source:
The image url of the captcha
Type:
- string
validateToken :string
- Source:
The validateToken of the captcha.
Type:
- string
Methods
(static) request(optionsopt) → {Promise.<AV.Captcha>}
- Source:
Request a captcha
Parameters:
Name | Type | Attributes | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
<optional> |
Properties
|
Returns:
- Type
- Promise.<AV.Captcha>
bind(elementsopt, callbacksopt)
- Source:
Bind the captcha to HTMLElements. ONLY AVAILABLE in browsers.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
elements |
<optional> |
Properties
|
|||||||||||||||||
callbacks |
<optional> |
Properties
|
refresh() → {Promise.<string>}
- Source:
Refresh the captcha
Returns:
a new capcha url
- Type
- Promise.<string>
unbind()
- Source:
unbind the captcha from HTMLElements. ONLY AVAILABLE in browsers.
verify(code) → {Promise.<string>}
- Source:
Verify the captcha
Parameters:
Name | Type | Description |
---|---|---|
code |
String | The code from user input |
Returns:
validateToken if the code is valid
- Type
- Promise.<string>