diff --git a/app/controllers/public/customers_controller.rb b/app/controllers/public/customers_controller.rb index 2c0fc9b..ca6c7ed 100755 --- a/app/controllers/public/customers_controller.rb +++ b/app/controllers/public/customers_controller.rb @@ -68,9 +68,13 @@ class Public::CustomersController < ApplicationController params[:step] = "login" @no_search = true @customer = Customer.new(params.require(:customer).permit!) - + @customer.account_validated = true + if @customer.save - + @customer.reseauxes << Reseaux.find(16) + @customer.reseauxes << Reseaux.find(2) + @customer.domains << Domain.find(1) + CustomerMailer.confirm(@customer).deliver CustomerMailer.notify_ins(@customer).deliver @@ -80,12 +84,14 @@ class Public::CustomersController < ApplicationController cookies[:customer_auth_token] = @customer.token - if session[:for_annonce] - redirect_to new_public_annonce_path(:ins => "ins_finish"), notice: "Vous êtes désormais inscrit." - else - redirect_to public_my_account_path(:ins => "ins_finish"), notice: "Vous êtes désormais inscrit." - end - + #if session[:for_annonce] + # redirect_to new_public_annonce_path(:ins => "ins_finish"), notice: "Vous êtes désormais inscrit." + #else + # redirect_to public_my_account_path(:ins => "ins_finish"), notice: "Vous êtes désormais inscrit." + #end + redirect_to public_my_reseauxes_path(), notice: "Vous êtes désormais inscrit." + + if cookies[:video_read] == "true" flash[:read_video] = false else diff --git a/app/controllers/public/needs_controller.rb b/app/controllers/public/needs_controller.rb index dc39781..0b01b51 100755 --- a/app/controllers/public/needs_controller.rb +++ b/app/controllers/public/needs_controller.rb @@ -3,7 +3,7 @@ class Public::NeedsController < ApplicationController layout "public" before_filter :require_negos_abo before_filter :auth_customer - before_filter :check_enabled + #before_filter :check_enabled before_filter :build_category_tree, only:[:index,:new,:create,:edit,:update] @@ -34,6 +34,7 @@ class Public::NeedsController < ApplicationController else @needs = @needs.where(:reseaux_id => nil) end + @needs = @needs.domain_in(current_customer.domain_ids) # filters default value diff --git a/app/models/customer.rb b/app/models/customer.rb index 0f627b9..2bbe41c 100755 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -86,7 +86,7 @@ class Customer < ActiveRecord::Base validates :cp, :presence => true, :if => :step2 validates :city, :presence => true, :if => :step2 - validates :need_1 , :presence => true, :if => :step3 + #validates :need_1 , :presence => true, :if => :step3 # Geocoder