Mercurial Hosting > chat
changeset 115:6193996b333d default tip
add relogin
| author | Franklin Schmidt <fschmidt@gmail.com> |
|---|---|
| date | Thu, 27 Nov 2025 20:18:03 -0700 |
| parents | d394aad4c3c1 |
| children | |
| files | src/account.html.luan src/relogin.html.luan |
| diffstat | 2 files changed, 45 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
diff -r d394aad4c3c1 -r 6193996b333d src/account.html.luan --- a/src/account.html.luan Tue Nov 25 22:24:21 2025 -0700 +++ b/src/account.html.luan Thu Nov 27 20:18:03 2025 -0700 @@ -151,6 +151,7 @@ <p><span notify></span> <a href="javascript:editNotify()">Edit</a></p> <p><span voice></span> <a href="javascript:editVoice()">Edit</a></p> <p><a href="javascript:openUrl()">Your chat URL</a></p> + <p><a href="/relogin.html?user=<%=user.id%>&magic=<%=user.password%>">Re-Login Page</a></p> <p><a href="javascript:logout()">Logout</a></p> <p><a href="javascript:deleteUser()">Delete account</a></p> <p> </p>
diff -r d394aad4c3c1 -r 6193996b333d src/relogin.html.luan --- /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
