Commit 83464dc1c5daa1662a1d4483e241e438626c553d
1 parent
c7fa6720
Exists in
master
and in
2 other branches
After successful login, hide login button and show button to user profile whose …
…label is the user name
Showing
3 changed files
with
6 additions
and
6 deletions
Show diff stats
ConfJuvApp/www/html/_header.html
... | ... | @@ -2,7 +2,8 @@ |
2 | 2 | <h1 class="title">ConfJuv</h1> |
3 | 3 | |
4 | 4 | <div class="buttons"> |
5 | - <button class="button" ng-click="openModal()">Entrar</button> | |
5 | + <button class="button" ng-click="openModal()" ng-hide="loggedIn">Entrar</button> | |
6 | + <button class="button" ng-show="loggedIn">{{user.name}}</button> | |
6 | 7 | </div> |
7 | 8 | |
8 | 9 | <span ng-show="loading" class="loader"><em>Loading</em></span> | ... | ... |
ConfJuvApp/www/js/controllers.js
... | ... | @@ -50,14 +50,15 @@ angular.module('confjuvapp.controllers', []) |
50 | 50 | .then(function(resp) { |
51 | 51 | $scope.closeModal(); |
52 | 52 | var popup = $ionicPopup.alert({ title: 'Login', template: 'Login efetuado com sucesso!' }); |
53 | - ConfJuvAppUtils.loggedIn = true; | |
53 | + $scope.loggedIn = true; | |
54 | + $scope.user = resp.data.person; | |
54 | 55 | popup.then(function() { |
55 | 56 | $scope.loadDiscussions(resp.data.private_token); |
56 | 57 | }); |
57 | 58 | }, function(err) { |
58 | 59 | $scope.closeModal(); |
59 | 60 | var popup = $ionicPopup.alert({ title: 'Login', template: 'Erro ao efetuar login. Verifique usuário e senha e conexão com a internet.' }); |
60 | - ConfJuvAppUtils.loggedIn = false; | |
61 | + $scope.loggedIn = false; | |
61 | 62 | $scope.loading = false; |
62 | 63 | popup.then(function() { |
63 | 64 | $scope.openModal(); | ... | ... |