<commit_before># app/controllers/registrations_controller.rb
class RegistrationsController < Devise::RegistrationsController

  def edit
    @languages = Language.order("name")
    @identifier_schemes = IdentifierScheme.where(active: true).order(:name)
  end

  # GET /resource
  def new
    oauth = {provider: nil, uid: nil}
    IdentifierScheme.all.each do |scheme|
      oauth = session["devise.#{scheme.name.downcase}_data"]
    end
    
    @user = User.new
    
    unless oauth.nil?
      # The OAuth provider could not be determined or there was no unique UID!
      if oauth.provider.nil? || oauth.uid.nil?
        flash[:notice] = t('identifier_schemes.new_login_failure')

      else
        # Connect the new user with the identifier sent back by the OAuth provider
        flash[:notice] = t('identifier_schemes.new_login_success')
        UserIdentifier.create(identifier_scheme: oauth.provider.upcase, 
                              identifier: oauth.uid,
                              user: @user)
      end
    end
  end

  # POST /resource
  def create
    logger.debug "#{sign_up_params}"
  	if sign_up_params[:accept_terms] != "1" then
  	  redirect_to after_sign_up_error_path_for(resource), alert: I18n.t('helpers.you_must_accept')
  	else
  		existing_user = User.find_by_email(sign_up_params[:email])
  		if !existing_user.nil? then<commit_msg>fixed nil check bug in registrations controller<commit_after># app/controllers/registrations_controller.rb
class RegistrationsController < Devise::RegistrationsController

  def edit
    @languages = Language.order("name")
    @identifier_schemes = IdentifierScheme.where(active: true).order(:name)
  end

  # GET /resource
  def new
    oauth = {provider: nil, uid: nil}
    IdentifierScheme.all.each do |scheme|
      oauth = session["devise.#{scheme.name.downcase}_data"] unless session["devise.#{scheme.name.downcase}_data"].nil?
    end
    
    @user = User.new
    
    unless oauth.nil?
      # The OAuth provider could not be determined or there was no unique UID!
      if oauth.provider.nil? || oauth.uid.nil?
        flash[:notice] = t('identifier_schemes.new_login_failure')

      else
        # Connect the new user with the identifier sent back by the OAuth provider
        flash[:notice] = t('identifier_schemes.new_login_success')
        UserIdentifier.create(identifier_scheme: oauth.provider.upcase, 
                              identifier: oauth.uid,
                              user: @user)
      end
    end
  end

  # POST /resource
  def create
    logger.debug "#{sign_up_params}"
  	if sign_up_params[:accept_terms] != "1" then
  	  redirect_to after_sign_up_error_path_for(resource), alert: I18n.t('helpers.you_must_accept')
  	else
  		existing_user = User.find_by_email(sign_up_params[:email])
  		if !existing_user.nil? then
{'fraction_non_alphanumeric': 0.09685401201838105, 'fraction_numerical': 0.0021208907741251328, 'mean_word_length': 3.0256045519203414, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5990262', 'n_tokens_mistral': 880, 'n_tokens_neox': 866, 'n_words': 197}