commit 8698b3f
Merge pull request 'OAuth Login Page Clean-Up' (#80) from kvibber/snac2:oauth-page-cleanup into master Reviewed-on: https://codeberg.org/grunfink/snac2/pulls/80
1 files changed,
+10,
-5
+10,
-5
1@@ -147,6 +147,11 @@ int token_del(const char *id)
2
3 const char *login_page = ""
4 "<!DOCTYPE html>\n"
5+"<html>\n"
6+"<head>\n"
7+"<title>%s OAuth - Snac2</title>\n"
8+"<style>:root {color-scheme: light dark}</style>\n"
9+"</head>\n"
10 "<body><h1>%s OAuth identify</h1>\n"
11 "<div style=\"background-color: red; color: white\">%s</div>\n"
12 "<form method=\"post\" action=\"https:/" "/%s/%s\">\n"
13@@ -156,7 +161,7 @@ const char *login_page = ""
14 "<input type=\"hidden\" name=\"cid\" value=\"%s\">\n"
15 "<input type=\"hidden\" name=\"state\" value=\"%s\">\n"
16 "<input type=\"submit\" value=\"OK\">\n"
17-"</form><p>%s</p></body>\n"
18+"</form><p>%s</p></body></html>\n"
19 "";
20
21 int oauth_get_handler(const xs_dict *req, const char *q_path,
22@@ -190,7 +195,7 @@ int oauth_get_handler(const xs_dict *req, const char *q_path,
23 if (xs_is_null(state))
24 state = "";
25
26- *body = xs_fmt(login_page, host, "", host, "oauth/x-snac-login",
27+ *body = xs_fmt(login_page, host, host, "", host, "oauth/x-snac-login",
28 ruri, cid, state, USER_AGENT);
29 *ctype = "text/html";
30 status = 200;
31@@ -207,7 +212,7 @@ int oauth_get_handler(const xs_dict *req, const char *q_path,
32 if (strcmp(cmd, "/x-snac-get-token") == 0) { /** **/
33 const char *host = xs_dict_get(srv_config, "host");
34
35- *body = xs_fmt(login_page, host, "", host, "oauth/x-snac-get-token",
36+ *body = xs_fmt(login_page, host, host, "", host, "oauth/x-snac-get-token",
37 "", "", "", USER_AGENT);
38 *ctype = "text/html";
39 status = 200;
40@@ -257,7 +262,7 @@ int oauth_post_handler(const xs_dict *req, const char *q_path,
41 const char *host = xs_dict_get(srv_config, "host");
42
43 /* by default, generate another login form with an error */
44- *body = xs_fmt(login_page, host, "LOGIN INCORRECT", host, "oauth/x-snac-login",
45+ *body = xs_fmt(login_page, host, host, "LOGIN INCORRECT", host, "oauth/x-snac-login",
46 redir, cid, state, USER_AGENT);
47 *ctype = "text/html";
48 status = 200;
49@@ -426,7 +431,7 @@ int oauth_post_handler(const xs_dict *req, const char *q_path,
50 const char *host = xs_dict_get(srv_config, "host");
51
52 /* by default, generate another login form with an error */
53- *body = xs_fmt(login_page, host, "LOGIN INCORRECT", host, "oauth/x-snac-get-token",
54+ *body = xs_fmt(login_page, host, host, "LOGIN INCORRECT", host, "oauth/x-snac-get-token",
55 "", "", "", USER_AGENT);
56 *ctype = "text/html";
57 status = 200;