Commit f7a240386808c35f2c3e68bd347bac8632c456c9

Authored by Leonardo Merlin
2 parents 4102f662 bd02f0f6

Fixes #45, fixes #42, fixes #32, fixes

src/app/components/a11y-bar/a11y-bar.html
@@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
16 </a> 16 </a>
17 </li> 17 </li>
18 <li> 18 <li>
19 - <a class="color-theme-common-fg" accesskey="3" id="skip-to-search" ui-sref="inicio({scroll:'lista-de-programas'})" ui-sref-opts="{reload: true}"> 19 + <a class="color-theme-common-fg" accesskey="3" id="skip-to-search" href="#search" ng-click="focusOnSearch($event)">
20 Ir para a busca 20 Ir para a busca
21 <span class="color-theme-common-bg">3</span> 21 <span class="color-theme-common-bg">3</span>
22 </a> 22 </a>
src/app/components/auth/auth.service.js
@@ -54,10 +54,12 @@ @@ -54,10 +54,12 @@
54 54
55 $rootScope.$broadcast(AUTH_EVENTS.registerSuccess, data.user); 55 $rootScope.$broadcast(AUTH_EVENTS.registerSuccess, data.user);
56 return response; 56 return response;
  57 +
57 }, function(response) { 58 }, function(response) {
58 - $log.debug('AuthService.register [FAIL] response', response);  
59 59
  60 + $log.debug('AuthService.register [FAIL] response', response);
60 $rootScope.$broadcast(AUTH_EVENTS.registerFailed, response); 61 $rootScope.$broadcast(AUTH_EVENTS.registerFailed, response);
  62 +
61 return $q.reject(response); 63 return $q.reject(response);
62 }); 64 });
63 } 65 }
@@ -79,6 +81,35 @@ @@ -79,6 +81,35 @@
79 // 'Erro: O código de ativação é inválido.' 81 // 'Erro: O código de ativação é inválido.'
80 $log.debug('AuthService.activate [FAIL] response', response); 82 $log.debug('AuthService.activate [FAIL] response', response);
81 $rootScope.$broadcast(AUTH_EVENTS.activateFailed); 83 $rootScope.$broadcast(AUTH_EVENTS.activateFailed);
  84 +
  85 + return $q.reject(response);
  86 + });
  87 + }
  88 +
  89 + function resendConfirmation (data) {
  90 + var url = PATH.host + '/api/v1/resend_activation_code';
  91 + var encodedData = ([
  92 + 'value=' + data.login,
  93 + 'captcha_text=' + data.captcha_text,
  94 + 'txtToken_captcha_serpro_gov_br=' + data.txtToken_captcha_serpro_gov_br
  95 + ]).join('&');
  96 +
  97 + url += '?' + encodedData;
  98 +
  99 + return $http
  100 + .post(url)
  101 + .then(function(response) {
  102 + $log.debug('AuthService.resendConfirmation [SUCCESS] response', response);
  103 +
  104 + // 'Usuário ativado com sucesso'
  105 + $rootScope.$broadcast(AUTH_EVENTS.resendConfirmationSuccess, response);
  106 + return response;
  107 + }, function(response) {
  108 + // 'Erro: O código de ativação é inválido.'
  109 + $log.debug('AuthService.resendConfirmation [FAIL] response', response);
  110 + $rootScope.$broadcast(AUTH_EVENTS.resendConfirmationFailed);
  111 +
  112 + return $q.reject(response);
82 }); 113 });
83 } 114 }
84 115
@@ -100,6 +131,8 @@ @@ -100,6 +131,8 @@
100 // 'Não foi possível trocar a senha com os dados informados.' 131 // 'Não foi possível trocar a senha com os dados informados.'
101 $log.debug('AuthService.changePassword [FAIL] response', response); 132 $log.debug('AuthService.changePassword [FAIL] response', response);
102 $rootScope.$broadcast(AUTH_EVENTS.changePasswordFailed); 133 $rootScope.$broadcast(AUTH_EVENTS.changePasswordFailed);
  134 +
  135 + return $q.reject(response);
