improve verification
This commit is contained in:
@@ -442,17 +442,24 @@ long account_calls(CVars in, CVars &out) {
|
|||||||
long VerifyWrenchAccountLink(CVars in, CVars &out) {
|
long VerifyWrenchAccountLink(CVars in, CVars &out) {
|
||||||
logfmt(logINFO, "VerifyWrenchAccountLink()");
|
logfmt(logINFO, "VerifyWrenchAccountLink()");
|
||||||
long ret = PHP_API_BAD_PARAM;
|
long ret = PHP_API_BAD_PARAM;
|
||||||
|
const PGresult *res;
|
||||||
REQ_STRING(in, "verify_link", 2, 120, "(.*)");
|
REQ_STRING(in, "verify_link", 2, 120, "(.*)");
|
||||||
OPTIONAL(in, "loc") REQ_STRING(in, "loc", 3, 15, "(.*)");
|
OPTIONAL(in, "loc") REQ_STRING(in, "loc", 3, 15, "(.*)");
|
||||||
out["status_text"] = "Start";
|
out["status_text"] = "Start";
|
||||||
out["status"] = "-1";
|
out["status"] = "-1";
|
||||||
try {
|
try {
|
||||||
long lonkF = load_db_record(out, "SELECT uid AS pending_uid,id AS pending_id FROM members_pending WHERE verify_link ='%s' AND expire > now() AND status = 1 LIMIT 1", in["verify_link"].c_str());
|
res = pgsql_query("SELECT uid AS pending_uid,id AS pending_id FROM members_pending WHERE verify_link ='%s' AND expire > now() AND status = 1 LIMIT 1",in["verify_link"].c_str());
|
||||||
if (lonkF) {
|
if (res != NULL && pgsql_num_rows(res) > 0) {
|
||||||
out["status_text"] = "Link Verfied";
|
map<const char*, const char*>f = pgsql_fetch_assoc(res, 0);
|
||||||
out["status"] = "0";
|
CVars rec;
|
||||||
ret = PHP_API_OK;
|
map_to_cvars(f, rec);
|
||||||
}
|
out["pending_uid"] = rec["pending_uid"]; out["pending_uid"].set_valid( true );
|
||||||
|
out["pending_id"] = rec["pending_id"]; out["pending_id"].set_valid( true );
|
||||||
|
out["status_text"] = "Link Verfied";
|
||||||
|
out["status"] = "0";
|
||||||
|
ret = PHP_API_OK;
|
||||||
|
}
|
||||||
|
|
||||||
} catch (bad_parameter) {
|
} catch (bad_parameter) {
|
||||||
out["status"] = "ERROR";
|
out["status"] = "ERROR";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user