X-Git-Url: https://git.distorted.org.uk/~mdw/disorder/blobdiff_plain/158d096132f284c409fe1954457c67d77caf796c..c40544fdbbfd762bed24b65d96d9d1ca0bdec3f7:/lib/client.c diff --git a/lib/client.c b/lib/client.c index b7292c5..08d325a 100644 --- a/lib/client.c +++ b/lib/client.c @@ -165,6 +165,10 @@ static int disorder_simple_v(disorder_client *c, const char *arg; struct dynstr d; + if(!c->fpout) { + error(0, "not connected to server"); + return -1; + } if(cmd) { dynstr_init(&d); dynstr_append_string(&d, cmd); @@ -1135,7 +1139,13 @@ int disorder_register(disorder_client *c, const char *user, * @return 0 on success, non-0 on error */ int disorder_confirm(disorder_client *c, const char *confirm) { - return disorder_simple(c, 0, "confirm", confirm, (char *)0); + char *u; + int rc; + + if(!(rc = dequote(disorder_simple(c, &u, "confirm", confirm, (char *)0), + &u))) + c->user = u; + return rc; } /** @brief Make a cookie for this login @@ -1148,6 +1158,23 @@ int disorder_make_cookie(disorder_client *c, char **cookiep) { cookiep); } +/** @brief Revoke the cookie used by this session + * @param c Client + * @return 0 on success, non-0 on error + */ +int disorder_revoke(disorder_client *c) { + return disorder_simple(c, 0, "revoke", (char *)0); +} + +/** @brief Request a password reminder email + * @param c Client + * @param user Username + * @return 0 on success, non-0 on error + */ +int disorder_reminder(disorder_client *c, const char *user) { + return disorder_simple(c, 0, "reminder", user, (char *)0); +} + /* Local Variables: c-basic-offset:2