diff --git a/html.c b/html.c
index f97c45d..4522050 100644
--- a/html.c
+++ b/html.c
@@ -1012,12 +1012,22 @@ xs_html *html_top_controls(snac *snac)
xs_html_sctag("input",
xs_html_attr("type", "file"),
xs_html_attr("name", "avatar_file"))),
+ xs_html_tag("p",
+ xs_html_sctag("input",
+ xs_html_attr("type", "checkbox"),
+ xs_html_attr("name", "avatar_delete")),
+ xs_html_text(L("Delete current avatar"))),
xs_html_tag("p",
xs_html_text(L("Header image (banner): ")),
xs_html_sctag("input",
xs_html_attr("type", "file"),
xs_html_attr("name", "header_file"))),
xs_html_tag("p",
+ xs_html_sctag("input",
+ xs_html_attr("type", "checkbox"),
+ xs_html_attr("name", "header_delete")),
+ xs_html_text(L("Delete current header image"))),
+ xs_html_tag("p",
xs_html_text(L("Bio:")),
xs_html_sctag("br", NULL),
xs_html_tag("textarea",
@@ -3306,6 +3316,16 @@ int html_post_handler(const xs_dict *req, const char *q_path,
}
}
+ /* delete images by removing url from user.json */
+ for (n = 0; uploads[n]; n++) {
+ xs *var_name = xs_fmt("%s_delete", uploads[n]);
+ const char *delete_var = xs_dict_get(p_vars, var_name);
+
+ if (delete_var != NULL && strcmp(delete_var, "on") == 0) {
+ snac.config = xs_dict_set(snac.config, uploads[n], "");
+ }
+ }
+
/* password change? */
if ((p1 = xs_dict_get(p_vars, "passwd1")) != NULL &&
(p2 = xs_dict_get(p_vars, "passwd2")) != NULL &&