mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-09 19:50:26 +03:00
Enable deletion of avatar and header image in user settings
This commit is contained in:
parent
84a767dd08
commit
9749a65007
20
html.c
20
html.c
@ -1012,12 +1012,22 @@ xs_html *html_top_controls(snac *snac)
|
|||||||
xs_html_sctag("input",
|
xs_html_sctag("input",
|
||||||
xs_html_attr("type", "file"),
|
xs_html_attr("type", "file"),
|
||||||
xs_html_attr("name", "avatar_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_tag("p",
|
||||||
xs_html_text(L("Header image (banner): ")),
|
xs_html_text(L("Header image (banner): ")),
|
||||||
xs_html_sctag("input",
|
xs_html_sctag("input",
|
||||||
xs_html_attr("type", "file"),
|
xs_html_attr("type", "file"),
|
||||||
xs_html_attr("name", "header_file"))),
|
xs_html_attr("name", "header_file"))),
|
||||||
xs_html_tag("p",
|
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_text(L("Bio:")),
|
||||||
xs_html_sctag("br", NULL),
|
xs_html_sctag("br", NULL),
|
||||||
xs_html_tag("textarea",
|
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? */
|
/* password change? */
|
||||||
if ((p1 = xs_dict_get(p_vars, "passwd1")) != NULL &&
|
if ((p1 = xs_dict_get(p_vars, "passwd1")) != NULL &&
|
||||||
(p2 = xs_dict_get(p_vars, "passwd2")) != NULL &&
|
(p2 = xs_dict_get(p_vars, "passwd2")) != NULL &&
|
||||||
|
Loading…
Reference in New Issue
Block a user