<commit_before>import Ember from 'ember';
import EmberValidations from 'ember-validations';
import ENV from '../../config/environment';

export default Ember.Controller.extend(EmberValidations.Mixin, {

  validations: {
    "model.username": {
      presence: true,
      length: {
        minimum: 1,
        maximum: 16,
      },
      format: {
        with: /^\w+$/,
        message: "Only letters and numbers, please!",
      }
    },
    "model.acceptTos": {
      acceptance: true,
    }
  },
  actions: {
    cancel: function() {
      this.notifier.show("Signup cancelled");
      this.transitionToRoute("index");
    },
    submit: function() {
      var _this = this;
      Ember.$.post(ENV.apiHost + "/auth/" + this.get("model.provider") + "/create", this.get("model")).then(
        function(response) {
          _this.get("session").authenticate('authenticator:api', response);
          _this.notifier.show("Welcome to the site! You've successfully registered!");
          _this.transitionToRoute("user", response.username);
        }, function(error) {
          _this.notifier.error("Something went wrong. We've been notified. Please ensure you've filled out all fields");
        }
      );
    }
  }

});<commit_msg>remove unused error var<commit_after>import Ember from 'ember';
import EmberValidations from 'ember-validations';
import ENV from '../../config/environment';

export default Ember.Controller.extend(EmberValidations.Mixin, {

  validations: {
    "model.username": {
      presence: true,
      length: {
        minimum: 1,
        maximum: 16,
      },
      format: {
        with: /^\w+$/,
        message: "Only letters and numbers, please!",
      }
    },
    "model.acceptTos": {
      acceptance: true,
    }
  },
  actions: {
    cancel: function() {
      this.notifier.show("Signup cancelled");
      this.transitionToRoute("index");
    },
    submit: function() {
      var _this = this;
      Ember.$.post(ENV.apiHost + "/auth/" + this.get("model.provider") + "/create", this.get("model")).then(
        function(response) {
          _this.get("session").authenticate('authenticator:api', response);
          _this.notifier.show("Welcome to the site! You've successfully registered!");
          _this.transitionToRoute("user", response.username);
        }, function() {
          _this.notifier.error("Something went wrong. We've been notified. Please ensure you've filled out all fields");
        }
      );
    }
  }

});
{'fraction_non_alphanumeric': 0.1508672851956434, 'fraction_numerical': 0.0024203307785397336, 'mean_word_length': 2.5428571428571427, 'pattern_counts': {'":': 4, '<': 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': '2825765', 'n_tokens_mistral': 738, 'n_tokens_neox': 719, 'n_words': 159}