Mercurial Hosting > chat
view src/account.html.luan @ 34:62d04ca486dd
UI
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 12 Nov 2024 16:08:24 -0700 |
parents | 5a56297713a3 |
children | 7ea33179592a |
line wrap: on
line source
local Luan = require "luan:Luan.luan" local error = Luan.error local Io = require "luan:Io.luan" local Http = require "luan:http/Http.luan" local Shared = require "site:/lib/Shared.luan" local head = Shared.head or error() local header = Shared.header or error() local Utils = require "site:/lib/Utils.luan" local base_url = Utils.base_url or error() local User = require "site:/lib/User.luan" local current_user = User.current_required or error() return function() local user = current_user() if user == nil then return end Io.stdout = Http.response.text_writer() %> <!doctype html> <html> <head> <% head() %> <script> 'use strict'; function deleteUser() { let dialog = document.querySelector('dialog[delete_user]'); openModal(dialog); } function doDeleteUser(el) { closeModal(el); ajax('delete_user.js'); } </script> <style> div[content] { margin-left: auto; margin-right: auto; width: fit-content; } h1 { text-align: center; } </style> </head> <body> <% header() %> <div content> <h1>Your Account</h1> <p><a href="about.html">About Web Chat</a></p> <p>Your URL: <%= base_url() %>/?with=<%=user.email%></p> <p><a href="javascript:logout()">Logout</a></p> <p><a href="javascript:deleteUser()">Delete account</a></p> </div> <dialog delete_user> <h2>Delete Account</h2> <p>Are you sure that you want to delete your account?</p> <div buttons> <button cancel onclick="closeModal(this)">Cancel</button> <button go onclick="doDeleteUser(this)">Delete</button> </div> </dialog> </body> </html> <% end