aboutsummaryrefslogtreecommitdiff
path: root/page.c
diff options
context:
space:
mode:
Diffstat (limited to 'page.c')
-rw-r--r--page.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/page.c b/page.c
index 27c277d..6f4ca17 100644
--- a/page.c
+++ b/page.c
@@ -2051,6 +2051,39 @@ int page_failed_login(struct http_response *const r)
return 0;
}
+int page_missing_login(struct http_response *const r)
+{
+ static const char index[] =
+ DOCTYPE_TAG
+ "<html>\n"
+ " <head>\n"
+ " " COMMON_HEAD "\n"
+ " " STYLE_A "\n"
+ " </head>\n"
+ " <body>\n"
+ " <div class=\"userform\">\n"
+ " <label>Please authenticate to continue.</label>\n"
+ " </div>\n"
+ LOGIN_BODY
+ " </body>\n"
+ "</html>\n";
+
+ *r = (const struct http_response)
+ {
+ .status = HTTP_STATUS_UNAUTHORIZED,
+ .buf.ro = index,
+ .n = sizeof index - 1
+ };
+
+ if (http_response_add_header(r, "Content-Type", "text/html"))
+ {
+ fprintf(stderr, "%s: http_response_add_header failed\n", __func__);
+ return -1;
+ }
+
+ return 0;
+}
+
int page_login(struct http_response *const r)
{
static const char index[] =