103 }); 136 });
104 } 137 }
105 138
@@ -125,7 +158,7 @@ @@ -125,7 +158,7 @@
125 $log.debug('AuthService.forgotPassword [FAIL] response', response); 158 $log.debug('AuthService.forgotPassword [FAIL] response', response);
126 $rootScope.$broadcast(AUTH_EVENTS.forgotPasswordFailed); 159 $rootScope.$broadcast(AUTH_EVENTS.forgotPasswordFailed);
127 160
128 - return response; 161 + return $q.reject(response);
129 }); 162 });
130 } 163 }
131 164
@@ -190,6 +223,7 @@ @@ -190,6 +223,7 @@
190 var service = { 223 var service = {
191 register: register, 224 register: register,
192 activate: activate, 225 activate: activate,
  226 + resendConfirmation: resendConfirmation,
193 changePassword: changePassword, 227 changePassword: changePassword,
194 forgotPassword: forgotPassword, 228 forgotPassword: forgotPassword,
195 login: login, 229 login: login,
src/app/index.constants.js
@@ -28,6 +28,8 @@ @@ -28,6 +28,8 @@
28 registerFailed: 'auth-register-failed', 28 registerFailed: 'auth-register-failed',
29 activateSuccess: 'auth-activate-success', 29 activateSuccess: 'auth-activate-success',
30 activateFailed: 'auth-activate-failed', 30 activateFailed: 'auth-activate-failed',
  31 + resendConfirmationSuccess: 'auth-resend-confirmation-success',
  32 + resendConfirmationFailed: 'auth-resend-confirmation-failed',
31 changePasswordSuccess: 'auth-changePassword-success', 33 changePasswordSuccess: 'auth-changePassword-success',
32 changePasswordFailed: 'auth-changePassword-failed', 34 changePasswordFailed: 'auth-changePassword-failed',
33 forgotPassowrdSuccess: 'auth-forgotPassowrd-success', 35 forgotPassowrdSuccess: 'auth-forgotPassowrd-success',
src/app/index.route.js
@@ -27,7 +27,18 @@ @@ -27,7 +27,18 @@
27 'main': { 27 'main': {
28 templateUrl: 'app/pages/auth/signin.html', 28 templateUrl: 'app/pages/auth/signin.html',
29 controller: 'AuthPageController', 29 controller: 'AuthPageController',
30 - controllerAs: 'pageSignin' 30 + controllerAs: 'pageAuth'
  31 + }
  32 + }
  33 + })
  34 + .state('reenviar-email', {
  35 + url: '/reenviar-email',
  36 + ncyBreadcrumb: {label: 'Re-enviar e-mail de confirmação'},
  37 + views: {
  38 + 'main': {
  39 + templateUrl: 'app/pages/auth/resend-confirmation.html',
  40 + controller: 'AuthPageController',
  41 + controllerAs: 'pageAuth'
31 } 42 }
32 } 43 }
33 }) 44 })
@@ -38,7 +49,7 @@ @@ -38,7 +49,7 @@
38 'main': { 49 'main': {
39 templateUrl: 'app/pages/auth/recover.html', 50 templateUrl: 'app/pages/auth/recover.html',
40 controller: 'AuthPageController', 51 controller: 'AuthPageController',
41 - controllerAs: 'pageSignin' 52 + controllerAs: 'pageAuth'
42 } 53 }
43 } 54 }
44 }) 55 })
@@ -49,7 +60,7 @@ @@ -49,7 +60,7 @@
49 'main': { 60 'main': {
50 templateUrl: 'app/pages/auth/change.html', 61 templateUrl: 'app/pages/auth/change.html',
51 controller: 'AuthPageController', 62 controller: 'AuthPageController',
52 - controllerAs: 'pageSignin' 63 + controllerAs: 'pageAuth'
53 } 64 }
54 } 65 }
55 }) 66 })
src/app/index.run.js
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 .run(runAccessibility) 7 .run(runAccessibility)
8 .run(runAuth) 8 .run(runAuth)
9 .run(runCaptcha) 9 .run(runCaptcha)
10 - .run(runColorUtils) 10 + // .run(runColorUtils)
11 .run(runHistory) 11 .run(runHistory)
12 .run(runPath) 12 .run(runPath)
13 .run(runSocialAuth) 13 .run(runSocialAuth)
@@ -16,6 +16,118 @@ @@ -16,6 +16,118 @@
16 .run(runBlock); 16 .run(runBlock);
17 17
18 /** @ngInject */ 18 /** @ngInject */
  19 + function runAccessibility($rootScope, $timeout, $interval, $cookies, $state, $log) {
  20 +
  21 + var contrast = $cookies.get('dialoga_contraste') === 'true';
  22 + adjustContrast(contrast);
  23 +
  24 + function adjustContrast(state) {
  25 + var bodyEl = angular.element(document).find('body');
  26 + angular.element(bodyEl).toggleClass('contraste', !!state);
  27 + }
  28 +
  29 + $rootScope.actionContrast = function() {
  30 + // toggle contrast
  31 + contrast = !contrast;
  32 + $cookies.put('dialoga_contraste', contrast);
  33 + adjustContrast(contrast);
  34 + };
  35 +
  36 + $rootScope.focusOn = function(elId, $event) {
  37 + var el = angular.element(elId);
  38 + $rootScope.scrollTo(el, $event);
  39 + el.attr('tabIndex', -1).focus();
  40 + };
  41 +
  42 + $rootScope.focusMainContent = function($event) {
  43 +
  44 + var mainContentArea = document.querySelector('[role="main"]');
  45 +
  46 + if (mainContentArea) {
  47 + $timeout(function() {
  48 + $rootScope.scrollTo(angular.element(mainContentArea), $event);
  49 + }, 90); // force queue
  50 + } else {
  51 + $log.info('role="main" not found.');
  52 + }
  53 + };
  54 +
  55 + $rootScope.focusOnSearch = function($event) {
  56 +
  57 + // prevent skip link from redirecting
  58 + if ($event) { $event.preventDefault(); }
  59 +
  60 + // find a input search
  61 + var $searchEl = angular.element('input[type="search"]:visible');
  62 +
  63 + if($searchEl && $searchEl.length > 0){
  64 + // scroll
  65 + angular.element('html,body').animate({scrollTop: $searchEl.offset().top}, 'fast');
  66 + // focus
  67 + $searchEl.focus();
  68 + } else {
  69 + // input search not found
  70 +
  71 + // 1. redirect to home
  72 + var promise = $state.go('inicio', { reload: true});
  73 +
  74 + // 2. focus on input search at home.
  75 + promise.then(function(){
  76 +
  77 + findElAsync('input[type="search"]:visible', function ($el) {
  78 + // scroll
  79 + angular.element('html,body').animate({scrollTop: $el.offset().top}, 'fast');
  80 + // focus
  81 + $el.focus();
  82 + });
  83 + });
  84 + }
  85 +
  86 + // use jQuery and $interval to find element async.
  87 + function findElAsync(query, cb, delay, max_exec) {
  88 + delay = delay || 200;
  89 + max_exec = max_exec || 20;
  90 + var count_exec = 0;
  91 +
  92 + var stop = null;
  93 + stop = $interval(function() {
  94 + var $el = angular.element(query);
  95 +
  96 + if ($el && $el.length > 0) {
  97 + cb($el);
  98 + }else {
  99 + $log.debug('[findElAsync] element not found.');
  100 + }
  101 +
  102 + count_exec++;
  103 +
  104 + if (count_exec >= max_exec){
  105 + $interval.cancel(stop);
  106 + stop = undefined;
  107 + }
  108 +
  109 + }, delay);
  110 + }
  111 +
  112 + $log.debug('TODO: focusOnSearch');
  113 + };
  114 +
  115 + $rootScope.scrollTo = function(target, $event) {
  116 +
  117 + // prevent skip link from redirecting
  118 + if ($event) { $event.preventDefault(); }
  119 +
  120 + if (angular.isString(target)) {
  121 + target = angular.element(target);
  122 + }
  123 +
  124 + angular.element('html,body').animate({scrollTop: target.offset().top}, 'fast');
  125 + };
  126 +
  127 + $log.debug('[RUN] Accessibility end.');
  128 + }
  129 +
  130 + /** @ngInject */
19 function runAuth($rootScope, $localStorage, USER_ROLES, AUTH_EVENTS, AuthService, $log) { 131 function runAuth($rootScope, $localStorage, USER_ROLES, AUTH_EVENTS, AuthService, $log) {
20 132
21 // Listner url/state changes, and check permission 133 // Listner url/state changes, and check permission
@@ -82,89 +194,32 @@ @@ -82,89 +194,32 @@
82 $log.debug('runCaptcha'); 194 $log.debug('runCaptcha');
83 } 195 }
84 196
85 - /** @ngInject */  
86 - function runSocialAuth($window, $rootScope, $interval) { 197 + // /** @ngInject */
  198 + // function runColorUtils($window) {
87 199
88 - $window.oauthClientAction = function(url) {  
89 - var child = $window.open(url, '_blank');  
90 - var interval = $interval(function() {  
91 - try {  
92 - if (!child.closed) {  
93 - child.postMessage({  
94 - message: 'requestOauthClientPluginResult'  
95 - }, '*');  
96 - }  
97 - } catch (e) {  
98 - // we're here when the child window has been navigated away or closed  
99 - if (child.closed) {  
100 - $interval.cancel(interval);  
101 - interval = undefined;  
102 - }  
103 - }  
104 - }, 300);  
105 - }; 200 + // $window.ColorLuminance = function(hex, lum) {
106 201
107 - $window.addEventListener('message', function(eventMessage) {  
108 - // $log.debug('eventMessage', eventMessage); 202 + // // validate hex string
  203 + // hex = String(hex).replace(/[^0-9a-f]/gi, '');
  204 + // if (hex.length < 6) {
  205 + // hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
  206 + // }
  207 + // lum = lum || 0;
109 208
110 - if (eventMessage.data.message === 'oauthClientPluginResult') {  
111 - $rootScope.$broadcast('oauthClientPluginResult', eventMessage);  
112 - // eventMessage.source.close();  
113 - }  
114 - });  
115 - } 209 + // // convert to decimal and change luminosity
  210 + // var rgb = '#';
  211 + // var c;
  212 + // var i;
116 213
117 - /** @ngInject */  
118 - function runAccessibility($rootScope, $timeout, $cookies, $log) {  
119 -  
120 - var contrast = $cookies.get('dialoga_contraste') === 'true';  
121 - adjustContrast(contrast); 214 + // for (i = 0; i < 3; i++) {
  215 + // c = parseInt(hex.substr(i * 2, 2), 16);
  216 + // c = Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16);
  217 + // rgb += ('00' + c).substr(c.length);
  218 + // }
122 219
123 - function adjustContrast(state) {  
124 - var bodyEl = angular.element(document).find('body');  
125 - angular.element(bodyEl).toggleClass('contraste', !!state);  
126 - }  
127 -  
128 - $rootScope.actionContrast = function() {  
129 - // toggle contrast  
130 - contrast = !contrast;  
131 - $cookies.put('dialoga_contraste', contrast);  
132 - adjustContrast(contrast);  
133 - };  
134 -  
135 - $rootScope.focusOn = function(elId, $event) {  
136 - var el = angular.element(elId);  
137 - $rootScope.scrollTo(el, $event);  
138 - el.attr('tabIndex', -1).focus();  
139 - };  
140 -  
141 - $rootScope.focusMainContent = function($event) {  
142 -  
143 - var mainContentArea = document.querySelector('[role="main"]');  
144 -  
145 - if (mainContentArea) {  
146 - $timeout(function() {  
147 - $rootScope.scrollTo(angular.element(mainContentArea), $event);  
148 - }, 90); // force queue  
149 - } else {  
150 - $log.info('role="main" not found.');  
151 - }  
152 - };  
153 -  
154 - $rootScope.scrollTo = function(target, $event) {  
155 -  
156 - // prevent skip link from redirecting  
157 - if ($event) { $event.preventDefault(); }  
158 -  
159 - if (angular.isString(target)) {  
160 - target = angular.element(target);  
161 - }  
162 -  
163 - angular.element('body').animate({scrollTop: target.offset().top}, 'fast');  
164 - };  
165 -  
166 - $log.debug('[RUN] Accessibility end.');  
167 - } 220 + // return rgb;
  221 + // };
  222 + // }
