<commit_before>class ApplicationController < ActionController::Base
  protect_from_forgery

  helper_method :campus, :campus_short_name, :campus_to_url, :campus_to_url_name


  def login
    user = User.find_by_external_id(request.headers[DATASHARE_CONFIG['external_identifier']])
    if user.nil?
      user = User.new
      user.external_id = request.headers[DATASHARE_CONFIG['external_identifier']]
      user.email = DATASHARE_CONFIG['user_email_from_shibboleth']
      user.save
    end
    if user.email.nil?
      user.email = DATASHARE_CONFIG['user_email_from_shibboleth']
      user.save
    end
    session[:user_id] = user.id
    redirect_to "/records"
  end


  def url_to_campus 
  	id = request.headers[DATASHARE_CONFIG['external_identifier']]
   	if ( id == nil )
     	@campus = "cdl"
    else
	     case id.strip
	     when /.*@.*ucop.<EMAIL>$/
	       @campus = "cdl"
	     when /.*@.*uci.edu$/
	       @campus = "uci"<commit_msg>check if login works<commit_after>class ApplicationController < ActionController::Base
  protect_from_forgery

  helper_method :campus, :campus_short_name, :campus_to_url, :campus_to_url_name


  def login
    user = User.find_by_external_id(request.headers[DATASHARE_CONFIG['external_identifier']])
    if user.nil?
      user = User.new
      user.external_id = request.headers[DATASHARE_CONFIG['external_identifier']]
      user.email = DATASHARE_CONFIG['user_email_from_shibboleth']
      user.save
    end
    if user.email.nil?
      user.email = "<EMAIL>"
      user.save
    end
    session[:user_id] = user.id
    redirect_to "/records"
  end


  def url_to_campus 
  	id = request.headers[DATASHARE_CONFIG['external_identifier']]
   	if ( id == nil )
     	@campus = "cdl"
    else
	     case id.strip
	     when /.*@.*ucop.edu$/
	       @campus = "cdl"
	     when /.*@.*uci.edu$/
	       @campus = "uci"
{'fraction_non_alphanumeric': 0.11385606874328678, 'fraction_numerical': 0.0, 'mean_word_length': 3.1216814159292037, 'pattern_counts': {'":': 0, '<': 7, '<?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': '239063', 'n_tokens_mistral': 673, 'n_tokens_neox': 643, 'n_words': 110}