Last active
July 1, 2016 19:29
-
-
Save sejr/a3f21bd2b42dbab8b1dd44375e88f8ce to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| controller: function($scope, $state) { | |
| $scope.fetchUser = function() { | |
| $scope.user = firebase.auth().currentUser; | |
| console.log("fetchUser() returns " + $scope.user); | |
| }; | |
| $scope.isAuthenticated = function() { | |
| if (firebase.auth().currentUser) { | |
| return true; | |
| } | |
| return false; | |
| }; | |
| $scope.deauth = function() { | |
| console.log('Deauth called'); | |
| firebase.auth().signOut().then(function() { | |
| $state.go($state.current, {}, {reload: true}); | |
| }, function(error) { | |
| // An error happened. | |
| console.log(error); | |
| }); | |
| }; | |
| $scope.fetchUser(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="col-lg-3 col-jnxn" id="jnxn-messaging"> | |
| <div class="card" ng-show="isAuthenticated()"> | |
| {{ user }} | |
| <hr> | |
| <button type="button" ng-click="deauth()" id="btn-join" class="btn btn-default btn-lg btn-block">Sign out</button> | |
| </div> | |
| <div class="card" ng-hide="isAuthenticated()"> | |
| <div class="ad" id="junction-ad"> | |
| <h4>Welcome to Junction!</h4> | |
| <p> | |
| {{ user }} | |
| </p> | |
| </div> | |
| <hr> | |
| <button type="submit" ui-sref="auth" id="btn-signin" class="btn btn-default btn-lg btn-block">Sign in</button> | |
| <button type="button" ui-sref="auth" id="btn-join" class="btn btn-default btn-lg btn-block">Join for free</button> | |
| </div> | |
| </div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment