Commit 9d102ba209ff4c77bd477312454c1c37edd988f4

Authored by Victor Costa
1 parent 2c34fc13

Handle signup with post activation

Showing 1 changed file with 14 additions and 4 deletions   Show diff stats
js/main.js
... ... @@ -939,7 +939,7 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers
939 939 if(data.person){
940 940 Main.setUser({person: data.person});
941 941 }
942   - Main.loginCallback(true, data.private_token);
  942 + Main.loginCallback(data.activated, data.private_token);
943 943 },
944 944 handleLoginFail: function (e){
945 945 console.error('handleLoginFail', e);
... ... @@ -1508,8 +1508,13 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers
1508 1508 $signupForm.hide();
1509 1509 $signupForm.removeClass('hide');
1510 1510 var $sectionContent = $button.closest('.section-content');
  1511 +
  1512 + var message = 'Cadastro efetuado com sucesso';
  1513 + if(!data.activated) {
  1514 + message = 'Verifique seu email para confirmar o cadastro.';
  1515 + }
1511 1516 if($sectionContent && $sectionContent.length > 0){
1512   - Main.displaySuccess($sectionContent, 'Cadastro efetuado com sucesso', 1000, 'icon-user-created');
  1517 + Main.displaySuccess($sectionContent, message, 1000, 'icon-user-created');
1513 1518 }
1514 1519 $(document).trigger('login:success', data);
1515 1520 })
... ... @@ -1543,9 +1548,14 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers
1543 1548 $(document).trigger('login:fail', data);
1544 1549 }
1545 1550 )
1546   - .always(function () {
  1551 + .always(function (data) {
1547 1552 $loading.hide();
1548   - $signupForm.show();
  1553 + if(data && !data.activated) {
  1554 + $signupForm.find('.cancel-signup').click();
  1555 + $signupForm.hide();
  1556 + } else {
  1557 + $signupForm.show();
  1558 + }
1549 1559 }
1550 1560 );
1551 1561 }
... ...