43 lines
809 B
Ruby
43 lines
809 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 = false
|
|
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_p_products_path
|
|
|
|
else
|
|
render template: "public/p_customer_auths/new"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|