summaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2022-10-21 09:46:46 +0200
committerdefault <nobody@localhost>2022-10-21 09:46:46 +0200
commitb75319ed08867bf0485b20958039321b246dd545 (patch)
tree299806c4b000ab4cdb7d840b42640c07cbcd59a3 /html.c
parenta52ed9be78893d1d6192bcfd76901781772fa309 (diff)
Added email notification address to web interface.
Diffstat (limited to 'html.c')
-rw-r--r--html.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/html.c b/html.c
index 1256cea..9cf0815 100644
--- a/html.c
+++ b/html.c
@@ -243,6 +243,9 @@ d_char *html_top_controls(snac *snac, d_char *s)
"<textarea name=\"bio\" cols=\"40\" rows=\"4\">%s</textarea></p>\n"
"<p>%s:<br>\n"
+ "<input type=\"text\" name=\"email\" value=\"%s\"></p>\n"
+
+ "<p>%s:<br>\n"
"<input type=\"password\" name=\"passwd1\" value=\"\"></p>\n"
"<p>%s:<br>\n"
@@ -257,6 +260,10 @@ d_char *html_top_controls(snac *snac, d_char *s)
"</div>\n"
"</div>\n";
+ char *email = xs_dict_get(snac->config, "email");
+ if (xs_is_null(email))
+ email = "";
+
xs *s1 = xs_fmt(_tmpl,
snac->actor,
L("Post"),
@@ -277,6 +284,8 @@ d_char *html_top_controls(snac *snac, d_char *s)
xs_dict_get(snac->config, "avatar"),
L("Bio"),
xs_dict_get(snac->config, "bio"),
+ L("Email address for notifications"),
+ email,
L("Password (only to change it)"),
L("Repeat Password"),
L("Update user info")
@@ -1053,6 +1062,8 @@ int html_post_handler(d_char *req, char *q_path, d_char *payload, int p_size,
snac.config = xs_dict_set(snac.config, "avatar", v);
if ((v = xs_dict_get(p_vars, "bio")) != NULL)
snac.config = xs_dict_set(snac.config, "bio", v);
+ if ((v = xs_dict_get(p_vars, "email")) != NULL)
+ snac.config = xs_dict_set(snac.config, "email", v);
/* password change? */
if ((p1 = xs_dict_get(p_vars, "passwd1")) != NULL &&