<commit_before>/*jslint white: true */
'use strict';

function SignupController($location, $scope, $routeParams, authenticateRequest, errorHandler, httpRequest, itemsRequest, userSession) {

  $scope.user = {};
  var inviteResponseCode;

  $scope.errorHandler = errorHandler;

  httpRequest.get('/api/invite/' + $routeParams.hex_code + '?email=' + $routeParams.email).then(function(inviteResponse) {
    if (inviteResponse.data.accepted) {
      $location.path('/login');
    } else {
      $scope.user.email = inviteResponse.data.email;
      inviteResponseCode = inviteResponse.data.code;
    }
  });

  function userLogin() {

    userSession.setCredentials($scope.user.email, $scope.user.password);

    authenticateRequest.login().then(function(authenticateResponse) {
      userSession.setUserSessionData(authenticateResponse);
      itemsRequest.getItems();
      $location.path('/my');
    }, function(authenticateResponse) {
      $scope.errorHandler.errorMessage = authenticateResponse.data;
    });
  }

  $scope.signUp = function() {
    httpRequest.post('/api/invite/' + inviteResponseCode, {email: $scope.user.email, password: $<PASSWORD>}).then(function() {
      userLogin();
    });
  };
}

SignupController.$inject = ['$location', '$scope', '$routeParams', 'authenticateRequest', 'errorHandler', 'httpRequest', 'itemsRequest', 'userSession'];
angular.module('em.app').controller('SignupController', SignupController);
<commit_msg>Fixed invalid URI for invite accept<commit_after>/*jslint white: true */
'use strict';

function SignupController($location, $scope, $routeParams, authenticateRequest, errorHandler, httpRequest, itemsRequest, userSession) {

  $scope.user = {};
  var inviteResponseCode;

  $scope.errorHandler = errorHandler;

  httpRequest.get('/api/invite/' + $routeParams.hex_code + '?email=' + $routeParams.email).then(function(inviteResponse) {
    if (inviteResponse.data.accepted) {
      $location.path('/login');
    } else {
      $scope.user.email = inviteResponse.data.email;
      inviteResponseCode = inviteResponse.data.code;
    }
  });

  function userLogin() {

    userSession.setCredentials($scope.user.email, $scope.user.password);

    authenticateRequest.login().then(function(authenticateResponse) {
      userSession.setUserSessionData(authenticateResponse);
      itemsRequest.getItems();
      $location.path('/my');
    }, function(authenticateResponse) {
      $scope.errorHandler.errorMessage = authenticateResponse.data;
    });
  }

  $scope.signUp = function() {
    httpRequest.post('/api/invite/' + inviteResponseCode + '/accept', {email: $scope.user.email, password: $scope.user.password}).then(function() {
      userLogin();
    });
  };
}

SignupController.$inject = ['$location', '$scope', '$routeParams', 'authenticateRequest', 'errorHandler', 'httpRequest', 'itemsRequest', 'userSession'];
angular.module('em.app').controller('SignupController', SignupController);

{'fraction_non_alphanumeric': 0.15651582170806397, 'fraction_numerical': 0.0, 'mean_word_length': 4.730994152046784, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '4769880', 'n_tokens_mistral': 872, 'n_tokens_neox': 846, 'n_words': 130}