Commit afe6b5d90ea229e07b51d7e8ecc7b49c1507a74d
1 parent
d09a8c8f
Exists in
contigency_plan_recaptcha
Forgot password not working yet, the rest needs
testing
Showing
2 changed files
with
21 additions
and
28 deletions
Show diff stats
index.html
| @@ -460,14 +460,7 @@ | @@ -460,14 +460,7 @@ | ||
| 460 | </div> | 460 | </div> |
| 461 | </div> | 461 | </div> |
| 462 | <div class="row"> | 462 | <div class="row"> |
| 463 | - <div id="serpro_captcha" class="captcha col-sm-12"> | ||
| 464 | - </div> | ||
| 465 | - <div class="captcha col-sm-12"> | ||
| 466 | - Digite os caracteres acima: | ||
| 467 | - </div> | ||
| 468 | - <div class="captcha col-sm-6"> | ||
| 469 | - <input type="text" name="captcha_text" id="captcha_text"> | ||
| 470 | - </div> | 463 | + <div id="g-recaptcha"></div> |
| 471 | </div> | 464 | </div> |
| 472 | <div class="row"> | 465 | <div class="row"> |
| 473 | <div class="col-sm-4"> | 466 | <div class="col-sm-4"> |
| @@ -503,13 +496,8 @@ | @@ -503,13 +496,8 @@ | ||
| 503 | <input id="user_oauth_providers" name="oauth_providers" type="hidden"> | 496 | <input id="user_oauth_providers" name="oauth_providers" type="hidden"> |
| 504 | <input id="user_oauth_signup_token" name="oauth_signup_token" type="hidden"> | 497 | <input id="user_oauth_signup_token" name="oauth_signup_token" type="hidden"> |
| 505 | </div> | 498 | </div> |
| 506 | - <div id="serpro_captcha" class="captcha col-sm-12"> | ||
| 507 | - </div> | ||
| 508 | - <div class="captcha col-sm-12"> | ||
| 509 | - Digite os caracteres acima: | ||
| 510 | - </div> | ||
| 511 | - <div class="captcha col-sm-6"> | ||
| 512 | - <input type="text" name="captcha_text" id="captcha_text"> | 499 | + <div id="captcha" class="captcha col-sm-12"> |
| 500 | + <div id="g-recaptcha"></div> | ||
| 513 | </div> | 501 | </div> |
| 514 | <div id="terms-of-use-box" class="col-sm-12"> | 502 | <div id="terms-of-use-box" class="col-sm-12"> |
| 515 | <div class="checkbox"> | 503 | <div class="checkbox"> |
| @@ -623,7 +611,7 @@ | @@ -623,7 +611,7 @@ | ||
| 623 | loadRequireJS(); | 611 | loadRequireJS(); |
| 624 | </script> | 612 | </script> |
| 625 | 613 | ||
| 626 | - <script src="http://captcha2.servicoscorporativos.serpro.gov.br/js/captcha.serpro.gov.br.js"></script> | 614 | + <script type="text/javascript" src="http://www.google.com/recaptcha/api/js/recaptcha_ajax.js" async defer></script> |
| 627 | 615 | ||
| 628 | </body> | 616 | </body> |
| 629 | 617 |
js/main.js
| @@ -70,6 +70,7 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers | @@ -70,6 +70,7 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers | ||
| 70 | } | 70 | } |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | + window.recaptchaSiteKey = recaptchaSiteKey; | ||
| 73 | 74 | ||
| 74 | var BARRA_ADDED = false; | 75 | var BARRA_ADDED = false; |
| 75 | var HIDE_BARRA_DO_GOVERNO = false; | 76 | var HIDE_BARRA_DO_GOVERNO = false; |
| @@ -891,7 +892,9 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers | @@ -891,7 +892,9 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers | ||
| 891 | reloadCaptcha: function(element) { | 892 | reloadCaptcha: function(element) { |
| 892 | var $element = $(element); | 893 | var $element = $(element); |
| 893 | if($element.data('captcha')){ | 894 | if($element.data('captcha')){ |
| 894 | - $element.data('captcha').recarregar(); | 895 | + Recaptcha.reload(); |
| 896 | + //Recaptcha.create(window.recaptchaSiteKey, $element.find('#g-recaptcha')[0], { lang : 'pt', theme: "clean", callback: Recaptcha.focus_response_field } ); | ||
| 897 | + //$element.data('captcha').recarregar(); | ||
| 895 | } | 898 | } |
| 896 | }, | 899 | }, |
| 897 | initCaptcha: function(element) { | 900 | initCaptcha: function(element) { |
| @@ -899,13 +902,15 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers | @@ -899,13 +902,15 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers | ||
| 899 | if($element.data('captcha')) return; | 902 | if($element.data('captcha')) return; |
| 900 | 903 | ||
| 901 | $element.val(''); | 904 | $element.val(''); |
| 902 | - var oCaptcha_serpro_gov_br = new captcha_serpro_gov_br(); | ||
| 903 | - $element.data('captcha', oCaptcha_serpro_gov_br); | ||
| 904 | - oCaptcha_serpro_gov_br.clienteId = serpro_captcha_clienteId; | ||
| 905 | - if(!localDevelopment) { | ||
| 906 | - oCaptcha_serpro_gov_br.url = "/captchaserpro" | ||
| 907 | - } | ||
| 908 | - oCaptcha_serpro_gov_br.criarUI(element, 'css', 'serpro_captcha_component_', Main.guid()); | 905 | + // var oCaptcha_serpro_gov_br = new captcha_serpro_gov_br(); |
| 906 | + // $element.data('captcha', oCaptcha_serpro_gov_br); | ||
| 907 | + // oCaptcha_serpro_gov_br.clienteId = serpro_captcha_clienteId; | ||
| 908 | + // if(!localDevelopment) { | ||
| 909 | + // oCaptcha_serpro_gov_br.url = "/captchaserpro" | ||
| 910 | + // } | ||
| 911 | + // oCaptcha_serpro_gov_br.criarUI(element, 'css', 'serpro_captcha_component_', Main.guid()); | ||
| 912 | + $element.find('#g-recaptcha').empty(); | ||
| 913 | + Recaptcha.create(window.recaptchaSiteKey, $element.find('#g-recaptcha')[0], { lang : 'pt', theme: "clean", callback: Recaptcha.focus_response_field } ); | ||
| 909 | }, | 914 | }, |
| 910 | computeBoxHeight: function(){ | 915 | computeBoxHeight: function(){ |
| 911 | var hPerLineOnTitle = 25; | 916 | var hPerLineOnTitle = 25; |
| @@ -1401,7 +1406,7 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers | @@ -1401,7 +1406,7 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers | ||
| 1401 | loginForm.hide(); | 1406 | loginForm.hide(); |
| 1402 | $forgotPasswordForm.show(); | 1407 | $forgotPasswordForm.show(); |
| 1403 | 1408 | ||
| 1404 | - Main.initCaptcha($forgotPasswordForm.find('#serpro_captcha')[0]); | 1409 | + Main.initCaptcha($forgotPasswordForm.find('#captcha')[0]); |
| 1405 | 1410 | ||
| 1406 | var $message = $forgotPasswordForm.find('.message'); | 1411 | var $message = $forgotPasswordForm.find('.message'); |
| 1407 | $message.html(''); | 1412 | $message.html(''); |
| @@ -1458,7 +1463,7 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers | @@ -1458,7 +1463,7 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers | ||
| 1458 | }).fail(function(data) { | 1463 | }).fail(function(data) { |
| 1459 | console.log(data.responseJSON); | 1464 | console.log(data.responseJSON); |
| 1460 | 1465 | ||
| 1461 | - Main.reloadCaptcha($forgotPasswordForm.find('#serpro_captcha')[0]); | 1466 | + Main.reloadCaptcha($forgotPasswordForm.find('#captcha')[0]); |
| 1462 | var $message = $forgotPasswordForm.find('.message'); | 1467 | var $message = $forgotPasswordForm.find('.message'); |
| 1463 | $message.html('Não foi possível requisitar a troca de senha para os dados informados.'); | 1468 | $message.html('Não foi possível requisitar a troca de senha para os dados informados.'); |
| 1464 | $message.show(); | 1469 | $message.show(); |
| @@ -1502,7 +1507,7 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers | @@ -1502,7 +1507,7 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers | ||
| 1502 | signupForm.find('#captcha_text').val(''); | 1507 | signupForm.find('#captcha_text').val(''); |
| 1503 | signupForm.find('#user_terms_accepted').removeAttr('checked'); | 1508 | signupForm.find('#user_terms_accepted').removeAttr('checked'); |
| 1504 | 1509 | ||
| 1505 | - Main.initCaptcha(signupForm.find('#serpro_captcha')[0]); | 1510 | + Main.initCaptcha(signupForm.find('#captcha')[0]); |
| 1506 | 1511 | ||
| 1507 | e.preventDefault(); | 1512 | e.preventDefault(); |
| 1508 | }); | 1513 | }); |
| @@ -1632,7 +1637,7 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers | @@ -1632,7 +1637,7 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers | ||
| 1632 | }) | 1637 | }) |
| 1633 | .fail(function (data) { | 1638 | .fail(function (data) { |
| 1634 | var msg = ''; | 1639 | var msg = ''; |
| 1635 | - Main.reloadCaptcha($signupForm.find('#serpro_captcha')[0]); | 1640 | + Main.reloadCaptcha($signupForm.find('#captcha')[0]); |
| 1636 | 1641 | ||
| 1637 | if(data.responseJSON){ | 1642 | if(data.responseJSON){ |
| 1638 | try{ | 1643 | try{ |