<commit_before>import Ember from 'ember';
import ajax from 'ic-ajax';

export default Ember.Controller.extend({
  needs: 'application',
  auth_token: Ember.computed.alias('controllers.application.auth_token'),
  currentUser: Ember.computed.alias('controllers.application.currentUser'),
  email: null,
  password: <PASSWORD>,
  response: null,

  actions: {
    authenticate: function() {
      var self = this;
      ajax('/api/sign_in', {
        type: 'POST',
        data: this.getProperties('email', 'password')
      }).then(function(response) {
        self.set('response', response);
        self.set('auth_token', response.auth_token);
        var currentUser = response.user;
        currentUser.id = 'current';
        self.store.createRecord('user', currentUser);
        self.set('currentUser', self.store.find('user', 'current'));
        self.set('role', currentUser.role);
        self.transitionToRoute('dashboard');
      });
    },
    recover_password: function() {
      var self = this;
      ajax('/api/password_reset', {
        type: 'POST',
        data: {user: {email: this.get('email')}}
      }).then(function(response) {
        alert(self.get('email'));
        self.set('email', null);
      });
    },
    toggle_recovery: function() {
      Ember.$('.password-recovery').toggle();
      Ember.$('.login-modal').toggle();
    }
  }
});<commit_msg>Clear login fields on successful login<commit_after>import Ember from 'ember';
import ajax from 'ic-ajax';

export default Ember.Controller.extend({
  needs: 'application',
  auth_token: Ember.computed.alias('controllers.application.auth_token'),
  currentUser: Ember.computed.alias('controllers.application.currentUser'),
  email: null,
  password: null,
  response: null,

  actions: {
    authenticate: function() {
      var self = this;
      ajax('/api/sign_in', {
        type: 'POST',
        data: this.getProperties('email', 'password')
      }).then(function(response) {
        self.set('response', response);
        self.set('auth_token', response.auth_token);
        var currentUser = response.user;
        currentUser.id = 'current';
        self.store.createRecord('user', currentUser);
        self.set('currentUser', self.store.find('user', 'current'));
        self.set('role', currentUser.role);
        self.set('email', null);
        self.set('password', null);
        self.transitionToRoute('dashboard');
      });
    },
    recover_password: function() {
      var self = this;
      ajax('/api/password_reset', {
        type: 'POST',
        data: {user: {email: this.get('email')}}
      }).then(function(response) {
        self.set('email', null);
      });
    },
    toggle_recovery: function() {
      Ember.$('.password-recovery').toggle();
      Ember.$('.login-modal').toggle();
    }
  }
});
{'fraction_non_alphanumeric': 0.16927453769559034, 'fraction_numerical': 0.0, 'mean_word_length': 2.9508426966292136, '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': '3676683', 'n_tokens_mistral': 838, 'n_tokens_neox': 831, 'n_words': 154}