Commit c5843e366285b4653d68e208f67269dc8ec0eb44
1 parent
240029c9
Exists in
master
and in
5 other branches
Serpro Captcha frontend
Showing
2 changed files
with
18 additions
and
7 deletions
Show diff stats
index.html
... | ... | @@ -438,8 +438,13 @@ |
438 | 438 | <div class="oauth-providers"> |
439 | 439 | <input id="user_oauth_providers" name="oauth_providers" type="hidden"> |
440 | 440 | </div> |
441 | + <div id="serpro_captcha" class="captcha col-sm-12"> | |
442 | + </div> | |
441 | 443 | <div class="captcha col-sm-12"> |
442 | - <div id="g-recaptcha"></div> | |
444 | + Digite os caracteres acima: | |
445 | + </div> | |
446 | + <div class="captcha col-sm-6"> | |
447 | + <input type="text" name="captcha_text" > | |
443 | 448 | </div> |
444 | 449 | <div class="actions col-sm-12"> |
445 | 450 | <div class="row"> |
... | ... | @@ -545,7 +550,7 @@ |
545 | 550 | loadRequireJS(); |
546 | 551 | </script> |
547 | 552 | |
548 | - <script type="text/javascript" src="http://www.google.com/recaptcha/api/js/recaptcha_ajax.js" async defer></script> | |
553 | + <script src="http://captcha2.servicoscorporativos.serpro.gov.br/js/captcha.serpro.gov.br.js"></script> | |
549 | 554 | |
550 | 555 | </body> |
551 | 556 | ... | ... |
js/main.js
... | ... | @@ -1141,6 +1141,8 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun |
1141 | 1141 | }); |
1142 | 1142 | |
1143 | 1143 | $(document).on('click', '.new-user', function(e) { |
1144 | + if(window.lastCaptcha) | |
1145 | + window.lastCaptcha.destruir(); | |
1144 | 1146 | var loginForm = $(this).parents('#login-form'); |
1145 | 1147 | var signupForm = loginForm.siblings('#signup-form'); |
1146 | 1148 | window.signupForm = signupForm; |
... | ... | @@ -1150,8 +1152,12 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun |
1150 | 1152 | signupForm.find(".password").show(); |
1151 | 1153 | signupForm.find(".password-confirmation").show(); |
1152 | 1154 | loginForm.find('.message').hide(); |
1153 | - signupForm.find('#g-recaptcha').empty(); | |
1154 | - Recaptcha.create(window.recaptchaSiteKey, signupForm.find('#g-recaptcha')[0], { lang : 'pt', theme: "clean", callback: Recaptcha.focus_response_field } ); | |
1155 | + signupForm.find('#serpro_captcha').empty(); | |
1156 | + var oCaptcha_serpro_gov_br; | |
1157 | + oCaptcha_serpro_gov_br = new captcha_serpro_gov_br(); | |
1158 | + window.lastCaptcha = oCaptcha_serpro_gov_br; | |
1159 | + oCaptcha_serpro_gov_br.clienteId = "fdbcdc7a0b754ee7ae9d865fda740f17"; | |
1160 | + oCaptcha_serpro_gov_br.criarUI(signupForm.find('#serpro_captcha')[0], "css", "input", "serpro_captcha_component_"); | |
1155 | 1161 | e.preventDefault(); |
1156 | 1162 | }) |
1157 | 1163 | |
... | ... | @@ -1188,9 +1194,9 @@ define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], fun |
1188 | 1194 | $(document).trigger('login:success', data); |
1189 | 1195 | }).fail(function(data) { |
1190 | 1196 | var msg = ""; |
1191 | - window.signupForm.find('#g-recaptcha').empty(); | |
1192 | - Recaptcha.create(window.recaptchaSiteKey, window.signupForm.find('#g-recaptcha')[0], { lang : 'pt', theme: "clean", callback: Recaptcha.focus_response_field } ); | |
1193 | - | |
1197 | + // Reload captcha here | |
1198 | + if(window.lastCaptcha) | |
1199 | + window.lastCaptcha.recarregar(); | |
1194 | 1200 | try{ |
1195 | 1201 | msg = Main.responseToText(data.responseJSON.message); |
1196 | 1202 | }catch(ex){ | ... | ... |