2023-08-12 17:00:51 (UTC-03:00)
Marcel Rodrigues <marcelgmr@gmail.com>
add user page
diff --git a/skopos.lua b/skopos.lua index 9fd767d..0e2304d 100644 --- a/skopos.lua +++ b/skopos.lua @@ -125,6 +125,15 @@ function App:routes() end return "/login", 303 end}, + {"GET", "/u/([-_%w]+)", + function (req, nick) + local user = self:get_user(req) + if user == nil then return "/login?after="..req.path, 303 end + local other = self.model:get_user(nick) + if other == nil then return "not found", 404 end + local env = {title=self.title, user=user, other=other} + return lud.template.render_file("view/user.html", env) + end}, -- invites {"GET", "/i", function (req) diff --git a/view/user.html b/view/user.html new file mode 100644 index 0000000..532e94e --- /dev/null +++ b/view/user.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8"> + <title>{{$title}}</title> + <style> + .centered { text-align: center; } + % include view/menu.css + </style> +</head> +<body> + % include view/menu.html + <h1 class="centered">user</h1> + <p><strong>nick:</strong> {{$other.nick}}</p> + <p><strong>name:</strong> {{$other.name}}</p> + <p><strong>invited by:</strong> {{$other.invited_by or "(root)"}}</p> +</body> +</html>