<commit_before>class UsersController < Spree::BaseController
  resource_controller
  
  before_filter :require_no_user, :only => [:new, :create]
  before_filter :require_user, :only => [:show, :edit, :update]

  ssl_required :new, :create, :edit, :update, :show
  
  actions :all, :except => [:index, :destroy]
	
	#Cannot use resource_controller for create action
	#as openID expects block passed to user.save method
	def create
	  @user = User.new(params[:user])
    unless session[:src].nil?
      @user.source = session[:src]
    end
    @user.save do |result|
	    if result       
	      flash[:notice] = t(:user_created_successfully) unless session[:return_to]
	       current_deal = DealHistory.find(:first, :conditions => "is_active = 1")
         product = Product.find(:first, :conditions =>"id = #{current_deal.product_id}")
         UserMailer.deliver_registration(@user,product)
         message = "Hi,Thanks for registering with  MasthiDeals.com. We will give you great deals from restaurants, spas, resorts etc  periodically- MasthiDeals team."
         send_sms(@user.phone_no,message)
        @user.roles << Role.find_by_name("admin") unless admin_created?
        if @user.refered_by.nil? or @user.refered_by.empty?
          redirect_to "http://192.168.1.14:3005/deals/verify_referer/1?email=#{@user.email}"
        else
          redirect_to "http://192.168.1.14:3005/deals/verify_referer/1?email=#{@user.email}&referer=#{@user.refered_by}"
        end
#        respond_to do |format|
#	        format.html { redirect_back_or_default home_url }
#	        format.js { render :js => true.to_json }
#	      end
	    else            
	      respond_to do |format|
	        format.html { render :action => :new }
	        format.js { render :js => @user.errors.to_json }
	      end
	    end
	  end
	end

  show.before :show_before
  new_action.before :new_action_before

  def update
    #load_object
   @user = current_user if current_user     <commit_msg>user controller url change<commit_after>class UsersController < Spree::BaseController
  resource_controller
  
  before_filter :require_no_user, :only => [:new, :create]
  before_filter :require_user, :only => [:show, :edit, :update]

  ssl_required :new, :create, :edit, :update, :show
  
  actions :all, :except => [:index, :destroy]
	
	#Cannot use resource_controller for create action
	#as openID expects block passed to user.save method
	def create
	  @user = User.new(params[:user])
    unless session[:src].nil?
      @user.source = session[:src]
    end
    @user.save do |result|
	    if result       
	      flash[:notice] = t(:user_created_successfully) unless session[:return_to]
	       current_deal = DealHistory.find(:first, :conditions => "is_active = 1")
         product = Product.find(:first, :conditions =>"id = #{current_deal.product_id}")
         UserMailer.deliver_registration(@user,product)
         message = "Hi,Thanks for registering with  MasthiDeals.com. We will give you great deals from restaurants, spas, resorts etc  periodically- MasthiDeals team."
         send_sms(@user.phone_no,message)
        @user.roles << Role.find_by_name("admin") unless admin_created?
        if @user.refered_by.nil? or @user.refered_by.empty?
          redirect_to "http://www.chennaimoms.com/deals/verify_referer/1?email=#{@user.email}"
        else
          redirect_to "http://www.chennaimoms.com/deals/verify_referer/1?email=#{@user.email}&referer=#{@user.refered_by}"
        end
#        respond_to do |format|
#	        format.html { redirect_back_or_default home_url }
#	        format.js { render :js => true.to_json }
#	      end
	    else            
	      respond_to do |format|
	        format.html { render :action => :new }
	        format.js { render :js => @user.errors.to_json }
	      end
	    end
	  end
	end

  show.before :show_before
  new_action.before :new_action_before

  def update
    #load_object
   @user = current_user if current_user     
{'fraction_non_alphanumeric': 0.11764705882352941, 'fraction_numerical': 0.008078767987881848, 'mean_word_length': 3.0677618069815193, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 2, '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': '4890766', 'n_tokens_mistral': 1310, 'n_tokens_neox': 1253, 'n_words': 289}