Mercurial Hosting > chat
diff src/relogin.html.luan @ 115:6193996b333d
add relogin
| author | Franklin Schmidt <fschmidt@gmail.com> |
|---|---|
| date | Thu, 27 Nov 2025 20:18:03 -0700 |
| parents | |
| children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/relogin.html.luan Thu Nov 27 20:18:03 2025 -0700 @@ -0,0 +1,44 @@ +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 User = require "site:/lib/User.luan" + + +return function() + local user_id = Http.request.parameters.user or error() + local password = Http.request.parameters.magic or error() + local user = User.get_by_id(user_id) + local is_good = user ~= nil and user.password == password + if is_good then + user.login() + end + Io.stdout = Http.response.text_writer() +%> +<!doctype html> +<html lang="en"> + <head> +<% head() %> + </head> + <body> +<% header() %> + <div content> + <h1>Re-Login Page</h1> +<% if is_good then %> + <p>You are logged in.</p> + <p>Bookmark this page to login again without dealing with the paranoid security bullshit of modern technology.</p> +<% + else +%> + <p>Login failed</p> +<% + end +%> + </div> + </body> +</html> +<% +end