168 223
169 /** @ngInject */ 224 /** @ngInject */
170 function runHistory($rootScope) { 225 function runHistory($rootScope) {
@@ -188,30 +243,35 @@ @@ -188,30 +243,35 @@
188 } 243 }
189 244
190 /** @ngInject */ 245 /** @ngInject */
191 - function runColorUtils($window) {  
192 -  
193 - $window.ColorLuminance = function(hex, lum) { 246 + function runSocialAuth($window, $rootScope, $interval) {
194 247
195 - // validate hex string  
196 - hex = String(hex).replace(/[^0-9a-f]/gi, '');  
197 - if (hex.length < 6) {  
198 - hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];  
199 - }  
200 - lum = lum || 0; 248 + $window.oauthClientAction = function(url) {
  249 + var child = $window.open(url, '_blank');
  250 + var interval = $interval(function() {
  251 + try {
  252 + if (!child.closed) {
  253 + child.postMessage({
  254 + message: 'requestOauthClientPluginResult'
  255 + }, '*');
  256 + }
  257 + } catch (e) {
  258 + // we're here when the child window has been navigated away or closed
  259 + if (child.closed) {
  260 + $interval.cancel(interval);
  261 + interval = undefined;
  262 + }
  263 + }
  264 + }, 300);
  265 + };
201 266
202 - // convert to decimal and change luminosity  
203 - var rgb = '#';  
204 - var c;  
205 - var i; 267 + $window.addEventListener('message', function(eventMessage) {
  268 + // $log.debug('eventMessage', eventMessage);
206 269
207 - for (i = 0; i < 3; i++) {  
208 - c = parseInt(hex.substr(i * 2, 2), 16);  
209 - c = Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16);  
210 - rgb += ('00' + c).substr(c.length); 270 + if (eventMessage.data.message === 'oauthClientPluginResult') {
  271 + $rootScope.$broadcast('oauthClientPluginResult', eventMessage);
  272 + // eventMessage.source.close();
211 } 273 }
212 -  
213 - return rgb;  
214 - }; 274 + });
215 } 275 }
216 276
217 /** @ngInject */ 277 /** @ngInject */
@@ -221,7 +281,7 @@ @@ -221,7 +281,7 @@
221 281
222 if($resultEl && $resultEl.length > 0){ 282 if($resultEl && $resultEl.length > 0){
223 $rootScope.scrollTo($resultEl); 283 $rootScope.scrollTo($resultEl);
224 - // angular.element('body').animate({scrollTop: $resultEl.offset().top}, 'fast'); 284 + // angular.element('html,body').animate({scrollTop: $resultEl.offset().top}, 'fast');
225 } 285 }
226 }); 286 });
227 } 287 }
src/app/pages/auth/auth.controller.js
@@ -60,6 +60,7 @@ @@ -60,6 +60,7 @@
60 60
61 // handle logout 61 // handle logout
62 vm.$scope.$on(vm.AUTH_EVENTS.logoutSuccess, function() { 62 vm.$scope.$on(vm.AUTH_EVENTS.logoutSuccess, function() {
  63 + vm.clearMessages();
63 vm.currentUser = vm.Session.getCurrentUser(); 64 vm.currentUser = vm.Session.getCurrentUser();
64 vm._attachCaptcha(); 65 vm._attachCaptcha();
65 }); 66 });
@@ -136,55 +137,67 @@ @@ -136,55 +137,67 @@
136 var $captcha = $target.find('[name="txtToken_captcha_serpro_gov_br"]'); 137 var $captcha = $target.find('[name="txtToken_captcha_serpro_gov_br"]');
137 credentials.txtToken_captcha_serpro_gov_br = $captcha.val(); 138 credentials.txtToken_captcha_serpro_gov_br = $captcha.val();
138 139
139 - // vm.signupFormStatus = 'SENDIN';  
140 - vm.AuthService.register(credentials).then(function(response) {  
141 - vm.$log.debug('register success.response', response); 140 + vm.AuthService.register(credentials)
  141 + .then(function(/*response*/) {
  142 + // SUCCESS
  143 +
  144 + vm.signupSuccess = true;
  145 + // vm._startRedirect();
142 146
143 - // TODO: mensagens de sucesso  
144 - // 'Cadastro efetuado com sucesso.'  
145 - // 'Verifique seu email para confirmar o cadastro.'  
146 - vm.signupMessageTitle = 'Cadastro efetuado com sucesso!';  
147 - vm.signupSuccessMessage = 'Verifique seu e-mail para confirmar o cadastro.';  
148 - vm.redirectBack();  
149 }, function(response) { 147 }, function(response) {
150 - vm.$log.debug('register error.response', response);  
151 -  
152 - vm.internalError = true;  
153 -  
154 - switch (response.data.code) {  
155 - case 400: // bad request  
156 - var errors = JSON.parse(response.data.message);  
157 - if(errors && errors.email){  
158 - vm.signupErrorMessage = 'E-mail já está em uso.';  
159 - }  
160 - break;  
161 - case 500:  
162 - vm.signupErrorMessage = response.data.message;  
163 - break;  
164 - default:  
165 - break;  
166 - }  
167 - 148 + // ERROR
168 149
169 // TODO: mensagens de erro 150 // TODO: mensagens de erro
170 // TODO: tratar multiplos erros 151 // TODO: tratar multiplos erros
171 152
172 // javascript_console_message: "Unable to reach Serpro's Captcha validation service" 153 // javascript_console_message: "Unable to reach Serpro's Captcha validation service"
173 // message: "Internal captcha validation error" 154 // message: "Internal captcha validation error"
  155 +
  156 + vm.signupError = true;
  157 + vm.signupErrorTitle = 'Erro!';
  158 + vm.signupErrorMessage = response.data.message;
  159 +
  160 + // 4xx client error
  161 + if (response.status >= 400 && response.status < 500){
  162 + var errors = JSON.parse(response.data.message);
  163 + if(errors && errors.email){
  164 + vm.signupErrorMessage = 'E-mail já está em uso.';
  165 + }
  166 + }
  167 +
  168 + // 5xx server error
  169 + if (response.status >= 500 && response.status < 600){
  170 + vm.internalError = true;
  171 + }
174 }); 172 });
175 }; 173 };
176 174
177 AuthPageController.prototype.submitSignin = function(credentials) { 175 AuthPageController.prototype.submitSignin = function(credentials) {
178 var vm = this; 176 var vm = this;
179 177
180 - vm.AuthService.login(credentials).then(function(user) {  
181 - // handle view  
182 - vm.$log.debug('user', user); 178 + vm.AuthService.login(credentials)
  179 + .then(function(/*user*/) {
183 180
184 - vm.successMessage = 'Login efetuado com sucesso!';  
185 - vm.redirectBack();  
186 - }, function() { 181 + vm.showSigninSuccessMessage();
  182 + vm._startRedirect(); //
  183 + }, function(response) {
187 // handle view 184 // handle view
  185 + vm.$log.error('Error on "submitSignin"', response);
  186 +
  187 + vm.signinError = true;
  188 +
  189 + // 4xx client error
  190 + if ( response.status >= 400 && response.status < 500 ) {
  191 +
  192 + vm.signinErrorTitle = 'Erro!';
  193 + vm.signinErrorContent = response.data.message;
  194 +
  195 + if(response.status === 401){
  196 + vm.signinErrorTitle = 'Acesso não autorizado!';
  197 + vm.signinErrorContent = 'E-mail ou senha incorretos.';
  198 + }
  199 + }
  200 +
188 }); 201 });
189 }; 202 };
190 203
@@ -206,16 +219,24 @@ @@ -206,16 +219,24 @@
206 vm.AuthService.forgotPassword(data).then(function(response) { 219 vm.AuthService.forgotPassword(data).then(function(response) {
207 vm.$log.debug('recover success.response', response); 220 vm.$log.debug('recover success.response', response);
208 221
209 - vm.successRecoverMessageTitle = 'Pedido enviado sucesso!';  
210 - vm.successRecoverMessage = 'Verifique seu e-mail. Em instantes você receberá um e-mail com um link para redefinir sua senha.';  
211 - // vm.redirectBack(); 222 + vm.recoverSuccess = true;
  223 + // vm._startRedirect();
  224 +
212 }, function(response){ 225 }, function(response){
213 vm.$log.debug('recover error.response', response); 226 vm.$log.debug('recover error.response', response);
214 227
215 - var message = response.data.message;  
216 - vm.errorRecoverMessage = message; 228 + vm.recoverError = true;
  229 + vm.recoverErrorMessage = response.data.message;
217 230
218 - if(response.data.code === 500){ 231 + // Client Error
  232 + if (response.status >= 400 && response.status < 500){
  233 + if(response.status === 404){
  234 + vm.recoverErrorMessage = 'E-mail não cadastrado no Dialoga Brasil.';
  235 + }
  236 + }
  237 +
  238 + // Server Error
  239 + if (response.status >= 500 && response.status < 600){
219 vm.internalError = true; 240 vm.internalError = true;
220 } 241 }
221 }).catch(function(error){ 242 }).catch(function(error){
@@ -223,7 +244,76 @@ @@ -223,7 +244,76 @@
223 }); 244 });
224 }; 245 };
225 246
226 - AuthPageController.prototype.redirectBack = function() { 247 + AuthPageController.prototype.submitConfirmationForm = function($event, confirmationForm) {
  248 + var vm = this;
  249 +
  250 + // get form data
  251 + var data = {
  252 + login: confirmationForm.login.$modelValue,
  253 + captcha_text: confirmationForm.captcha_text.$modelValue
  254 + };
  255 +
  256 + // get captcha token
  257 + var target = $event.target;
  258 + var $target = angular.element(target);
  259 + var $captcha = $target.find('[name="txtToken_captcha_serpro_gov_br"]');
  260 + data.txtToken_captcha_serpro_gov_br = $captcha.val();
  261 +
  262 + vm.AuthService.resendConfirmation(data)
  263 + .then(function(response) {
  264 + vm.$log.debug('resendConfirmation success.response', response);
  265 +
  266 + vm.resendConfirmationSuccess = true;
  267 +
  268 + // Feedback para usuário já ativo na plataforma
  269 + var user = response.data[0];
  270 + if ( user && (user.active === true) ) {
  271 + vm.resendConfirmationSuccessTitle = 'Usuário já está ativo!';
  272 + vm.resendConfirmationSuccessMessage = 'O e-mail informado já foi confirmado.';
  273 + }else{
  274 + vm.resendConfirmationSuccessTitle = 'Pronto!';
  275 + vm.resendConfirmationSuccessMessage = 'Em instantes você receberá em seu e-mail um link para confirmar o seu cadastro.';
  276 + }
  277 +
  278 + }, function(response){
  279 + vm.$log.debug('resendConfirmation error.response', response);
  280 +
  281 + vm.resendConfirmationError = true;
  282 + vm.resendConfirmationErrorMessage = response.data.message;
  283 +
  284 + // Client Error
  285 + // if (response.status >= 400 && response.status < 500){}
  286 +
  287 + // Server Error
  288 + if (response.status >= 500 && response.status < 600){
  289 + vm.internalError = true;
  290 + }
  291 + }).catch(function(error){
  292 + vm.$log.debug('resendConfirmation catch.error', error);
  293 + });
  294 + };
  295 +
  296 + AuthPageController.prototype.clearMessages = function() {
  297 + var vm = this;
  298 +
  299 + // success
  300 + vm.signupSuccess = false;
  301 + vm.signinSuccess = false;
  302 + vm.confirmSuccess = false;
  303 +
  304 + // error
  305 + vm.signinError = false;
  306 + vm.signupError = false;
  307 +
  308 + };
  309 + AuthPageController.prototype.showSigninSuccessMessage = function() {
  310 + var vm = this;
  311 +
  312 + vm.signinSuccess = true;
  313 + vm.successMessage = 'Login efetuado com sucesso!';
  314 + };
  315 +
  316 + AuthPageController.prototype._startRedirect = function() {
227 var vm = this; 317 var vm = this;
228 318
229 if (!vm.hasRedirect) { 319 if (!vm.hasRedirect) {
@@ -233,6 +323,7 @@ @@ -233,6 +323,7 @@
233 323
234 // start countdown 324 // start countdown
235 vm.countdown = vm.delay; 325 vm.countdown = vm.delay;
  326 +
236 var stop = null; 327 var stop = null;
237 stop = vm.$interval(function() { 328 stop = vm.$interval(function() {
238 vm.countdown--; 329 vm.countdown--;
@@ -242,6 +333,7 @@ @@ -242,6 +333,7 @@
242 } 333 }
243 }, 1000); 334 }, 1000);
244 335
  336 + // start redirect delay
245 vm.$timeout(function() { 337 vm.$timeout(function() {
246 var state = vm.params.state; 338 var state = vm.params.state;
247 switch (state){ 339 switch (state){
@@ -267,7 +359,7 @@ @@ -267,7 +359,7 @@
267 359
268 AuthPageController.prototype.authWithFacebook = function() { 360 AuthPageController.prototype.authWithFacebook = function() {
269 var vm = this; 361 var vm = this;
270 - // var url = 'http://login.dialoga.gov.br/plugin/oauth_client/facebook?oauth_client_popup=true&id=1'; 362 +
271 var url = 'http://login.dialoga.gov.br/plugin/oauth_client/facebook?oauth_client_popup=true&id=' + vm.APP.facebook_app_id; 363 var url = 'http://login.dialoga.gov.br/plugin/oauth_client/facebook?oauth_client_popup=true&id=' + vm.APP.facebook_app_id;
272 vm.$window.oauthClientAction(url); 364 vm.$window.oauthClientAction(url);
273 }; 365 };
@@ -275,7 +367,7 @@ @@ -275,7 +367,7 @@
275 AuthPageController.prototype.authWithGooglePlus = function() { 367 AuthPageController.prototype.authWithGooglePlus = function() {
276 var vm = this; 368 var vm = this;
277 369
278 - var url = 'http://login.dialoga.gov.br/plugin/oauth_client/google_oauth2?oauth_client_popup=true&id=' + vm.APP.goople_app_id; 370 + var url = 'http://login.dialoga.gov.br/plugin/oauth_client/google_oauth2?oauth_client_popup=true&id=' + vm.APP.google_app_id;
279 vm.$window.oauthClientAction(url); 371 vm.$window.oauthClientAction(url);
280 }; 372 };
281 })(); 373 })();
src/app/pages/auth/change.html
@@ -9,18 +9,18 @@ @@ -9,18 +9,18 @@
9 <section role="main" class="section-gray"> 9 <section role="main" class="section-gray">
10 <div class="container"> 10 <div class="container">
11 <div class="row"> 11 <div class="row">
12 - <div ng-if="pageSignin.currentUser"> 12 + <div ng-if="pageAuth.currentUser">
13 <div class="row"> 13 <div class="row">
14 <div class="col-sm-8 col-sm-offset-2"> 14 <div class="col-sm-8 col-sm-offset-2">
15 <h3>Você está logado!</h3> 15 <h3>Você está logado!</h3>
16 <button 16 <button
17 type="button" 17 type="button"
18 - ng-click="pageSignin.onClickLogout()" 18 + ng-click="pageAuth.onClickLogout()"
19 class="btn btn-primary">Sair</button> 19 class="btn btn-primary">Sair</button>
20 </div> 20 </div>
21 </div> 21 </div>
22 </div> 22 </div>
23 - <div ng-if="!pageSignin.currentUser"> 23 + <div ng-if="!pageAuth.currentUser">
24 <br> 24 <br>
25 <div class="col-sm-8 col-sm-offset-2"> 25 <div class="col-sm-8 col-sm-offset-2">
26 <div class="row"> 26 <div class="row">
src/app/pages/auth/recover.html
@@ -12,54 +12,54 @@ @@ -12,54 +12,54 @@
12 <section role="main" class="section-gray vertical-padding"> 12 <section role="main" class="section-gray vertical-padding">
13 <div class="container"> 13 <div class="container">
14 <div class="row"> 14 <div class="row">
15 - <div ng-if="pageSignin.successRecoverMessage"> 15 + <div ng-if="pageAuth.recoverSuccess">
16 <div class="col-sm-8 col-sm-offset-2"> 16 <div class="col-sm-8 col-sm-offset-2">
17 - <div class="feedback-message">  
18 - <show-message  
19 - type="'success'"  
20 - message="pageSignin.successRecoverMessageTitle || 'Pronto!'"  
21 - description="pageSignin.successRecoverMessage"  
22 - ></show-message>  
23 - <div class="row">  
24 - <div class="col-sm-8 col-sm-offset-4">  
25 - <p><a ui-sref="inicio">Ir para página inicial</a></p>  
26 - </div>  
27 - </div>  
28 - </div>  
29 - </div>  
30 - </div>  
31 - <div ng-if="!pageSignin.successRecoverMessage"> 17 + <div class="feedback-message">
  18 + <show-message
  19 + type="'success'"
  20 + message="'Pronto!'"
  21 + description="'Em instantes você receberá em seu e-mail um link para criação de uma nova senha.'"
  22 + ></show-message>
  23 + <div class="row">
  24 + <div class="col-sm-8 col-sm-offset-4">
  25 + <p><a ui-sref="inicio">Ir para página inicial</a></p>
  26 + </div>
  27 + </div>
  28 + </div>
  29 + </div>
  30 + </div>
  31 + <div ng-if="!pageAuth.recoverSuccess">
32 <br> 32 <br>
33 <div class="col-sm-8 col-sm-offset-2"> 33 <div class="col-sm-8 col-sm-offset-2">
34 - <div class="row" ng-if="pageSignin.errorRecoverMessage">  
35 - <div class="col-sm-12">  
36 - <div class="alert alert-danger">{{pageSignin.errorRecoverMessage}}</div>  
37 - <div ng-if="vm.internalError">  
38 - <p>Este erro parece ser um problema interno.<br/>Por favor, tente novamente mais tarde.</p>  
39 - <p>Caso o problema persista, entre em contato!</p>  
40 - <p><a ui-sref="duvidas">Ir para página de contato</a></p>  
41 - </div>  
42 - </div>  
43 - </div> 34 + <div class="row" ng-if="pageAuth.recoverError">
  35 + <div class="col-sm-12">
  36 + <div class="alert alert-danger">{{pageAuth.recoverErrorMessage}}</div>
  37 + <div ng-if="vm.internalError">
  38 + <p>Este erro parece ser um problema interno.<br/>Por favor, tente novamente mais tarde.</p>
  39 + <p>Caso o problema persista, entre em contato!</p>
  40 + <p><a ui-sref="duvidas">Ir para página de contato</a></p>
  41 + </div>
  42 + </div>
  43 + </div>
44 <div class="row"> 44 <div class="row">
45 <div class="col-md-12"> 45 <div class="col-md-12">
46 - <form name="recoverPassForm" ng-submit="pageSignin.submitRecover($event, recoverPassForm)"> 46 + <form name="recoverPassForm" ng-submit="pageAuth.submitRecover($event, recoverPassForm)">
47 <div class="form-group"> 47 <div class="form-group">
48 <label for="recover-login">E-mail*</label> 48 <label for="recover-login">E-mail*</label>
49 - <input type="email" id="recover-login" name="login" class="form-control input-lg" ng-class="{ 'has-error' : recoverPassForm.login.$invalid && recoverPassForm.login.$touched }" ng-model="pageSignin.credentials.username" required /> 49 + <input type="email" id="recover-login" name="login" class="form-control input-lg" ng-class="{ 'has-error' : recoverPassForm.login.$invalid && recoverPassForm.login.$touched }" ng-model="pageAuth.credentials.username" required />
50 <validation-messages field=" recoverPassForm.login"></validation-messages> 50 <validation-messages field=" recoverPassForm.login"></validation-messages>
51 </div> 51 </div>
52 - <div class="form-group">  
53 - <div id="serpro_captcha" class="captcha">  
54 - </div>  
55 - <div class="captcha">  
56 - Digite os caracteres acima:  
57 - </div>  
58 - <div class="captcha">  
59 - <input type="text" name="captcha_text" id="captcha_text" aria-label="Escreva os caracteres do captcha aqui" ng-model="pageSignin.signup.captcha_text" ng-minlength="" ng-maxlength="" required>  
60 - <validation-messages field="recoverPassForm.captcha_text"></validation-messages>  
61 - </div>  
62 - </div> 52 + <div class="form-group">
  53 + <div id="serpro_captcha" class="captcha">
  54 + </div>
  55 + <div class="captcha">
  56 + Digite os caracteres acima:
  57 + </div>
  58 + <div class="captcha">
  59 + <input type="text" name="captcha_text" id="captcha_text" aria-label="Escreva os caracteres do captcha aqui" ng-model="pageAuth.signup.captcha_text" ng-minlength="" ng-maxlength="" required>
  60 + <validation-messages field="recoverPassForm.captcha_text"></validation-messages>
  61 + </div>
  62 + </div>
63 <div class="form-group"> 63 <div class="form-group">
64 <button class="btn btn-lg btn-submit" type="submit">Solicitar alteração de senha</button> 64 <button class="btn btn-lg btn-submit" type="submit">Solicitar alteração de senha</button>
65 </div> 65 </div>
src/app/pages/auth/resend-confirmation.html 0 → 100644
@@ -0,0 +1,79 @@ @@ -0,0 +1,79 @@
  1 +<div class="page--resend-confirmation">
  2 + <div class="container">
  3 + <div class="row">
  4 + <div class="col-sm-12">
  5 + <h2>Não recebeu o e-mail de confirmação?</h2>
  6 + <h5>
  7 + Calma, podemos te ajudar!
  8 + <br>
  9 + Basta informar o seu e-mail cadastrado que a gente envia um novo e-mail de confirmação.
  10 + </h5>
  11 + </div>
  12 + </div>
  13 + </div>
  14 + <section role="main" class="section-gray vertical-padding">
  15 + <div class="container">
  16 + <div class="row">
  17 + <div ng-if="pageAuth.resendConfirmationSuccess">
  18 + <div class="col-sm-8 col-sm-offset-2">
  19 + <div class="feedback-message">
  20 + <show-message
  21 + type="'success'"
  22 + message="pageAuth.resendConfirmationSuccessTitle"
  23 + description="pageAuth.resendConfirmationSuccessMessage"
  24 + ></show-message>
  25 + <div class="row">
  26 + <div class="col-sm-8 col-sm-offset-4">
  27 + <p><a ui-sref="inicio">Ir para página inicial</a></p>
  28 + </div>
  29 + </div>
  30 + </div>
  31 + </div>
  32 + </div>
  33 + <div ng-if="!pageAuth.resendConfirmationSuccess">
  34 + <br>
  35 + <div class="col-sm-8 col-sm-offset-2">
  36 + <div class="row" ng-if="pageAuth.resendConfirmationError">
  37 + <div class="col-sm-12">
  38 + <div class="alert alert-danger">
  39 + <strong>Erro!</strong>
  40 + O e-mail informado não possui cadastro no Dialoga Brasil.
  41 + </div>
  42 + <div ng-if="pageAuth.internalError">
  43 + <p>Este erro parece ser um problema interno.<br/>Por favor, tente novamente mais tarde.</p>
  44 + <p>Caso o problema persista, entre em contato!</p>
  45 + <p><a ui-sref="duvidas">Ir para página de contato</a></p>
  46 + </div>
  47 + </div>
  48 + </div>
  49 + <div class="row">
  50 + <div class="col-md-12">
  51 + <form name="confirmationForm" ng-submit="pageAuth.submitConfirmationForm($event, confirmationForm)">
  52 + <div class="form-group">
  53 + <label for="confirmation-login">E-mail*</label>
  54 + <input type="email" id="confirmation-login" name="login" class="form-control input-lg" ng-class="{ 'has-error' : confirmationForm.login.$invalid && confirmationForm.login.$touched }" ng-model="pageAuth.credentials.username" required />
  55 + <validation-messages field=" confirmationForm.login"></validation-messages>
  56 + </div>
  57 + <div class="form-group">
  58 + <div id="serpro_captcha" class="captcha"></div>
  59 + <div class="captcha">
  60 + Digite os caracteres acima:
  61 + </div>
  62 + <div class="captcha">
  63 + <input type="text" name="captcha_text" id="captcha_text" aria-label="Escreva os caracteres do captcha aqui" ng-model="pageAuth.signup.captcha_text" ng-minlength="" ng-maxlength="" required>
  64 + <validation-messages field="confirmationForm.captcha_text"></validation-messages>
  65 + </div>
  66 + </div>
  67 + <div class="form-group">
  68 + <button class="btn btn-lg btn-submit" type="submit">Solicitar novo e-mail de confirmação</button>
  69 + </div>
  70 + </form>
  71 + </div>
  72 + </div>
  73 + </div>
  74 + <br>
  75 + </div>
  76 + </div>
  77 + </div>
  78 + </section>
  79 +</div>
src/app/pages/auth/signin.html
@@ -5,29 +5,76 @@ @@ -5,29 +5,76 @@
5 </div> 5 </div>
6 </div> 6 </div>
7 </div> 7 </div>
  8 +
8 <section role="main" class="section-gray auth-content"> 9 <section role="main" class="section-gray auth-content">
9 <div class="container"> 10 <div class="container">
10 <div class="row"> 11 <div class="row">
11 - <div ng-if="pageSignin.currentUser || pageSignin.signupMessageTitle"> 12 +
  13 + <!-- Feedbakc SUCESSO: cadastro, confirmação, login -->
  14 + <div ng-if="pageAuth.signupSuccess || pageAuth.confirmSuccess || pageAuth.signinSuccess">
12 <div class="row"> 15 <div class="row">
13 <div class="col-sm-8 col-sm-offset-2"> 16 <div class="col-sm-8 col-sm-offset-2">
14 <div class="feedback-message"> 17 <div class="feedback-message">
15 - <show-message  
16 - type="'success'"  
17 - message="pageSignin.signupMessageTitle || 'Você está logado!'"  
18 - description="pageSignin.signupSuccessMessage"  
19 - ></show-message> 18 +
  19 + <!-- case: CADASTRO -->
  20 + <div ng-if="pageAuth.signupSuccess">
  21 + <show-message type="'success'"
  22 + message="'Cadastro efetuado com sucesso :)'"
  23 + description="'Agora você faz parte do Dialoga Brasil. Em instantes você receberá um link de ativação em seu e-mail. Basta clicar e ativar.'"
  24 + ></show-message>
  25 +
  26 + <div class="row">
  27 + <div class="col-sm-4"></div>
  28 + <div class="col-sm-8 text-center-sm">
  29 + <a class="btn btn-link" ui-sref="reenviar-email" style="padding: 10px 0;" title="Re-enviar e-mail de confirmação.">
  30 + <span class="glyphicon glyphicon-chevron-right" aria-hidden></span>Não recebi o e-mail.
  31 + </a>
  32 + </div>
  33 + </div>
  34 + </div>
  35 +
  36 + <!-- case: CONFIRM -->
  37 + <div ng-if="pageAuth.confirmSuccess">
  38 + <show-message type="'success'"
  39 + message="'Pronto!'"
  40 + description="'Agora você faz parte do Dialoga Brasil.'"
  41 + ></show-message>
20 42
21 - <div class="row">  
22 - <div class="col-sm-4"></div>  
23 - <div class="col-sm-8 text-center-sm">  
24 - <div ng-if="pageSignin.countdown > 0">  
25 - <p>  
26 - Você será redirecionado em menos de <b>{{pageSignin.countdown}} segundos</b>...  
27 - </p> 43 + <div class="row">
  44 + <div class="col-sm-4"></div>
  45 + <div class="col-sm-8 text-center-sm">
  46 + <div ng-if="pageAuth.countdown > 0">
  47 + <p>
  48 + Você será redirecionado para a página inicial em <b>{{pageAuth.countdown}} segundos</b>.
  49 + </p>
  50 + </div>
  51 + <div ng-if="!pageAuth.hasRedirect">
  52 + <a ui-sref="inicio" class="btn btn-primary">Ir para a Página Inicial</a>
  53 + </div>
28 </div> 54 </div>
29 - <div ng-if="!pageSignin.hasRedirect">  
30 - <a ui-sref="inicio" class="btn btn-primary">Ir para a Página Inicial</a> 55 + </div>
  56 + </div>
  57 +
  58 + <!-- case: LOGIN -->
  59 + <div ng-if="pageAuth.signinSuccess">
  60 + <show-message type="'success'"
  61 + message="'Login efetuado com sucesso!'"
  62 + description="''"
  63 + ></show-message>
  64 +
  65 + <div class="row">
  66 + <div class="col-sm-4"></div>
  67 + <div class="col-sm-8 text-center-sm">
  68 + <div ng-if="pageAuth.countdown > 0">
  69 + <p>
  70 + Você será redirecionado para a página anterior em <b>{{pageAuth.countdown}} segundos</b>.
  71 + </p>
  72 + </div>
  73 + <div ng-if="!pageAuth.hasRedirect">
  74 + <a ui-sref="inicio" class="btn btn-primary">Ir para a Página Inicial</a>
  75 + ou
  76 + <button type="button" class="btn btn-default" ng-click="vm.onClickLogout()">Sair</button>
  77 + </div>
31 </div> 78 </div>
32 </div> 79 </div>
33 </div> 80 </div>
@@ -35,28 +82,60 @@ @@ -35,28 +82,60 @@
35 </div> 82 </div>
36 </div> 83 </div>
37 </div> 84 </div>
38 - <div ng-if="!pageSignin.currentUser && !pageSignin.signupMessageTitle"> 85 +
  86 + <!-- USUÁRIO JÁ LOGADO -->
  87 + <div ng-if="pageAuth.currentUser && !(pageAuth.signupSuccess || pageAuth.confirmSuccess || pageAuth.signinSuccess)">
  88 + <br>
  89 + <show-message type="'success'"
  90 + message="'Você já está logado!'"
  91 + description="'Mas você ainda pode:'"
  92 + ></show-message>
  93 +
  94 + <div class="row">
  95 + <div class="col-sm-4"></div>
  96 + <div class="col-sm-8 text-center-sm">
  97 + <div ng-if="!pageAuth.hasRedirect">
  98 + <a ui-sref="inicio" class="btn btn-primary">Ir para a Página Inicial</a>
  99 + ou
  100 + <button type="button" class="btn btn-default" ng-click="vm.onClickLogout()">Sair</button>
  101 + </div>
  102 + </div>
  103 + </div>
  104 + <br>
  105 + </div>
  106 +
  107 + <!-- USUÁRIO NÃO-LOGADO -->
  108 + <div ng-if="!pageAuth.currentUser && !(pageAuth.signupSuccess || pageAuth.confirmSuccess || pageAuth.signinSuccess)">
  109 + <!-- LOGIN -->
39 <div class="col-sm-5"> 110 <div class="col-sm-5">
40 <div class="row"> 111 <div class="row">
41 <div class="col-md-12"> 112 <div class="col-md-12">
42 <h2>Já possui cadastro?</h2> 113 <h2>Já possui cadastro?</h2>
43 <p>Use seus dados para acessar o Dialoga Brasil</p> 114 <p>Use seus dados para acessar o Dialoga Brasil</p>
44 - <form role="form" name="signinForm" ng-submit="pageSignin.submitSignin(pageSignin.signin)" novalidate> 115 +
  116 + <!-- Feedback: ERRO no login -->
  117 + <div ng-if="pageAuth.signinError">
  118 + <div class="alert alert-danger" role="alert">
  119 + <strong>{{pageAuth.signinErrorTitle}}</strong> {{pageAuth.signinErrorContent}}
  120 + </div>
  121 + </div>
  122 +
  123 + <form role="form" name="signinForm" ng-submit="pageAuth.submitSignin(pageAuth.signin)" novalidate>
45 <div class="form-group"> 124 <div class="form-group">
46 <label for="signin-form--login">E-mail*</label> 125 <label for="signin-form--login">E-mail*</label>
47 - <input type="email" id="signin-form--login" name="login" class="form-control input-lg" ng-class="{ 'has-error' : signinForm.login.$invalid && signinForm.login.$touched }" ng-model="pageSignin.signin.username" required/> 126 + <input type="email" id="signin-form--login" name="login" class="form-control input-lg" ng-class="{ 'has-error' : signinForm.login.$invalid && signinForm.login.$touched }" ng-model="pageAuth.signin.username" required/>
48 <validation-messages field="signinForm.login"></validation-messages> 127 <validation-messages field="signinForm.login"></validation-messages>
49 </div> 128 </div>
50 <div class="form-group"> 129 <div class="form-group">
51 <label for="signin-form--password">Senha*</label> 130 <label for="signin-form--password">Senha*</label>
52 - <input type="password" id="signin-form--password" name="password" class="form-control input-lg" ng-class="{ 'has-error' : signinForm.password.$invalid && signinForm.password.$touched }" ng-model="pageSignin.signin.password" required> 131 + <input type="password" id="signin-form--password" name="password" class="form-control input-lg" ng-class="{ 'has-error' : signinForm.password.$invalid && signinForm.password.$touched }" ng-model="pageAuth.signin.password" required>
53 <validation-messages field="signinForm.password"></validation-messages> 132 <validation-messages field="signinForm.password"></validation-messages>
54 </div> 133 </div>
55 <div class="form-group"> 134 <div class="form-group">
56 <button class="btn btn-lg btn-block btn-submit" type="submit">Entrar</button> 135 <button class="btn btn-lg btn-block btn-submit" type="submit">Entrar</button>
57 </div> 136 </div>
58 <div class="form-group"> 137 <div class="form-group">
59 - <a ui-sref="recuperar" class="btn btn-lg btn-link">Esqueci minha senha</a> 138 + <a ui-sref="recuperar" class="btn btn-lg btn-link" style="padding: 10px 0;">Esqueci minha senha</a>
60 </div> 139 </div>
61 </form> 140 </form>
62 </div> 141 </div>
@@ -68,7 +147,7 @@ @@ -68,7 +147,7 @@
68 </div> 147 </div>
69 <div class="row"> 148 <div class="row">
70 <div class="col-xs-6"> 149 <div class="col-xs-6">
71 - <button type="button" ng-click="pageSignin.authWithFacebook()" class="btn btn-lg btn-block btn-social btn-facebook"> 150 + <button type="button" ng-click="pageAuth.authWithFacebook()" class="btn btn-lg btn-block btn-social btn-facebook">
72 <span aria-hidden="true" class="icon-circle icon-small icon-circle-social-facebook"> 151 <span aria-hidden="true" class="icon-circle icon-small icon-circle-social-facebook">
73 <span class="icon icon-social-facebook"></span> 152 <span class="icon icon-social-facebook"></span>
74 </span> 153 </span>
@@ -76,7 +155,7 @@ @@ -76,7 +155,7 @@
76 </button> 155 </button>
77 </div> 156 </div>
78 <div class="col-xs-6"> 157 <div class="col-xs-6">
79 - <button type="button" ng-click="pageSignin.authWithGooglePlus()" class="btn btn-lg btn-block btn-social btn-google-plus"> 158 + <button type="button" ng-click="pageAuth.authWithGooglePlus()" class="btn btn-lg btn-block btn-social btn-google-plus">
80 <span aria-hidden="true" class="icon-circle icon-small icon-circle-social-googleplus"> 159 <span aria-hidden="true" class="icon-circle icon-small icon-circle-social-googleplus">
81 <span class="icon icon-social-googleplus"></span> 160 <span class="icon icon-social-googleplus"></span>
82 </span> 161 </span>
@@ -87,6 +166,8 @@ @@ -87,6 +166,8 @@
87 </div> 166 </div>
88 <div class="col-sm-1"> 167 <div class="col-sm-1">
89 </div> 168 </div>
  169 +
  170 + <!-- CADASTRO -->
90 <div class="col-sm-6"> 171 <div class="col-sm-6">
91 <div class="row"> 172 <div class="row">
92 <div class="col-sm-12"> 173 <div class="col-sm-12">
@@ -96,10 +177,13 @@ @@ -96,10 +177,13 @@
96 </p> 177 </p>
97 </div> 178 </div>
98 </div> 179 </div>
99 - <div class="row" ng-if="pageSignin.signupErrorMessage"> 180 +
  181 + <!-- Feedback: ERRO no cadastro -->
  182 + <div class="row" ng-if="pageAuth.signupError">
100 <div class="col-sm-12"> 183 <div class="col-sm-12">
101 <div class="alert alert-danger"> 184 <div class="alert alert-danger">
102 - {{pageSignin.signupErrorMessage}} 185 + <strong>{{pageAuth.signupErrorTitle}}</strong>
  186 + {{pageAuth.signupErrorMessage}}
103 </div> 187 </div>
104 <div ng-if="vm.internalError"> 188 <div ng-if="vm.internalError">
105 <p>Este erro parece ser um problema interno.<br/>Por favor, tente novamente mais tarde.</p> 189 <p>Este erro parece ser um problema interno.<br/>Por favor, tente novamente mais tarde.</p>
@@ -110,30 +194,30 @@ @@ -110,30 +194,30 @@
110 </div> 194 </div>
111 <div class="row"> 195 <div class="row">
112 <div class="col-sm-12"> 196 <div class="col-sm-12">
113 - <form name="signupForm" ng-submit="pageSignin.submitSignup($event, pageSignin.signup)"> 197 + <form name="signupForm" ng-submit="pageAuth.submitSignup($event, pageAuth.signup)">
114 <div class="form-group"> 198 <div class="form-group">
115 <label for="signup-form--name">Nome*:</label> 199 <label for="signup-form--name">Nome*:</label>
116 <span class="pull-right">*Dados obrigatórios</span> 200 <span class="pull-right">*Dados obrigatórios</span>
117 - <input type="text" id="signup-form--name" name="name" class="form-control input-lg" ng-class="{ 'has-error' : signupForm.name.$invalid && signupForm.name.$touched }" ng-model="pageSignin.signup.name" ng-minlength="" ng-maxlength="" required> 201 + <input type="text" id="signup-form--name" name="name" class="form-control input-lg" ng-class="{ 'has-error' : signupForm.name.$invalid && signupForm.name.$touched }" ng-model="pageAuth.signup.name" ng-minlength="" ng-maxlength="" required>
118 <validation-messages field="signupForm.name"></validation-messages> 202 <validation-messages field="signupForm.name"></validation-messages>
119 </div> 203 </div>
120 <div class="form-group"> 204 <div class="form-group">
121 <label for="signup-form--email">E-mail*:</label> 205 <label for="signup-form--email">E-mail*:</label>
122 - <input type="email" id="signup-form--email" name="email" class="form-control input-lg" ng-class="{ 'has-error' : signupForm.email.$invalid && signupForm.email.$touched }" ng-model="pageSignin.signup.email" ng-minlength="" ng-maxlength="" required> 206 + <input type="email" id="signup-form--email" name="email" class="form-control input-lg" ng-class="{ 'has-error' : signupForm.email.$invalid && signupForm.email.$touched }" ng-model="pageAuth.signup.email" ng-minlength="" ng-maxlength="" required>
123 <validation-messages field="signupForm.email"></validation-messages> 207 <validation-messages field="signupForm.email"></validation-messages>
124 </div> 208 </div>
125 <div class="row"> 209 <div class="row">
126 <div class="col-sm-6"> 210 <div class="col-sm-6">
127 <div class="form-group"> 211 <div class="form-group">
128 <label for="signup-form--password">Senha*:</label> 212 <label for="signup-form--password">Senha*:</label>
129 - <input type="password" id="signup-form--password" name="password" class="form-control input-lg" ng-class="{ 'has-error' : signupForm.password.$invalid && signupForm.password.$touched }" ng-model="pageSignin.signup.password" ng-minlength="" ng-maxlength="" required> 213 + <input type="password" id="signup-form--password" name="password" class="form-control input-lg" ng-class="{ 'has-error' : signupForm.password.$invalid && signupForm.password.$touched }" ng-model="pageAuth.signup.password" ng-minlength="" ng-maxlength="" required>
130 <validation-messages field="signupForm.password"></validation-messages> 214 <validation-messages field="signupForm.password"></validation-messages>
131 </div> 215 </div>
132 </div> 216 </div>
133 <div class="col-sm-6"> 217 <div class="col-sm-6">
134 <div class="form-group"> 218 <div class="form-group">
135 <label for="signup-form--password-confirmation">Confirmar Senha*:</label> 219 <label for="signup-form--password-confirmation">Confirmar Senha*:</label>
136 - <input type="password" id="signup-form--password-confirmation" name="password_confirmation" class="form-control input-lg" ng-class="{ 'has-error' : signupForm.password_confirmation.$invalid && signupForm.password_confirmation.$touched }" ng-model="pageSignin.signup.password_confirmation" ng-minlength="" ng-maxlength="" required> 220 + <input type="password" id="signup-form--password-confirmation" name="password_confirmation" class="form-control input-lg" ng-class="{ 'has-error' : signupForm.password_confirmation.$invalid && signupForm.password_confirmation.$touched }" ng-model="pageAuth.signup.password_confirmation" ng-minlength="" ng-maxlength="" required>
137 <validation-messages field="signupForm.password_confirmation"></validation-messages> 221 <validation-messages field="signupForm.password_confirmation"></validation-messages>
138 </div> 222 </div>
139 </div> 223 </div>
@@ -155,7 +239,7 @@ @@ -155,7 +239,7 @@
155 <div class="form-group"> 239 <div class="form-group">
156 <div class="checkbox"> 240 <div class="checkbox">
157 <label for="user_terms_accepted"> 241 <label for="user_terms_accepted">
158 - <input type="checkbox" id="user_terms_accepted" name="user_terms_accepted" value="aceito" ng-model="pageSignin.signup.user_terms_accepted" required /> 242 + <input type="checkbox" id="user_terms_accepted" name="user_terms_accepted" value="aceito" ng-model="pageAuth.signup.user_terms_accepted" required />
159 Já li e concordo com os 243 Já li e concordo com os
160 <button type="button" class="btn btn-link" style="padding:0 0 4px 0;" data-toggle="modal" data-target="#modalTermosDeUso">Termos de Uso</button> 244 <button type="button" class="btn btn-link" style="padding:0 0 4px 0;" data-toggle="modal" data-target="#modalTermosDeUso">Termos de Uso</button>
161 </label> 245 </label>
@@ -169,12 +253,15 @@ @@ -169,12 +253,15 @@
169 Digite os caracteres acima: 253 Digite os caracteres acima:
170 </div> 254 </div>
171 <div class="captcha"> 255 <div class="captcha">
172 - <input type="text" name="captcha_text" id="captcha_text" aria-label="Escreva os caracteres do captcha aqui" ng-model="pageSignin.signup.captcha_text" ng-minlength="" ng-maxlength="" required> 256 + <input type="text" name="captcha_text" id="captcha_text" aria-label="Escreva os caracteres do captcha aqui" ng-model="pageAuth.signup.captcha_text" ng-minlength="" ng-maxlength="" required>
173 <validation-messages field="signupForm.captcha_text"></validation-messages> 257 <validation-messages field="signupForm.captcha_text"></validation-messages>
174 </div> 258 </div>
175 </div> 259 </div>
176 <div class="form-group"> 260 <div class="form-group">
177 - <button type="submit" class="btn btn-lg btn-block btn-submit" ng-class=" {'disabled' : !pageSignin.signup.user_terms_accepted }">Cadastrar</button> 261 + <button type="submit" class="btn btn-lg btn-block btn-submit" ng-class=" {'disabled' : !pageAuth.signup.user_terms_accepted }">Cadastrar</button>
  262 + </div>
  263 + <div class="form-group">
  264 + <a ui-sref="reenviar-email" class="btn btn-lg btn-link" style="padding: 10px 0;">Re-enviar e-mail de confirmação</a>
178 </div> 265 </div>
179 </form> 266 </form>
180 </div> 267 </div>
@@ -184,6 +271,7 @@ @@ -184,6 +271,7 @@
184 </div> 271 </div>
185 </div> 272 </div>
186 </section> 273 </section>
  274 +
187 <div class="modal fade" id="modalTermosDeUso" tabindex="-1" role="dialog" aria-labelledby="termosDeUsoLabel"> 275 <div class="modal fade" id="modalTermosDeUso" tabindex="-1" role="dialog" aria-labelledby="termosDeUsoLabel">
188 <div class="modal-dialog" role="document"> 276 <div class="modal-dialog" role="document">
189 <div class="modal-content"> 277 <div class="modal-content">
@@ -194,8 +282,8 @@ @@ -194,8 +282,8 @@
194 </button> 282 </button>
195 </div> 283 </div>
196 <div class="modal-body modal-termos-uso-body"> 284 <div class="modal-body modal-termos-uso-body">
197 - <div class="modal-termos-uso-body-inner" ng-if="pageSignin.terms">  
198 - <div ng-bind-html="pageSignin.terms.body"></div> 285 + <div class="modal-termos-uso-body-inner" ng-if="pageAuth.terms">
  286 + <div ng-bind-html="pageAuth.terms.body"></div>
199 </div> 287 </div>
200 </div> 288 </div>
201 </div> 289 </div>