<commit_before>require 'fb_service'

class SessionsController < ApplicationController
  def create
    auth  = request.env["omniauth.auth"]
    token = auth["credentials"]["token"]
    user  = User.find_by_provider_and_uid(auth["provider"], auth["uid"]) || 
            User.create_with_omniauth(auth)
    user.token = token
    user.person.authorise! if (Settings.invitations == 'false' && user.person.has_email?)
    
    if auth['provider'] == 'facebook' && FacebookFriendsJob.week_since_last_run?(user)
      enqueue_facebook_friends_job user 
    end
    
    user.person.reset_notification_count!
    user.record_last_activity!
    user.save!

    session[:user_id]  = user.id
    session[:fb_token] = auth["credentials"]["token"] if auth['provider'] == 'facebook'
<commit_msg>Fixed the issue with new users not being authorised in dev.<commit_after>require 'fb_service'

class SessionsController < ApplicationController
  def create
    auth  = request.env["omniauth.auth"]
    token = auth["credentials"]["token"]
    user  = User.find_by_provider_and_uid(auth["provider"], auth["uid"]) || 
            User.create_with_omniauth(auth)
    user.token = token
    user.person.authorise! if (Settings.invitations == 'false' || Settings.invitations == nil) && user.person.has_email?
    if auth['provider'] == 'facebook' && FacebookFriendsJob.week_since_last_run?(user)
      enqueue_facebook_friends_job user 
    end
    user.person.reset_notification_count!
    user.record_last_activity!
    user.save!

    session[:user_id]  = user.id
    session[:fb_token] = auth["credentials"]["token"] if auth['provider'] == 'facebook'
	  
{'fraction_non_alphanumeric': 0.1295843520782396, 'fraction_numerical': 0.0, 'mean_word_length': 4.180379746835443, 'pattern_counts': {'":': 0, '<': 5, '<?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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6704138', 'n_tokens_mistral': 506, 'n_tokens_neox': 500, 'n_words': 90}