Put hostname in OAuth page title for web-based clients like Elk

This commit is contained in:
Kelson Vibber 2023-09-21 01:16:13 +00:00
parent d9b6688e03
commit 3931640b69

View file

@ -149,7 +149,7 @@ const char *login_page = ""
"<!DOCTYPE html>\n" "<!DOCTYPE html>\n"
"<html>\n" "<html>\n"
"<head>\n" "<head>\n"
"<title>OAuth Identify: Snac2</title>\n" "<title>%s OAuth - Snac2</title>\n"
"<style>:root {color-scheme: light dark}</style>\n" "<style>:root {color-scheme: light dark}</style>\n"
"</head>\n" "</head>\n"
"<body><h1>%s OAuth identify</h1>\n" "<body><h1>%s OAuth identify</h1>\n"
@ -195,7 +195,7 @@ int oauth_get_handler(const xs_dict *req, const char *q_path,
if (xs_is_null(state)) if (xs_is_null(state))
state = ""; state = "";
*body = xs_fmt(login_page, host, "", host, "oauth/x-snac-login", *body = xs_fmt(login_page, host, host, "", host, "oauth/x-snac-login",
ruri, cid, state, USER_AGENT); ruri, cid, state, USER_AGENT);
*ctype = "text/html"; *ctype = "text/html";
status = 200; status = 200;
@ -212,7 +212,7 @@ int oauth_get_handler(const xs_dict *req, const char *q_path,
if (strcmp(cmd, "/x-snac-get-token") == 0) { /** **/ if (strcmp(cmd, "/x-snac-get-token") == 0) { /** **/
const char *host = xs_dict_get(srv_config, "host"); const char *host = xs_dict_get(srv_config, "host");
*body = xs_fmt(login_page, host, "", host, "oauth/x-snac-get-token", *body = xs_fmt(login_page, host, host, "", host, "oauth/x-snac-get-token",
"", "", "", USER_AGENT); "", "", "", USER_AGENT);
*ctype = "text/html"; *ctype = "text/html";
status = 200; status = 200;
@ -262,7 +262,7 @@ int oauth_post_handler(const xs_dict *req, const char *q_path,
const char *host = xs_dict_get(srv_config, "host"); const char *host = xs_dict_get(srv_config, "host");
/* by default, generate another login form with an error */ /* by default, generate another login form with an error */
*body = xs_fmt(login_page, host, "LOGIN INCORRECT", host, "oauth/x-snac-login", *body = xs_fmt(login_page, host, host, "LOGIN INCORRECT", host, "oauth/x-snac-login",
redir, cid, state, USER_AGENT); redir, cid, state, USER_AGENT);
*ctype = "text/html"; *ctype = "text/html";
status = 200; status = 200;
@ -431,7 +431,7 @@ int oauth_post_handler(const xs_dict *req, const char *q_path,
const char *host = xs_dict_get(srv_config, "host"); const char *host = xs_dict_get(srv_config, "host");
/* by default, generate another login form with an error */ /* by default, generate another login form with an error */
*body = xs_fmt(login_page, host, "LOGIN INCORRECT", host, "oauth/x-snac-get-token", *body = xs_fmt(login_page, host, host, "LOGIN INCORRECT", host, "oauth/x-snac-get-token",
"", "", "", USER_AGENT); "", "", "", USER_AGENT);
*ctype = "text/html"; *ctype = "text/html";
status = 200; status = 200;