Commit 2f0bed5ac47bc04eea1d794924140f37ff017908

Authored by Leonardo Merlin
2 parents ab5cf704 c797ecb5

Merge branch 'fix-issues'

e2e/pages/layout.js
@@ -15,18 +15,18 @@ module.exports = function(){ @@ -15,18 +15,18 @@ module.exports = function(){
15 it('should have a "skip-to-search" anchor', function() { 15 it('should have a "skip-to-search" anchor', function() {
16 expect(page.skipToSearch.getText()).toEqual('Ir para a busca 3'); 16 expect(page.skipToSearch.getText()).toEqual('Ir para a busca 3');
17 }); 17 });
18 - it('should have a "skip-to-footer" anchor', function() {  
19 - expect(page.skipToFooter.getText()).toEqual('Ir para o rodapé 4');  
20 - }); 18 + // it('should have a "skip-to-footer" anchor', function() {
  19 + // expect(page.skipToFooter.getText()).toEqual('Ir para o rodapé 4');
  20 + // });
21 21
22 it('should have a accessibility anchor', function() { 22 it('should have a accessibility anchor', function() {
23 - expect(page.actionAccessibility.getText()).toEqual('Acessibilidade'); 23 + expect(page.actionAccessibility.getText()).toEqual('ACESSIBILIDADE');
24 }); 24 });
25 it('should have a adjust contrast anchor', function() { 25 it('should have a adjust contrast anchor', function() {
26 - expect(page.actionContrast.getText()).toEqual('Alto Contraste'); 26 + expect(page.actionContrast.getText()).toEqual('ALTO CONTRASTE');
27 }); 27 });
28 it('should have a sitemap anchor', function() { 28 it('should have a sitemap anchor', function() {
29 - expect(page.actionSitemap.getText()).toEqual('Mapa do Site'); 29 + expect(page.actionSitemap.getText()).toEqual('MAPA DO SITE');
30 }); 30 });
31 }); 31 });
32 32
gulp/server.js
@@ -84,7 +84,8 @@ function browserSyncInit(baseDir, browser) { @@ -84,7 +84,8 @@ function browserSyncInit(baseDir, browser) {
84 startPath: '/', 84 startPath: '/',
85 server: server, 85 server: server,
86 browser: browser, 86 browser: browser,
87 - ghostMode: false 87 + ghostMode: false,
  88 + scrollRestoreTechnique: 'cookie'
88 }); 89 });
89 } 90 }
90 91
src/app/components/auth/auth.service.js
@@ -66,8 +66,7 @@ @@ -66,8 +66,7 @@
66 66
67 function activate (code) { 67 function activate (code) {
68 var url = PATH.host + '/api/v1/activate'; 68 var url = PATH.host + '/api/v1/activate';
69 - var encodedData = 'private_token=' + API.token;  
70 - encodedData += '&activation_code=' + code; 69 + var encodedData = 'activation_code=' + code;
71 70
72 return $http 71 return $http
73 .patch(url, encodedData) 72 .patch(url, encodedData)
src/app/index.route.js
@@ -42,6 +42,17 @@ @@ -42,6 +42,17 @@
42 } 42 }
43 } 43 }
44 }) 44 })
  45 + .state('ativar', {
  46 + url: '/ativar/:activation_code',
  47 + ncyBreadcrumb: {label: 'Ativar e-mail'},
  48 + views: {
  49 + 'main': {
  50 + templateUrl: 'app/pages/auth/active.html',
  51 + controller: 'ActivePageController',
  52 + controllerAs: 'pageActive'
  53 + }
  54 + }
  55 + })
