X-Git-Url: https://git.distorted.org.uk/~mdw/disorder/blobdiff_plain/8f9616f198b617214724183e32d598339c3bbbc4..8d516888863f6236649b33af3d69b8d159d1f789:/server/dcgi.c diff --git a/server/dcgi.c b/server/dcgi.c index 19a8021..81b6943 100644 --- a/server/dcgi.c +++ b/server/dcgi.c @@ -113,7 +113,7 @@ static void header_cookie(struct sink *output) { parse_url(config->url, &u); if(login_cookie) { dynstr_append_string(d, "disorder="); - dynstr_append_string(d, quote822(login_cookie, 0)); + dynstr_append_string(d, login_cookie); } else { /* Force browser to discard cookie */ dynstr_append_string(d, "disorder=none;Max-Age=0"); @@ -123,8 +123,8 @@ static void header_cookie(struct sink *output) { * that. But the default path only goes up to the rightmost /, which would * cause the browser to expose the cookie to other CGI programs on the same * web server. */ - dynstr_append_string(d, ";Path="); - dynstr_append_string(d, quote822(u.path, 0)); + dynstr_append_string(d, ";Version=1;Path="); + dynstr_append_string(d, u.path); } dynstr_terminate(d); cgi_header(output, "Set-Cookie", d->vec); @@ -645,6 +645,23 @@ static void act_edituser(cgi_sink *output, expand_template(ds, output, "login"); } +static void act_reminder(cgi_sink *output, + dcgi_state *ds) { + const char *const username = cgi_get("username"); + + if(!username || !*username) { + cgi_set_option("error", "nousername"); + expand_template(ds, output, "login"); + return; + } + if(disorder_reminder(ds->g->client, username)) { + cgi_set_option("error", "reminderfailed"); + expand_template(ds, output, "login"); + return; + } + cgi_set_option("status", "reminded"); + expand_template(ds, output, "login"); +} static const struct action { const char *name; @@ -664,6 +681,7 @@ static const struct action { { "random-disable", act_random_disable }, { "random-enable", act_random_enable }, { "register", act_register }, + { "reminder", act_reminder }, { "remove", act_remove }, { "resume", act_resume }, { "scratch", act_scratch },