From 8a19bd733d575f868b90f0b0a17e2fd01e58f861 Mon Sep 17 00:00:00 2001 From: Leonardo Merlin Date: Fri, 25 Sep 2015 18:16:49 -0300 Subject: [PATCH] Fix handler of unauthorized captcha --- src/app/components/proposal-box/proposal-box.directive.js | 13 ++++++------- src/app/components/proposal-box/proposal-box.html | 6 ++++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/app/components/proposal-box/proposal-box.directive.js b/src/app/components/proposal-box/proposal-box.directive.js index 8c5563e..0f69b64 100644 --- a/src/app/components/proposal-box/proposal-box.directive.js +++ b/src/app/components/proposal-box/proposal-box.directive.js @@ -58,10 +58,6 @@ }); vm.$scope.$on('proposal-box:vote-response', function(event, data) { - vm.$log.debug('proposal-box:vote-response'); - vm.$log.debug('event', event); - vm.$log.debug('data', data); - if (data.success) { vm.STATE = vm.VOTE_STATUS.SUCCESS; } @@ -73,6 +69,8 @@ if (data.code === 401) { vm.message = 'Não autorizado.'; } + + vm.messageCode = data.code; }); // Load captcha @@ -125,10 +123,11 @@ // SEND VOTE if (vm._oldVoteValue) { - // hide captcha form - vm.showCaptchaForm = false; vm.vote(vm._oldVoteValue); + vm._oldVoteValue = null; } + // hide captcha form + vm.showCaptchaForm = false; }, function(data) { // ERROR @@ -170,6 +169,7 @@ ProposalBoxController.prototype.vote = function(value) { var vm = this; + vm._oldVoteValue = value; if (vm.canVote()) { if (vm.doVote) { vm.doVote({ @@ -181,7 +181,6 @@ } }else { vm.$log.debug('You cannot vote.'); - vm._oldVoteValue = value; vm.showCaptchaForm = true; angular.element('#captcha_text').focus(); diff --git a/src/app/components/proposal-box/proposal-box.html b/src/app/components/proposal-box/proposal-box.html index 5df0f22..3f8d833 100644 --- a/src/app/components/proposal-box/proposal-box.html +++ b/src/app/components/proposal-box/proposal-box.html @@ -52,8 +52,10 @@
-
-- libgit2 0.21.2