45 .state('recuperar', { 56 .state('recuperar', {
46 url: '/recuperar', 57 url: '/recuperar',
47 ncyBreadcrumb: {label: 'Recuperar senha'}, 58 ncyBreadcrumb: {label: 'Recuperar senha'},
src/app/pages/auth/active.controller.js 0 → 100644
@@ -0,0 +1,56 @@ @@ -0,0 +1,56 @@
  1 +(function() {
  2 + 'use strict';
  3 +
  4 + angular
  5 + .module('dialoga')
  6 + .controller('ActivePageController', ActivePageController);
  7 +
  8 + /** @ngInject */
  9 + function ActivePageController(AuthService, $state, $log) {
  10 + var vm = this;
  11 +
  12 + vm.AuthService = AuthService;
  13 + vm.$state = $state;
  14 + vm.$log = $log;
  15 +
  16 + vm.init();
  17 + vm.doActivation();
  18 +
  19 + vm.$log.debug('ActivePageController');
  20 + }
  21 +
  22 + ActivePageController.prototype.init = function() {
  23 + var vm = this;
  24 +
  25 + // init variables
  26 + vm.loading = true;
  27 + vm.activation_code = vm.$state.params.activation_code;
  28 + };
  29 +
  30 + ActivePageController.prototype.doActivation = function() {
  31 + var vm = this;
  32 +
  33 + vm.AuthService.activate(vm.activation_code).
  34 + then(function(response){
  35 + // SUCCESS
  36 + vm.$log.info('response', response);
  37 +
  38 + vm.successMessageTitle = 'Pronto!';
  39 + vm.successMessageContent = 'Conta ativada com sucesso!';
  40 + }, function(response){
  41 + // ERROR
  42 + vm.$log.error('response', response);
  43 +
  44 + vm.errorMessageTitle = 'Erro!';
  45 +
  46 + // Server Error
  47 + if(response.status >= 500 || response.status < 600){
  48 + vm.errorMessageContent = 'Código de ativação incorreto.';
  49 + }
  50 + })
  51 + .finally(function(data){
  52 + vm.$log.debug('finally', data);
  53 + vm.loading = false;
  54 + });
  55 + };
  56 +})();
src/app/pages/auth/active.html 0 → 100644
@@ -0,0 +1,48 @@ @@ -0,0 +1,48 @@
  1 +<div class="container">
  2 + <div class="row">
  3 + <div class="col-sm-12">
  4 + <h2>Ativar conta</h2>
  5 + </div>
  6 + </div>
  7 +</div>
  8 +<section role="main" class="section-gray">
  9 + <div class="container">
  10 + <div class="row">
  11 + <br>
  12 + <div class="col-sm-8 col-sm-offset-2">
  13 +
  14 + <div ng-if="pageActive.loading">
  15 + <h3>Aguarde...</h3>
  16 + <p>Estamos ativando a sua conta ({{::pageActive.activation_code}}).</p>
  17 + </div>
  18 +
  19 + <div ng-if="pageActive.successMessageTitle">
  20 + <show-message
  21 + type="'success'"
  22 + message="pageActive.successMessageTitle"
  23 + description="pageActive.successMessageContent"
  24 + ></show-message>
  25 + <div class="row">
  26 + <div class="col-sm-8 col-sm-offset-4">
  27 + <p><a ui-sref="entrar" class="btn btn-default">Entrar</a></p>
  28 + </div>
  29 + </div>
  30 + </div>
  31 +
  32 + <div ng-if="pageActive.errorMessageTitle">
  33 + <show-message
  34 + type="'error'"
  35 + message="pageActive.errorMessageTitle"
  36 + description="pageActive.errorMessageContent"
  37 + ></show-message>
  38 + <div class="row">
  39 + <div class="col-sm-8 col-sm-offset-4">
  40 + <p><a ui-sref="reenviar-email" class="btn btn-default">Re-enviar e-mail de confirmação</a></p>
  41 + </div>
  42 + </div>
  43 + </div>
  44 + </div>
  45 + <br>
  46 + </div>
  47 + </div>
  48 +</section>
src/app/pages/auth/auth.controller.js
@@ -266,8 +266,8 @@ @@ -266,8 +266,8 @@
266 vm.resendConfirmationSuccess = true; 266 vm.resendConfirmationSuccess = true;
267 267
268 // Feedback para usuário já ativo na plataforma 268 // Feedback para usuário já ativo na plataforma
269 - var user = response.data[0];  
270 - if ( user && (user.active === true) ) { 269 + var user = response.data.users[0];
  270 + if ( user && (user.activated === true) ) {
271 vm.resendConfirmationSuccessTitle = 'Usuário já está ativo!'; 271 vm.resendConfirmationSuccessTitle = 'Usuário já está ativo!';
272 vm.resendConfirmationSuccessMessage = 'O e-mail informado já foi confirmado.'; 272 vm.resendConfirmationSuccessMessage = 'O e-mail informado já foi confirmado.';
273 }else{ 273 }else{
src/app/pages/auth/change.html
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 <div class="row"> 2 <div class="row">
3 <div class="col-sm-12"> 3 <div class="col-sm-12">
4 <h2>Esqueci minha senha</h2> 4 <h2>Esqueci minha senha</h2>
5 - <h5>Agra é só criar e confirmar sua nova senha.</h5> 5 + <h5>Agora é só criar e confirmar sua nova senha.</h5>
6 </div> 6 </div>
7 </div> 7 </div>
8 </div> 8 </div>
src/app/pages/auth/resend-confirmation.html
@@ -24,7 +24,12 @@ @@ -24,7 +24,12 @@
24 ></show-message> 24 ></show-message>
25 <div class="row"> 25 <div class="row">
26 <div class="col-sm-8 col-sm-offset-4"> 26 <div class="col-sm-8 col-sm-offset-4">
27 - <p><a ui-sref="inicio">Ir para página inicial</a></p> 27 + <p>
  28 + Ir para:
  29 + <a ui-sref="inicio" class="btn btn-default">Página inicial</a>
  30 + ou
  31 + <a ui-sref="entrar" class="btn btn-primary">Entrar</a>
  32 + </p>
28 </div> 33 </div>
29 </div> 34 </div>
30 </div> 35 </div>
src/app/pages/erro/erro.html
1 <div class="page--erro"> 1 <div class="page--erro">
2 <div class="container"> 2 <div class="container">
3 <div class="row"> 3 <div class="row">
4 - <div class="row-height">  
5 - <div class="col-sm-4 col-sm-height col-middle">  
6 - <div class="inside inside-full-height">  
7 - <div class="content">  
8 - <span class="icon-circle icon-wrapper-rounded">  
9 - <span class="glyphicon glyphicon-remove" aria-hidden></span>  
10 - </span>  
11 - <h1>Erro</h1>  
12 - <p>  
13 - <span style="font-weight:bold;">Mas você ainda pode:</span>  
14 - <br>  
15 - <!-- <button type="button" class="btn btn-link" ng-click="goBack()">retornar à página anterior</button> -->  
16 - <!-- <span>&#8226;</span> -->  
17 - <button type="button" class="btn btn-link" ui-sref="inicio">retornar à página inicial</button>  
18 - </p>  
19 - </div> 4 + <div class="col-sm-8 col-sm-offset-2">
  5 + <show-message
  6 + type="'error'"
  7 + message="'Erro!'"
  8 + description="'Página não encontrada.'"
  9 + ></show-message>
  10 + <div class="row">
  11 + <div class="col-sm-4"></div>
  12 + <div class="col-sm-6">
  13 + <p>
  14 + <span style="font-weight:bold;">Mas você ainda pode:</span>
  15 + <br>
  16 + <!-- <button type="button" class="btn btn-link" ng-click="goBack()">retornar à página anterior</button> -->
  17 + <!-- <span>&#8226;</span> -->
  18 + <button type="button" class="btn btn-link" ui-sref="inicio">retornar à página inicial</button>
  19 + </p>
20 </div> 20 </div>
21 </div> 21 </div>
22 </div> 22 </div>
src/app/pages/erro/erro.scss
1 .page--erro { 1 .page--erro {
2 background-color: #f9f9f9; 2 background-color: #f9f9f9;
  3 + padding: 20px 0;
3 4
4 - h1 {  
5 - color: #464646;  
6 - font-size: 72px;  
7 - font-weight: bold;  
8 - margin-bottom: 40px;  
9 - }  
10 -  
11 - .row-height {  
12 - min-height: 400px;  
13 - }  
14 -  
15 - .content {  
16 - text-align: center;  
17 - }  
18 -  
19 - .icon-circle {  
20 - display: inline-block;  
21 - font-size: 40px;  
22 - line-height: 33px;  
23 - font-weight: normal;  
24 -  
25 - position: relative;  
26 - top: -5px;  
27 - padding: 20px;  
28 - margin-top: 5px;  
29 - margin-right: 30px; 5 + .show-message {
  6 + h3 {
  7 + font-weight: bold;
  8 + }
30 9
31 - color: #fff;  
32 - background: #c93e55; 10 + .glyphicon {
  11 + font-size: 40px;
  12 + }
33 } 13 }
34 14
35 - h1 {  
36 - display: inline-block; 15 + .btn-link {
  16 + padding: 0;
37 } 17 }
38 } 18 }