Commit 62aa497fbae4be99335e23bc5a2386fbcff95dcb
1 parent
e140c729
Exists in
master
and in
5 other branches
alterado para funcionar o signup pela rede social
Showing
1 changed file
with
21 additions
and
10 deletions
Show diff stats
js/main.js
... | ... | @@ -45,7 +45,7 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
45 | 45 | //127.0.0.1 login.dialoga.gov.br |
46 | 46 | //127.0.0.1 noosfero.com |
47 | 47 | //Detects for localhost settings |
48 | - var patt = new RegExp(':300[0-1]/|8080/'); | |
48 | + var patt = new RegExp(':300[0-2]/'); | |
49 | 49 | var localDevelopment = false; |
50 | 50 | |
51 | 51 | if(patt.test(window.location.href)){ |
... | ... | @@ -62,13 +62,13 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
62 | 62 | recaptchaSiteKey = '6LdsWAcTAAAAAChTUUD6yu9fCDhdIZzNd7F53zf-'; //http://noosfero.com/ |
63 | 63 | cat_saude = 23; |
64 | 64 | } else { //ABNER |
65 | - host = 'http://noosfero.com:3000'; | |
65 | + host = 'http://local.abner.com:3002'; | |
66 | 66 | dialoga_community = 105; |
67 | 67 | proposal_discussion = '392'; //Evandro |
68 | 68 | recaptchaSiteKey = '6LdsWAcTAAAAAChTUUD6yu9fCDhdIZzNd7F53zf-'; //http://noosfero.com/ |
69 | 69 | cat_saude = 23; |
70 | 70 | } |
71 | - } | |
71 | + } | |
72 | 72 | |
73 | 73 | |
74 | 74 | var BARRA_ADDED = false; |
... | ... | @@ -93,13 +93,14 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
93 | 93 | |
94 | 94 | function fillSignupForm(signupForm, user) { |
95 | 95 | signupForm.find('#signup-user_email').val(user.email); |
96 | + signupForm.find('#signup-user_email').attr('disabled', true); | |
96 | 97 | signupForm.find('#signup-user_name').val(user.login); |
97 | - signupForm.find('#user_oauth_signup_token').val(user.oauth_signup_token); | |
98 | + signupForm.find('#user_oauth_signup_token').val(user.signup_token); | |
98 | 99 | signupForm.find('#user_oauth_providers').val(user.oauth_providers); |
99 | - /*signupForm.find('div.password').hide(); | |
100 | + signupForm.find('div.password').hide(); | |
100 | 101 | signupForm.find('div.password-confirmation').hide(); |
101 | 102 | signupForm.find('#signup-user_password').attr('required', false); |
102 | - signupForm.find('#user_password_confirmation').attr('required', false);*/ | |
103 | + signupForm.find('#user_password_confirmation').attr('required', false); | |
103 | 104 | }; |
104 | 105 | |
105 | 106 | return { |
... | ... | @@ -1325,7 +1326,12 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
1325 | 1326 | signupForm.find('#user_password_confirmation').attr('required', true); |
1326 | 1327 | |
1327 | 1328 | loginForm.find('.message').hide(); |
1328 | - signupForm.find('#serpro_captcha').empty(); | |
1329 | + signupForm.find('#serpro_captcha').val(''); | |
1330 | + | |
1331 | + signupForm.find('#signup-user_email').val(''); | |
1332 | + signupForm.find('#signup-user_email').attr('disabled', false); | |
1333 | + signupForm.find('#signup-user_name').val(''); | |
1334 | + | |
1329 | 1335 | |
1330 | 1336 | var oCaptcha_serpro_gov_br; |
1331 | 1337 | oCaptcha_serpro_gov_br = new captcha_serpro_gov_br(); |
... | ... | @@ -1373,11 +1379,11 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
1373 | 1379 | var hasPasswordConfirmation = true; |
1374 | 1380 | var hasPasswordEquals = true; |
1375 | 1381 | |
1376 | - //if(! isOAUTH){ | |
1382 | + if(! isOAUTH){ | |
1377 | 1383 | hasPassword = $inputPassword && $inputPassword.val().length > 0; |
1378 | 1384 | hasPasswordConfirmation = $inputPasswordConfirmation && $inputPasswordConfirmation.val().length > 0; |
1379 | 1385 | hasPasswordEquals = $inputPassword.val() === $inputPasswordConfirmation.val(); |
1380 | - //} | |
1386 | + } | |
1381 | 1387 | |
1382 | 1388 | var hasAcceptation = $inputAcceptation.val(); |
1383 | 1389 | var hasCaptcha = $inputCaptcha.val().length > 0; |
... | ... | @@ -1434,10 +1440,15 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
1434 | 1440 | // show loading |
1435 | 1441 | var $loading = $('.login-container .loading'); |
1436 | 1442 | $loading.show(); |
1443 | + var signup_form_data = $signupForm.serialize(); | |
1444 | + if(! new RegExp('email=').test(signup_form_data)){ | |
1445 | + signup_form_data += "&email=" + $inputEmail.val(); | |
1446 | + } | |
1437 | 1447 | $.ajax({ |
1438 | 1448 | type: 'post', |
1449 | + contentType: 'application/x-www-form-urlencoded', | |
1439 | 1450 | url: host + '/api/v1/register', |
1440 | - data: $signupForm.serialize(), | |
1451 | + data: signup_form_data, | |
1441 | 1452 | }) |
1442 | 1453 | .done(function (data){ |
1443 | 1454 | $signupForm.hide(); | ... | ... |