Added email notification address to web interface.

This commit is contained in:
default 2022-10-21 09:46:46 +02:00
parent a52ed9be78
commit b75319ed08

11
html.c
View file

@ -242,6 +242,9 @@ d_char *html_top_controls(snac *snac, d_char *s)
"<p>%s:<br>\n" "<p>%s:<br>\n"
"<textarea name=\"bio\" cols=\"40\" rows=\"4\">%s</textarea></p>\n" "<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" "<p>%s:<br>\n"
"<input type=\"password\" name=\"passwd1\" value=\"\"></p>\n" "<input type=\"password\" name=\"passwd1\" value=\"\"></p>\n"
@ -257,6 +260,10 @@ d_char *html_top_controls(snac *snac, d_char *s)
"</div>\n" "</div>\n"
"</div>\n"; "</div>\n";
char *email = xs_dict_get(snac->config, "email");
if (xs_is_null(email))
email = "";
xs *s1 = xs_fmt(_tmpl, xs *s1 = xs_fmt(_tmpl,
snac->actor, snac->actor,
L("Post"), L("Post"),
@ -277,6 +284,8 @@ d_char *html_top_controls(snac *snac, d_char *s)
xs_dict_get(snac->config, "avatar"), xs_dict_get(snac->config, "avatar"),
L("Bio"), L("Bio"),
xs_dict_get(snac->config, "bio"), xs_dict_get(snac->config, "bio"),
L("Email address for notifications"),
email,
L("Password (only to change it)"), L("Password (only to change it)"),
L("Repeat Password"), L("Repeat Password"),
L("Update user info") 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); snac.config = xs_dict_set(snac.config, "avatar", v);
if ((v = xs_dict_get(p_vars, "bio")) != NULL) if ((v = xs_dict_get(p_vars, "bio")) != NULL)
snac.config = xs_dict_set(snac.config, "bio", v); 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? */ /* password change? */
if ((p1 = xs_dict_get(p_vars, "passwd1")) != NULL && if ((p1 = xs_dict_get(p_vars, "passwd1")) != NULL &&