<commit_before>Doorkeeper.configure do
  orm :active_record

  enable_application_owner :confirmation => true

  default_scopes  :public
  optional_scopes :user, :project, :group, :collection

  realm "Panoptes"

  resource_owner_authenticator do
    current_user || warden.authenticate!(scope: :user)
  end

  resource_owner_from_credentials do |routes|
    if u = User.find_for_database_authentication(login: params[:login])
      valid_non_disabled_user = u.valid_password?(params[:password]) && !u.disabled?
      u if valid_non_disabled_user
    end<commit_msg>Allow resource owner credentials with devise session<commit_after>Doorkeeper.configure do
  orm :active_record

  enable_application_owner :confirmation => true

  default_scopes  :public
  optional_scopes :user, :project, :group, :collection

  realm "Panoptes"

  resource_owner_authenticator do
    u = current_user || warden.authenticate!(scope: :user)
    u if !u.disabled?
  end

  resource_owner_from_credentials do |routes|
    if u = User.find_for_database_authentication(login: params[:login])
      valid_non_disabled_user = u.valid_password?(params[:password]) && !u.disabled?
    else
      u = current_user || warden.authenticate!(scope: :user)
      valid_non_disabled_user = !u.disabled?
    end

    u if valid_non_disabled_user
{'fraction_non_alphanumeric': 0.08771929824561403, 'fraction_numerical': 0.0, 'mean_word_length': 4.8053097345132745, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4532977', 'n_tokens_mistral': 418, 'n_tokens_neox': 404, 'n_words': 88}