<commit_before>angular.module('thumbsCheckApp')
  .controller('LoginCtrl', function($scope, $location, $firebaseObject, Auth, Ref) {
    $scope.oauthLogin = function(provider) {
      $scope.err = null;
      Auth.$authWithOAuthPopup(provider, {
        rememberMe: true
      }).then(addUser, showError);
    };

    function addUser() {
      Ref.onAuth(function(user) {
        var instructorsObj = $firebaseObject(Ref.child('instructors'));
        var studentObj = $firebaseObject(Ref.child('students'));
        var userName;
        if (user) {
          instructorsObj.$loaded().then(function(instructorsTable) {
            if (instructorsTable[user.uid]) {
              $location.path('/instructor-main');
            } else {
              studentObj.$loaded().then(function(usersTable) {
                userName = user.github.displayName || 'Please fill in your name, ' + user.github.username;
                studentObj[user.uid] = userName;
                studentObj.$save();
                $location.path('/student-main');
              });
            }
          });
        }
      });
    }

    function showError(err) {
      $scope.err = err;
    }
  });
<commit_msg>Testing adding a role property on user<commit_after>angular.module('thumbsCheckApp')
  .controller('LoginCtrl', function($scope, $location, $firebaseObject, Auth, Ref) {
    $scope.oauthLogin = function(provider) {
      $scope.err = null;
      Auth.$authWithOAuthPopup(provider, {
        rememberMe: true
      }).then(addUser, showError);
    };

    function addUser() {
      Ref.onAuth(function(user) {
        var instructorsObj = $firebaseObject(Ref.child('instructors'));
        var studentObj = $firebaseObject(Ref.child('students'));
        var userName;
        if (user) {
          instructorsObj.$loaded().then(function(instructorsTable) {
            if (instructorsTable[user.uid]) {
              user.role = "instructor";
              console.log(user);
              $location.path('/instructor-main');
            } else {
              studentObj.$loaded().then(function(usersTable) {
                userName = user.github.displayName || 'Please fill in your name, ' + user.github.username;
                studentObj[user.uid] = userName;
                studentObj.$save();
                $location.path('/student-main');
              });
            }
          });
        }
      });
    }

    function showError(err) {
      $scope.err = err;
    }
  });

{'fraction_non_alphanumeric': 0.13969404186795492, 'fraction_numerical': 0.0, 'mean_word_length': 2.0641183723797782, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5606818', 'n_tokens_mistral': 703, 'n_tokens_neox': 692, 'n_words': 111}