Interim update
This commit is contained in:
27
Server/lib/Cookies.jl
Normal file
27
Server/lib/Cookies.jl
Normal file
@@ -0,0 +1,27 @@
|
||||
module Cookies
|
||||
|
||||
using HTTP, Dates, Genie
|
||||
|
||||
export set_cookies, set_remember, remove_remember
|
||||
|
||||
function set_cookies(params)
|
||||
request = params[:REQUEST]
|
||||
response = params[:RESPONSE]
|
||||
if !occursin("__genierememberme",string(request))
|
||||
headers = Genie.Responses.getheaders(response)
|
||||
headers["Set-Cookie"] = replace(headers["Set-Cookie"],"Max-Age=2592000;" => "")
|
||||
Genie.Responses.setheaders!(response,headers)
|
||||
end
|
||||
end
|
||||
#=
|
||||
function set_remember(params)
|
||||
#cookie_remember = HTTP.Cookies.Cookie("__genieremember", params[:SESSION].id, path="/", expires=now() + Dates.Month(1), httponly=true,samesite=HTTP.Cookies.SameSiteLaxMode)
|
||||
#HTTP.Cookies.addcookie!(params[:RESPONSE],cookie_remember)
|
||||
end
|
||||
|
||||
function remove_remember(params)
|
||||
#cookie_remember = HTTP.Cookies.Cookie("__genieremember", params[:SESSION].#id, path="/", httponly=true,samesite=HTTP.Cookies.SameSiteLaxMode)
|
||||
#HTTP.Cookies.addcookie!(params[:RESPONSE],cookie_remember)
|
||||
end
|
||||
=#
|
||||
end
|
53
Server/lib/EmailSupport/EmailSupport.jl
Normal file
53
Server/lib/EmailSupport/EmailSupport.jl
Normal file
@@ -0,0 +1,53 @@
|
||||
module EmailSupport
|
||||
|
||||
using Genie, Genie.Requests, Genie.Renderer.Json
|
||||
using SMTPClient, JSON3, Random
|
||||
|
||||
export send_email
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
function send_email(receiver,subject,message)
|
||||
url = "smtps://mail.privateemail.com:465"
|
||||
rcpt = ["<"*receiver*">","<info@chrn.health>"]
|
||||
from = "<no-reply@chrn.health>"
|
||||
|
||||
# Message body as RFC5322 within an IO
|
||||
to = [receiver]
|
||||
from = "no-reply@chrn.health"
|
||||
replyto = "Chiron <info@chrn.health>"
|
||||
body = get_body(to, from, subject, message; replyto)
|
||||
|
||||
resp = send(url, rcpt, from, body, opt)
|
||||
return resp
|
||||
end
|
||||
|
||||
# Load credentails
|
||||
function load_credentials_inner(path)
|
||||
credentials_text = open(joinpath(path,"credentials.json")) do f
|
||||
read(f, String)
|
||||
end
|
||||
credentials_json = JSON3.read(credentials_text)
|
||||
opt.username = credentials_json[:username]
|
||||
opt.passwd = credentials_json[:password]
|
||||
return
|
||||
end
|
||||
function load_credentials(path)
|
||||
load_credentials_inner(path)
|
||||
end
|
||||
function load_credentials()
|
||||
path = @__DIR__
|
||||
load_credentials_inner(path)
|
||||
end
|
||||
|
||||
opt = SendOptions(
|
||||
isSSL = true,
|
||||
username = "",
|
||||
passwd = ""
|
||||
)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
load_credentials()
|
||||
|
||||
end
|
4
Server/lib/EmailSupport/credentials.json
Normal file
4
Server/lib/EmailSupport/credentials.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"username": "info@chrn.health",
|
||||
"password": "Ur4tdgishg"
|
||||
}
|
Reference in New Issue
Block a user