<commit_before>import { inject as service } from '@ember/service';

import OAuth2PasswordGrant from 'ember-simple-auth/authenticators/oauth2-password-grant';

export default OAuth2PasswordGrant.extend({
  ajax: service(),

  clientId: 'skylines.aero',
  serverTokenEndpoint: '/api/oauth/token',
  serverTokenRevocationEndpoint: '/api/oauth/revoke',

  async authenticate() {
    let data = await this._super(...arguments);
    return this._addSettings(data);
  },

  async restore() {
    let data = await this._super(...arguments);
    return this._addSettings(data);
  },

  async _addSettings(data) {
    let headers = {};
    if (data.access_token) {
      headers['Authorization'] = `Bearer ${data.access_token}`;
    }

    data.settings = await this.ajax.request('/api/settings', { headers });
    return data;
  },
});
<commit_msg>authenticators/oauth2: Convert to ES6 class<commit_after>import { inject as service } from '@ember/service';

import OAuth2PasswordGrant from 'ember-simple-auth/authenticators/oauth2-password-grant';

export default class extends OAuth2PasswordGrant {
  @service ajax;

  clientId = 'skylines.aero';
  serverTokenEndpoint = '/api/oauth/token';
  serverTokenRevocationEndpoint = '/api/oauth/revoke';

  async authenticate() {
    let data = await super.authenticate(...arguments);
    return this._addSettings(data);
  }

  async restore() {
    let data = await super.restore(...arguments);
    return this._addSettings(data);
  }

  async _addSettings(data) {
    let headers = {};
    if (data.access_token) {
      headers['Authorization'] = `Bearer ${data.access_token}`;
    }

    data.settings = await this.ajax.request('/api/settings', { headers });
    return data;
  }
}

{'fraction_non_alphanumeric': 0.13895348837209304, 'fraction_numerical': 0.004651162790697674, 'mean_word_length': 3.847887323943662, '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': '2212266', 'n_tokens_mistral': 545, 'n_tokens_neox': 522, 'n_words': 110}