From 0bb88e283f31125ed5b7a8787b6b84716f4a3cc2 Mon Sep 17 00:00:00 2001 From: onefang Date: Mon, 18 May 2020 14:22:17 +1000 Subject: Show account name correctly. --- src/sledjchisl/sledjchisl.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/sledjchisl') diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c index 45e5919..f34d1a6 100644 --- a/src/sledjchisl/sledjchisl.c +++ b/src/sledjchisl/sledjchisl.c @@ -4562,10 +4562,6 @@ static int nameValidate(reqData *Rd, inputForm *iF, inputValue *iV) Rd->stuff->putstr(Rd->stuff, "firstName", name); Rd->stuff->putstr(Rd->stuff, "lastName", s); Rd->stuff->putstrf(Rd->stuff, "name", "%s %s", name, s); -// TODO - fix this, so we don't show "You are user" when we are not, but everything else still works. -// if ('\0' != getStrH(Rd->queries, "user")[0]) - if (NULL != Rd->shs.name) free(Rd->shs.name); - Rd->shs.name = Rd->stuff->getstr(Rd->stuff, "name", true); } } } @@ -5195,6 +5191,7 @@ d("accountRead() UUID %s, name %s %s", uuid, first, last); if (0 == rt) { +T("Found Lua record."); ret += 1; Rd->database->putstr(Rd->database, "UserAccounts.FirstName", first); Rd->database->putstr(Rd->database, "UserAccounts.LastName", last); @@ -5219,9 +5216,11 @@ d("accountRead() UUID %s, name %s %s", uuid, first, last); // else if (rows) if (rows) { - ret += rows->rows->size(rows->rows); - if (1 == ret) + rt = rows->rows->size(rows->rows); + if (1 == rt) { + ret = rt; +T("Found database record."); dbPull(Rd, "UserAccounts", rows); char *name = xmprintf("%s %s", getStrH(Rd->database, "UserAccounts.FirstName"), getStrH(Rd->database, "UserAccounts.LastName")); @@ -5305,7 +5304,7 @@ static int accountDelSub(reqData *Rd, inputForm *iF, inputValue *iV) static int accountCreateSub(reqData *Rd, inputForm *iF, inputValue *iV) { int ret = 0; - char *uuid = Rd->shs.UUID, *first = getStrH(Rd->stuff, "firstName"), *last = getStrH(Rd->stuff, "lastName"); + char *uuid = Rd->shs.UUID, *first = getStrH(Rd->stuff, "name"), *last = NULL; int c = accountRead(Rd, uuid, first, last); if (strcmp("POST", Rd->Method) == 0) @@ -5327,6 +5326,8 @@ static int accountCreateSub(reqData *Rd, inputForm *iF, inputValue *iV) { Rd->stuff->putstr(Rd->stuff, "passHash", h); Rd->stuff->putstr(Rd->stuff, "passSalt", salt); + if (NULL != Rd->shs.name) free(Rd->shs.name); + Rd->shs.name = Rd->stuff->getstr(Rd->stuff, "name", true); free(h); Rd->shs.status = SHS_REFRESH; } -- cgit v1.1