<commit_before># -*- encoding : utf-8 -*-
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
  def self.provides_callback_for(*providers)
    providers.each do |provider|
      class_eval %Q{
        def #{provider}
          if !current_user.blank?
            current_user.bind_service(env["omniauth.auth"])#Add an auth to existing
            redirect_to setting_path, :notice => "Bind #{provider} account successfully."
          else
            @user = User.find_or_create_for_#{provider}(env["omniauth.auth"])
  
            if @user.persisted?
              @user.skip_confirmation!
              flash[:notice] = "Signed in with #{provider.to_s.titleize} successfully."
              
              auth = request.env['omniauth.auth']
              token = auth['credentials']['token']
              session[:fb_access_token] = token 
              
             sign_in_and_redirect @user, :event => :authentication, :notice => "Signed in successfully."
            else
              render "devise/registrations/new"
            end
          end
        end
      }<commit_msg>Update omniauth_callbacks_controller.rb<commit_after># -*- encoding : utf-8 -*-
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
  def self.provides_callback_for(*providers)
    providers.each do |provider|
      class_eval %Q{
        def #{provider}
          if !current_user.blank?
            current_user.bind_service(env["omniauth.auth"])#Add an auth to existing
            redirect_to setting_path, :notice => "Bind #{provider} account successfully."
          else
            @user = User.find_or_create_for_#{provider}(env["omniauth.auth"])
  
            if @user.persisted?
              @user.skip_confirmation!
              flash[:notice] = "Signed in with #{provider.to_s.titleize} successfully."
              
              auth = request.env['omniauth.auth']
              token = auth[:credentials][:token]
              session[:fb_access_token] = token 
              
             sign_in_and_redirect @user, :event => :authentication, :notice => "Signed in successfully."
            else
              render "devise/registrations/new"
            end
          end
        end
      }
{'fraction_non_alphanumeric': 0.10575221238938053, 'fraction_numerical': 0.0008849557522123894, 'mean_word_length': 2.101508916323731, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '2364490', 'n_tokens_mistral': 612, 'n_tokens_neox': 606, 'n_words': 123}