aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfigure17
m---------libweb0
-rw-r--r--main.c2
-rw-r--r--page.c41
-rw-r--r--page.h1
5 files changed, 59 insertions, 2 deletions
diff --git a/configure b/configure
index 9ece0d2..c967734 100755
--- a/configure
+++ b/configure
@@ -93,6 +93,23 @@ else
in_tree_libweb=1
proj_CFLAGS="$proj_CFLAGS -Ilibweb/include"
proj_LDFLAGS="$proj_LDFLAGS -Llibweb -lweb"
+
+ if [ -f libweb/Makefile ]
+ then
+ echo "Info: Re-configuring libweb" >&2
+ (cd libweb && CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" ./configure \
+ --prefix="$prefix")
+ fi
+fi
+
+if [ $build_thumbnail -ne 0 ]
+then
+ if [ -f thumbnail/Makefile ]
+ then
+ echo "Info: Re-configuring thumbnail" >&2
+ (cd thumbnail && CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" ./configure \
+ --prefix="$prefix")
+ fi
fi
if pkg-config fdzipstream
diff --git a/libweb b/libweb
-Subproject 62ee3ef1ca13872e1f9b07f6e4e53cea8b684d7
+Subproject e8e9b1b129bc9a324e9df4a98d971505a2739a8
diff --git a/main.c b/main.c
index 6ad0cf7..ff05fd4 100644
--- a/main.c
+++ b/main.c
@@ -1021,7 +1021,7 @@ static int getnode(const struct http_payload *const p,
if (auth_cookie(a, &p->cookie))
{
fprintf(stderr, "%s: auth_cookie failed\n", __func__);
- return page_forbidden(r);
+ return page_missing_login(r);
}
else if (path_invalid(resource))
{
diff --git a/page.c b/page.c
index 4e08a62..6f4ca17 100644
--- a/page.c
+++ b/page.c
@@ -2027,8 +2027,45 @@ int page_failed_login(struct http_response *const r)
" " COMMON_HEAD "\n"
" " STYLE_A "\n"
" </head>\n"
- " <p>Invalid username or password.</p>\n"
+ " <body>\n"
+ " <div class=\"userform\">\n"
+ " <label>Invalid username or password.</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_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)
@@ -2056,7 +2093,9 @@ int page_login(struct http_response *const r)
" " STYLE_A "\n"
" " COMMON_HEAD "\n"
" </head>\n"
+ " <body>\n"
" " LOGIN_BODY "\n"
+ " </body>\n"
"</html>\n";
*r = (const struct http_response)
diff --git a/page.h b/page.h
index 8b1e9a0..6ab28ea 100644
--- a/page.h
+++ b/page.h
@@ -40,6 +40,7 @@ struct page_rm
int page_login(struct http_response *r);
int page_style(struct http_response *r, const char *path);
int page_failed_login(struct http_response *r);
+int page_missing_login(struct http_response *r);
int page_forbidden(struct http_response *r);
int page_bad_request(struct http_response *r);
int page_not_found(struct http_response *r);