This repository has been archived on 2021-11-24. You can view files and clone it, but cannot push or open issues or pull requests.
phone_app/app/controllers/public/p_customers_controller.rb
2021-08-23 10:26:02 +02:00

50 lines
1.2 KiB
Ruby

class Public::PCustomersController < ApplicationController
layout "public"
def new
@boutique_step = 2
@p_customer = PCustomer.new()
#@p_customer.particulars << Particular.new(:pro => false, :skip_validation => true)
#@p_customer.valid_public = true
end
def create
@boutique_step = 2
@p_customer = PCustomer.new(params.require(:p_customer).permit!)
#@p_customer.particulars << Particular.new(:pro => true, :skip_validation => true)
@p_customer.valid_public = true
@p_customer.locale = I18n.locale
if @p_customer.save
@p_customer.last_sign_in_at = Time.now
@p_customer.save(:validate => false)
cookies[:p_customer_auth_token] = @p_customer.auth_token
mail_hist = MailHist.generate_mail(@p_customer.locale, MailType.find_or_create("new_account"), @p_customer.email, {:arguments => {:email => @p_customer.email}, :p_customer => @p_customer, :element => @p_customer})
if params[:for_order]
redirect_to particulars_public_p_orders_path()
elsif
redirect_to public_my_account_path
end
else
render template: "public/p_customers/new"
end
end
end