Skip to content

Commit

Permalink
Merge pull request #319 from smatyas/recaptcha-api-url-change
Browse files Browse the repository at this point in the history
recaptcha api url changes
  • Loading branch information
bamarni committed Mar 23, 2014
2 parents 1a84702 + 5f28794 commit 03c9308
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions DependencyInjection/Configuration.php
Expand Up @@ -139,9 +139,9 @@ private function addRecaptcha(ArrayNodeDefinition $rootNode)
->canBeUnset()
->addDefaultsIfNotSet()
->children()
->scalarNode('host')->defaultValue('api-verify.recaptcha.net')->end()
->scalarNode('host')->defaultValue('www.google.com')->end()
->scalarNode('port')->defaultValue(80)->end()
->scalarNode('path')->defaultValue('/verify')->end()
->scalarNode('path')->defaultValue('/recaptcha/api/verify')->end()
->scalarNode('timeout')->defaultValue(10)->end()
->scalarNode('code')->defaultNull()->end()
->arrayNode('proxy')
Expand All @@ -156,15 +156,15 @@ private function addRecaptcha(ArrayNodeDefinition $rootNode)
->variableNode('configs')->defaultValue(array())->end()
/* TO BE DEPRECATED */
->scalarNode('code')->defaultNull()->end()
->scalarNode('server_url')->defaultValue('http://api.recaptcha.net')->end()
->scalarNode('server_url')->defaultValue('http://www.google.com/recaptcha/api')->end()
->arrayNode('ssl')
->canBeUnset()
->treatNullLike(array('use' => true))
->treatTrueLike(array('use' => true))
->children()
->booleanNode('use')->defaultTrue()->end()
->scalarNode('server_url')
->defaultValue('https://api-secure.recaptcha.net')
->defaultValue('https://www.google.com/recaptcha/api')
->end()
->end()
->end()
Expand Down
4 changes: 2 additions & 2 deletions Resources/doc/recaptcha/default.md
Expand Up @@ -8,9 +8,9 @@ genenu_form:
public_key: ~ # Required
private_key: ~ # Required
validation:
host: api-verify.recaptcha.net
host: www.google.com
port: 80
path: /verify
path: /recaptcha/api/verify
timeout: 10
code: ~
proxy: ~
Expand Down
12 changes: 6 additions & 6 deletions Tests/Form/Core/Type/ReCaptchaTypeTest.php
Expand Up @@ -27,13 +27,13 @@ public function testDefaultConfigs()
$view = $form->createView();

$this->assertEquals('publicKey', $view->vars['public_key']);
$this->assertEquals('http://api.recaptcha.net', $view->vars['server']);
$this->assertEquals('http://www.google.com/recaptcha/api', $view->vars['server']);
$this->assertEquals(array('lang' => 'en'), $view->vars['configs']);

$this->assertEquals(array(
'host' => 'api-verify.recaptcha.net',
'host' => 'www.google.com',
'port' => 80,
'path' => '/verify',
'path' => '/recaptcha/api/verify',
'timeout' => 10,
), $form->getConfig()->getAttribute('option_validator'));
}
Expand All @@ -52,9 +52,9 @@ public function testConfigs()
$this->assertEquals(array('theme' => 'blackglass', 'lang' => 'en'), $view->vars['configs']);

$this->assertEquals(array(
'host' => 'api-verify.recaptcha.net',
'host' => 'www.google.com',
'port' => 80,
'path' => '/verify',
'path' => '/recaptcha/api/verify',
'timeout' => 30
), $form->getConfig()->getAttribute('option_validator'));
}
Expand All @@ -68,7 +68,7 @@ public function testCode($code, $isValid)
$form = $this->factory->create(new ReCaptchaType(
new ReCaptchaValidator($request, 'privateKey', array('code' => '1234')),
'publicKey',
'http://api.recaptcha.net',
'http://www.google.com/recaptcha/api',
array()
));

Expand Down
6 changes: 3 additions & 3 deletions Tests/Form/Extension/TypeExtensionTest.php
Expand Up @@ -79,13 +79,13 @@ protected function loadTypes()
$this->request,
'privateKey',
array(
'host' => 'api-verify.recaptcha.net',
'host' => 'www.google.com',
'port' => 80,
'path' => '/verify',
'path' => '/recaptcha/api/verify',
'timeout' => 10
)),
'publicKey',
'http://api.recaptcha.net',
'http://www.google.com/recaptcha/api',
array()),
new Form\JQuery\Type\ImageType('medium', array(
'small' => array(100, 100),
Expand Down

0 comments on commit 03c9308

Please sign in to comment.