mirror of
https://github.com/hkalexling/Mango.git
synced 2026-04-25 00:00:52 -04:00
Use a helper function to set token cookie
This commit is contained in:
@@ -135,3 +135,10 @@ end
|
||||
macro render_xml(path)
|
||||
send_file env, ECR.render({{path}}).to_slice, "application/xml"
|
||||
end
|
||||
|
||||
def set_token_cookie(env, token)
|
||||
cookie = HTTP::Cookie.new "token-#{Config.current.port}", token
|
||||
cookie.path = Config.current.base_url
|
||||
cookie.expires = Time.local.shift years: 1
|
||||
env.response.cookies << cookie
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user