<commit_before>var util = require('util');
var Tab = require('../client/tab').Tab;

var SignupTab = function() {
  Tab.call(this);
};

util.inherits(SignupTab, Tab);

SignupTab.prototype.pageMode = 'single';
SignupTab.prototype.parent = 'main';

SignupTab.prototype.generateHtml = function() {
  return require('../../jade/tabs/signup.jade')();
};

SignupTab.prototype.angular = function(module) {
  var app = this.app;

  module.controller('SignupCtrl', ['$scope', '$location', 'rpId', 'rpGiveaway', '$routeParams',

  function($scope, $location, $id, $giveaway, $routeParams) {
    // set errors
    $scope.errors = ($routeParams.errors) ? $routeParams.errors.split(',') : [];
    // handle register
    if (_.contains($scope.errors, 'cutoff')) {
      $scope.step = 'errors';
    } else if ($routeParams.register) {
      // if already confirmed redirect to register page
      if (_.contains($scope.errors, 'already_confirmed')) $location.path('/register');
      // if an address is already associated redirect to login
      else if (_.contains($scope.errors, 'address_associated')) $location.path('/login');

      $scope.step = 'two';
      $scope.name = $routeParams.name;
      $scope.email = $routeParams.email;
    } else {
      $scope.step = 'one';
    }

    $scope.oauth = function() {
      $scope.sending = false;
      window.location = Options.giveawayServer + Options.githubOauth;
    };

    $scope.step_two = function() {
      $.post(Options.giveawayServer + '/user/' + $routeParams.id, {<commit_msg>redirecting if old register url<commit_after>var util = require('util');
var Tab = require('../client/tab').Tab;
var webutil = require('../util/web');

var SignupTab = function() {
  Tab.call(this);
};

util.inherits(SignupTab, Tab);

SignupTab.prototype.pageMode = 'single';
SignupTab.prototype.parent = 'main';

SignupTab.prototype.generateHtml = function() {
  return require('../../jade/tabs/signup.jade')();
};

SignupTab.prototype.angular = function(module) {
  var app = this.app;

  module.controller('SignupCtrl', ['$scope', '$location', 'rpId', 'rpGiveaway', '$routeParams',

  function($scope, $location, $id, $giveaway, $routeParams) {
    // set errors
    $scope.errors = ($routeParams.errors) ? $routeParams.errors.split(',') : [];
    // handle register
    if (_.contains($scope.errors, 'cutoff')) {
      $scope.step = 'errors';
    } else if ($routeParams.register) {
      // test to see if user has confirmed
      $.post(Options.giveawayServer + '/user/' + $routeParams.id, {
        action: 'associated',
        register: $routeParams.register
      }, function(d) {
        if (d.associated)
          webutil.redirect('/signup');
        else {
          // if already confirmed redirect to register page
          if (_.contains($scope.errors, 'already_confirmed')) $location.path('/register');
          // if an address is already associated redirect to login
          else if (_.contains($scope.errors, 'address_associated')) $location.path('/login');

          $scope.step = 'two';
          $scope.name = $routeParams.name;
          $scope.email = $routeParams.email;
          $scope.$apply();
        }
      });
    } else {
      $scope.step = 'one';
    }

    $scope.oauth = function() {
      $scope.sending = false;
      window.location = Options.giveawayServer + Options.githubOauth;
    };

    $scope.step_two = function() {
      $.post(Options.giveawayServer + '/user/' + $routeParams.id, {
{'fraction_non_alphanumeric': 0.17181634421022235, 'fraction_numerical': 0.0, 'mean_word_length': 3.104265402843602, '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': '1033338', 'n_tokens_mistral': 1074, 'n_tokens_neox': 1048, 'n_words': 221}