Mercurial Hosting > freedit
view src/private/admin/mail_config.html.luan @ 48:4e1a01db19ec
add lists
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 17 Nov 2022 00:11:44 -0700 |
parents | a17e400ddaa1 |
children |
line wrap: on
line source
local Luan = require "luan:Luan.luan" local error = Luan.error local stringify = Luan.stringify or error() local String = require "luan:String.luan" local trim = String.trim or error() local Html = require "luan:Html.luan" local html_encode = Html.encode or error() local Parsers = require "luan:Parsers.luan" local json_string = Parsers.json_string or error() local Io = require "luan:Io.luan" local Http = require "luan:http/Http.luan" local Mail = require "site:/lib/Mail.luan" local Shared = require "site:/lib/Shared.luan" local head = Shared.head or error() local header = Shared.admin_header or error() local Logging = require "luan:logging/Logging.luan" local logger = Logging.logger "admin/mail_config.html" --[[ local default = stringify{ host = "smtpcorp.com" username = "xxx" password = "xxx" port = 2525 } ]] return function() Io.stdout = Http.response.text_writer() local updated = false if Http.request.method == "POST" then local config = Http.request.parameters.config or error() if trim(config) == "" then config = nil end Mail.set(config) updated = true end %> <!doctype html> <html> <head> <% head() %> <title>FreedIt - Configure Mail</title> <style> textarea { width: 20em; height: 10em; } </style> </head> <body> <% header() %> <div content> <h1>Configure Mail</h1> <% if updated then %> <p>Updated</p> <% else %> <form method=post> <p><textarea name=config autofocus><%= html_encode(Mail.get() or "") %></textarea></p> <p><input type=submit><p> </form> <% end %> </div> </body> </html> <% end