Commit 784ed0a550a5018065466d15238fc0cb1095454f

Authored by Caio Almeida
1 parent 8ec897f0

Finished login integration connected to juventude.org.br

ConfJuvApp/config.xml
1 <?xml version="1.0" encoding="UTF-8" standalone="yes"?> 1 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2 <widget id="com.ionicframework.confjuvapp748431" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> 2 <widget id="com.ionicframework.confjuvapp748431" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
3 <name>ConfJuvApp</name> 3 <name>ConfJuvApp</name>
4 - <description>  
5 - An Ionic Framework and Cordova project.  
6 - </description>  
7 - <author email="hi@ionicframework" href="http://ionicframework.com/">  
8 - Ionic Framework Team  
9 - </author> 4 + <description>Aplicativo móvel para 3ª Conferência Nacional de Juventude</description>
  5 + <author email="contato@juventude.gov.br" href="http://www.juventude.gov.br/"></author>
10 <content src="index.html"/> 6 <content src="index.html"/>
11 <access origin="*"/> 7 <access origin="*"/>
  8 + <allow-navigation href="*" />
  9 + <allow-intent href="*" />
12 <preference name="webviewbounce" value="false"/> 10 <preference name="webviewbounce" value="false"/>
13 <preference name="UIWebViewBounce" value="false"/> 11 <preference name="UIWebViewBounce" value="false"/>
14 <preference name="DisallowOverscroll" value="true"/> 12 <preference name="DisallowOverscroll" value="true"/>
@@ -38,4 +36,4 @@ @@ -38,4 +36,4 @@
38 <splash src="resources/android/splash/drawable-port-xxhdpi-screen.png" density="port-xxhdpi"/> 36 <splash src="resources/android/splash/drawable-port-xxhdpi-screen.png" density="port-xxhdpi"/>
39 <splash src="resources/android/splash/drawable-port-xxxhdpi-screen.png" density="port-xxxhdpi"/> 37 <splash src="resources/android/splash/drawable-port-xxxhdpi-screen.png" density="port-xxxhdpi"/>
40 </platform> 38 </platform>
41 -</widget>  
42 \ No newline at end of file 39 \ No newline at end of file
  40 +</widget>
ConfJuvApp/www/index.html
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 <meta charset="utf-8"> 4 <meta charset="utf-8">
5 <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> 5 <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
6 6
7 - <title>3ª Conferência Nacional de Juventude</title> 7 + <title>ConfJuvApp</title>
8 8
9 <!-- CSS --> 9 <!-- CSS -->
10 <link href="lib/ionic/css/ionic.css" rel="stylesheet"> 10 <link href="lib/ionic/css/ionic.css" rel="stylesheet">
ConfJuvApp/www/js/controllers.js
@@ -46,25 +46,22 @@ angular.module(&#39;confjuvapp.controllers&#39;, []) @@ -46,25 +46,22 @@ angular.module(&#39;confjuvapp.controllers&#39;, [])
46 46
47 $scope.loading = true; 47 $scope.loading = true;
48 48
49 - var req = {  
50 - method: 'POST',  
51 - url: ConfJuvAppUtils.pathTo('login'), 49 + var config = {
52 headers: { 50 headers: {
53 - 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' 51 + 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
54 }, 52 },
55 - data: jQuery.param(data) 53 + timeout: 10000
56 } 54 }
57 55
58 - $http(req)  
59 - .success(function(data, status, headers, config) { 56 + $http.post(ConfJuvAppUtils.pathTo('login'), jQuery.param(data), config)
  57 + .then(function(resp) {
60 $scope.closeModal(); 58 $scope.closeModal();
61 $ionicPopup.alert({ title: 'Login', template: 'Login efetuado com sucesso!' }); 59 $ionicPopup.alert({ title: 'Login', template: 'Login efetuado com sucesso!' });
62 ConfJuvAppUtils.loggedIn = true; 60 ConfJuvAppUtils.loggedIn = true;
63 $scope.loading = false; 61 $scope.loading = false;
64 - })  
65 - .error(function(data, status, headers, config) { 62 + }, function(err) {
66 $scope.closeModal(); 63 $scope.closeModal();
67 - var popup = $ionicPopup.alert({ title: 'Login', template: 'Erro ao efetuar login, por favor tente novamente.' }); 64 + var popup = $ionicPopup.alert({ title: 'Login', template: 'Erro ao efetuar login. Verifique usuário e senha e conexão com a internet.' });
68 ConfJuvAppUtils.loggedIn = false; 65 ConfJuvAppUtils.loggedIn = false;
69 $scope.loading = false; 66 $scope.loading = false;
70 popup.then(function() { 67 popup.then(function() {