<commit_before>Teikei.module("User", function(User, App, Backbone, Marionette, $, _) {

  User.Controller = Backbone.Marionette.Controller.extend({

    initialize: function() {
      this.model = new Teikei.User.Model();
      this.menuView = new Teikei.User.MenuView({
        model: this.model
      });
      this.megaDropView = new Teikei.User.MegaDropView();
      this.loginView = new Teikei.User.LoginView({
        model: this.model
      });

      this.menuView.bind("signin:selected", this.signInPopup, this);
      this.menuView.bind("signup:selected", this.signUpPopup, this);
      this.menuView.bind("logout:selected", this.logout, this);
      this.loginView.bind("signInForm:submit", this.signIn, this);
      this.loginView.bind("signUpForm:submit", this.signUp, this);
      this.loginView.bind("signin:tab:click", this.signInPopup, this);
      this.loginView.bind("signup:tab:click", this.signUpPopup, this);

    },

    signInPopup: function() {
      App.userPopup.show(this.loginView);
      if (!this.model.tokenIsPresent()) {
        this.loginView.showSignInForm();
        Backbone.history.navigate('signin');
      }
    },

    signUpPopup: function() {
      App.userPopup.show(this.loginView);
      if (!this.model.tokenIsPresent()) {
        this.loginView.showSignUpForm();
        Backbone.history.navigate('signup');
      }
    },

    signIn: function(credentials) {
      var signInData = { user: credentials };

      this.model.signIn(signInData, {
        success: function(model, response, options) {
          App.vent.trigger("user:signin:success");
        },
        error: function(model, xhr, options) {
          App.vent.trigger("user:signin:fail", xhr);
        }
      });
    },

    signUp: function(credentials) {
      var signUpData = { user: credentials };<commit_msg>Avoid re-rendering popups on page reload when signed-in.<commit_after>Teikei.module("User", function(User, App, Backbone, Marionette, $, _) {

  User.Controller = Backbone.Marionette.Controller.extend({

    initialize: function() {
      this.model = new Teikei.User.Model();
      this.menuView = new Teikei.User.MenuView({
        model: this.model
      });
      this.megaDropView = new Teikei.User.MegaDropView();
      this.loginView = new Teikei.User.LoginView({
        model: this.model
      });

      this.menuView.bind("signin:selected", this.signInPopup, this);
      this.menuView.bind("signup:selected", this.signUpPopup, this);
      this.menuView.bind("logout:selected", this.logout, this);
      this.loginView.bind("signInForm:submit", this.signIn, this);
      this.loginView.bind("signUpForm:submit", this.signUp, this);
      this.loginView.bind("signin:tab:click", this.signInPopup, this);
      this.loginView.bind("signup:tab:click", this.signUpPopup, this);

    },

    signInPopup: function() {
      if (!this.model.tokenIsPresent()) {
        App.userPopup.show(this.loginView);
        this.loginView.showSignInForm();
        Backbone.history.navigate('signin');
      }
    },

    signUpPopup: function() {
      if (!this.model.tokenIsPresent()) {
        App.userPopup.show(this.loginView);
        this.loginView.showSignUpForm();
        Backbone.history.navigate('signup');
      }
    },

    signIn: function(credentials) {
      var signInData = { user: credentials };

      this.model.signIn(signInData, {
        success: function(model, response, options) {
          App.vent.trigger("user:signin:success");
        },
        error: function(model, xhr, options) {
          App.vent.trigger("user:signin:fail", xhr);
        }
      });
    },

    signUp: function(credentials) {
      var signUpData = { user: credentials };
{'fraction_non_alphanumeric': 0.14809819260857837, 'fraction_numerical': 0.0, 'mean_word_length': 2.9072708113804, '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': '6435058', 'n_tokens_mistral': 1180, 'n_tokens_neox': 1172, 'n_words': 175}