Commit 7963f62a96e60dfee6aa75f092fbd567087d4f19
1 parent
b5ebf56e
Exists in
master
and in
6 other branches
support for recaptcha v2
Showing
3 changed files
with
20 additions
and
13 deletions
Show diff stats
index.html
| ... | ... | @@ -365,29 +365,28 @@ |
| 365 | 365 | <form id="signup-form" class="signup hide" autocomplete="off"> |
| 366 | 366 | <div class="email"> |
| 367 | 367 | <label for="user_email" class="label">E-mail:</label> |
| 368 | - <input id="user_email" name="email" type="text" placeholder="E-mail"> | |
| 368 | + <input id="user_email" name="email" type="email" required placeholder="E-mail"> | |
| 369 | 369 | </div> |
| 370 | 370 | <div class="username"> |
| 371 | 371 | <label for="user_name" class="label">Nome de Usuário</label> |
| 372 | - <input id="user_name" name="login" type="text" placeholder="Nome do usuário"> | |
| 372 | + <input id="user_name" name="login" type="text" required placeholder="Nome do usuário"> | |
| 373 | 373 | </div> |
| 374 | 374 | <div class="password"> |
| 375 | 375 | <label for="user_password" class="label">Senha:</label> |
| 376 | - <input id="user_password" name="password" type="password" placeholder="Senha"> | |
| 376 | + <input id="user_password" name="password" type="password" required placeholder="Senha"> | |
| 377 | 377 | </div> |
| 378 | 378 | <div class="password-confirmation"> |
| 379 | 379 | <label for="user_password_confirmation" class="label">Confirme a senha:</label> |
| 380 | - <input id="user_password_confirmation" name="password_confirmation" type="password" placeholder="Confirme a senha"> | |
| 380 | + <input id="user_password_confirmation" name="password_confirmation" type="password" required placeholder="Confirme a senha"> | |
| 381 | + </div> | |
| 382 | + <div class="captcha"> | |
| 383 | + <div id="g-recaptcha"></div> | |
| 381 | 384 | </div> |
| 382 | 385 | <div class="actions"> |
| 383 | 386 | <div class="message hide"></div> |
| 384 | 387 | <a href="#" class="confirm-signup">Confirmar</a> |
| 385 | 388 | <a href="#" class="cancel-signup">Cancelar</a> |
| 386 | 389 | </div> |
| 387 | - <div class="captcha"> | |
| 388 | - <div class="g-recaptcha" data-sitekey="6LcLPAcTAAAAAKsd0bxY_TArhD_A7OL19SRCW7_i"></div> | |
| 389 | - <script src='https://www.google.com/recaptcha/api.js?hl=pt-BR' async defer></script> | |
| 390 | - </div> | |
| 391 | 390 | </form> |
| 392 | 391 | </script> |
| 393 | 392 | |
| ... | ... | @@ -404,6 +403,7 @@ |
| 404 | 403 | loadRequireJS(); |
| 405 | 404 | </script> |
| 406 | 405 | |
| 406 | + <script src='https://www.google.com/recaptcha/api.js?hl=pt-BR' async defer></script> | |
| 407 | 407 | |
| 408 | 408 | </body> |
| 409 | 409 | ... | ... |
js/main.js
| ... | ... | @@ -17,13 +17,15 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F |
| 17 | 17 | |
| 18 | 18 | var loginButton; |
| 19 | 19 | |
| 20 | - var participa = true; | |
| 20 | + var participa = false; | |
| 21 | 21 | if(participa){ |
| 22 | 22 | var host = 'http://www.participa.br'; |
| 23 | 23 | var proposal_discussion = '103358'; //participa |
| 24 | + window.recaptchaSiteKey = '6LcLPAcTAAAAAKsd0bxY_TArhD_A7OL19SRCW7_i' | |
| 24 | 25 | }else{ |
| 25 | 26 | var host = 'http://noosfero.com:3000'; |
| 26 | - var proposal_discussion = '632'; //local serpro | |
| 27 | + var proposal_discussion = '372'; //local serpro | |
| 28 | + window.recaptchaSiteKey = '6LdsWAcTAAAAAChTUUD6yu9fCDhdIZzNd7F53zf-' //http://noosfero.com/ | |
| 27 | 29 | } |
| 28 | 30 | |
| 29 | 31 | var BARRA_ADDED = false; |
| ... | ... | @@ -32,7 +34,7 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F |
| 32 | 34 | Main = (function(){ |
| 33 | 35 | |
| 34 | 36 | return { |
| 35 | - private_token: '375bee7e17d0021af7160ce664874618', | |
| 37 | + private_token: 'db34efd2c7df703b61226c88b7b477c8', | |
| 36 | 38 | getProposalId: function() { |
| 37 | 39 | var regexProposals = /\d.*\/propostas\/*.*/; |
| 38 | 40 | var proposalId = 0; |
| ... | ... | @@ -687,9 +689,13 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F |
| 687 | 689 | |
| 688 | 690 | $(document).on('click', '.new-user', function(e) { |
| 689 | 691 | var loginForm = $(this).parents('#login-form'); |
| 692 | + var signupForm = loginForm.siblings('#signup-form'); | |
| 693 | + | |
| 690 | 694 | loginForm.hide(); |
| 691 | - loginForm.siblings('#signup-form').show(); | |
| 695 | + signupForm.show(); | |
| 692 | 696 | loginForm.find('.message').hide(); |
| 697 | + console.log(signupForm.find('#g-recaptcha')[0]); | |
| 698 | + grecaptcha.render(signupForm.find('#g-recaptcha')[0], {'sitekey' : window.recaptchaSiteKey }); | |
| 693 | 699 | e.preventDefault(); |
| 694 | 700 | }) |
| 695 | 701 | |
| ... | ... | @@ -697,6 +703,7 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F |
| 697 | 703 | var signupForm = $(this).parents('#signup-form'); |
| 698 | 704 | signupForm.hide(); |
| 699 | 705 | signupForm.siblings('#login-form').show(); |
| 706 | + grecaptcha.reset(); | |
| 700 | 707 | e.preventDefault(); |
| 701 | 708 | }); |
| 702 | 709 | |
| ... | ... | @@ -723,6 +730,7 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F |
| 723 | 730 | loading.hide(); |
| 724 | 731 | signup.show(); |
| 725 | 732 | }); |
| 733 | + grecaptcha.reset(); | |
| 726 | 734 | e.preventDefault(); |
| 727 | 735 | }); |
| 728 | 736 | ... | ... |