cart logic now ties cart with user when cart is created with logged in user
This commit is contained in:
@@ -1,4 +1,22 @@
|
||||
|
||||
helpers do
|
||||
def logged_in_user_id
|
||||
auth = cookies['ribica_auth']
|
||||
auth ||= -1
|
||||
return auth.to_i
|
||||
end
|
||||
|
||||
def anonymous_id
|
||||
auid = cookies[:anonymous_user_id]
|
||||
if auid.nil?
|
||||
auid = AnonymousUser.uid
|
||||
response.set_cookie('anonymous_user_id', :path=> '/', :httponly => true, :value=>auid, :expires=> Time.now + 100.year)
|
||||
end
|
||||
return auid
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
post '/user/logout' do
|
||||
response.delete_cookie("ribica_auth", :path => "/")
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user