<commit_before>module Erp
  class Users::ConfirmationsController < Devise::ConfirmationsController
    layout :set_layout

    private
      def after_confirmation_path_for(resource_name, resource)
        '/'
      end

      def set_layout
        return nil if request.xhr?

        if session[:current_view] == 'frontend'
          'erp/frontend/index'
        else
          "erp/backend/login"
        end
      end
  end
end
<commit_msg>confirmation link click more than once<commit_after>module Erp
  class Users::ConfirmationsController < Devise::ConfirmationsController
    layout :set_layout

    # GET /resource/confirmation?confirmation_token=abcdef
    def show
      self.resource = resource_class.confirm_by_token(params[:confirmation_token])
      yield resource if block_given?

      if resource.errors.empty?
        set_flash_message!(:notice, :confirmed)
        respond_with_navigational(resource){ redirect_to after_confirmation_path_for(resource_name, resource) }
      else
        flash[:notice] = "Your account is already confirmed. Please login."
        redirect_to '/#sign-in'
      end
    end

    private
      def after_confirmation_path_for(resource_name, resource)
        '/'
      end

      def set_layout
        return nil if request.xhr?

        if session[:current_view] == 'frontend'
          'erp/frontend/index'
        else
          "erp/backend/login"
        end
      end
  end
end

{'fraction_non_alphanumeric': 0.07181208053691275, 'fraction_numerical': 0.0, 'mean_word_length': 2.2913907284768213, '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': '4887658', 'n_tokens_mistral': 456, 'n_tokens_neox': 403, 'n_words': 92}