<commit_before>(function() {
  angular.module('notely.login', [
    'ui.router'
  ])
  .config(loginConfig);

  loginConfig['$inject'] = ['$stateProvider'];
  function loginConfig($stateProvider) {
    $stateProvider

      .state('login', {
        url: '/login',
        templateUrl: '/login/login.html',
        controller: LoginController
      });
  }

  LoginController['$inject'] = ['$scope', '$state', 'CurrentUser', 'login'];
  function LoginController($scope, $state, CurrentUser, login) {
    if(CurrentUser.get().id) {
      $state.go('notes.form');
    }
    $scope.user = {};

    $scope.login = function() {
      login.login($scope.user).success(function(result) {
        $state.go('notes.form', { noteId: undefined });
      });<commit_msg>When already logged in, immediately redirect to notes.<commit_after>(function() {
  angular.module('notely.login', [
    'ui.router'
  ])
  .config(loginConfig);

  loginConfig['$inject'] = ['$stateProvider'];
  function loginConfig($stateProvider) {
    $stateProvider

      .state('login', {
        url: '/login',
        templateUrl: '/login/login.html',
        controller: LoginController,
        resolve: {
          loggedOut: function($q, $state, CurrentUser) {
            var deferred = $q.defer();
            if (CurrentUser.get().id) {
              $state.go('notes.form');
              deferred.reject();
            }
            else {
              deferred.resolve();
            }
            return deferred.promise;
          }
        }
      });
  }

  LoginController['$inject'] = ['$scope', '$state', 'CurrentUser', 'login'];
  function LoginController($scope, $state, CurrentUser, login) {
    $scope.user = {};

    $scope.login = function() {
      login.login($scope.user).success(function(result) {
        $state.go('notes.form', { noteId: undefined });
      });
{'fraction_non_alphanumeric': 0.17501346257404415, 'fraction_numerical': 0.0, 'mean_word_length': 2.5056603773584905, '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': '3347665', 'n_tokens_mistral': 546, 'n_tokens_neox': 536, 'n_words': 91}