<commit_before>class User < ActiveRecord::Base
  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable,
         :omniauthable, :omniauth_providers => [:facebook, :twitter]

  mount_uploader :profile_photo, ProfilePhotoUploader

  searchkick
  has_many :posts
  has_many :comments

  def my_posts
    Post.where(:user_id => self.id).order('created_at DESC')
  end

  def self.from_omniauth(auth)
    user = self.where(provider: auth.provider, uid: auth.uid).first_or_initialize do |user|
      user.email = auth.info.email
      user.password = <PASSWORD>_token[0,20]
    end

    user.picture_url = auth.info.image

    if auth.provider.eql?('twitter')
      user.username = auth.info.nickname
      user.save(validate: false) # because twitter does not provide email
    else
      user.username auth.info.name
      user.save
    end

    return user
  end
end<commit_msg>fixed assignment :anger:<commit_after>class User < ActiveRecord::Base
  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable,
         :omniauthable, :omniauth_providers => [:facebook, :twitter]

  mount_uploader :profile_photo, ProfilePhotoUploader

  searchkick
  has_many :posts
  has_many :comments

  def my_posts
    Post.where(:user_id => self.id).order('created_at DESC')
  end

  def self.from_omniauth(auth)
    user = self.where(provider: auth.provider, uid: auth.uid).first_or_initialize do |user|
      user.email = auth.info.email
      user.password = <PASSWORD>ise.friendly_token[0,20]
    end

    user.picture_url = auth.info.image

    if auth.provider.eql?('twitter')
      user.username = auth.info.nickname
      user.save(validate: false) # because twitter does not provide email
    else
      user.username = auth.info.name
      user.save
    end

    return user
  end
end
{'fraction_non_alphanumeric': 0.0996708979783733, 'fraction_numerical': 0.0028208744710860366, 'mean_word_length': 3.6160520607375273, 'pattern_counts': {'":': 0, '<': 7, '<?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': '5959117', 'n_tokens_mistral': 687, 'n_tokens_neox': 650, 'n_words': 155}