kaps_app/app/controllers/public/p_customers_controller.rb
Nicolas Bally d60301e8a7 initial
2019-01-21 01:15:10 +01:00

43 lines
807 B
Ruby

# -*- encoding : utf-8 -*-
class Public::PCustomersController < ApplicationController
layout "public"
def new
@p_customer = PCustomer.new()
@p_customer.particulars << Particular.new(:pro => true, :skip_validation => true)
end
def create
@p_customer = PCustomer.new(params.require(:p_customer).permit!)
@p_customer.particulars << Particular.new(:pro => true, :skip_validation => true)
@p_customer.account_validated = true
if @p_customer.save
@p_customer.last_sign_in_at = Time.now
@p_customer.save(:validate => false)
cookies[:p_customer_auth_token] = @p_customer.token
redirect_to public_my_account_path
else
render template: "public/p_customer_auths/new"
end
end
end