improve verification
This commit is contained in:
@@ -442,17 +442,24 @@ long account_calls(CVars in, CVars &out) {
|
||||
long VerifyWrenchAccountLink(CVars in, CVars &out) {
|
||||
logfmt(logINFO, "VerifyWrenchAccountLink()");
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
const PGresult *res;
|
||||
REQ_STRING(in, "verify_link", 2, 120, "(.*)");
|
||||
OPTIONAL(in, "loc") REQ_STRING(in, "loc", 3, 15, "(.*)");
|
||||
out["status_text"] = "Start";
|
||||
out["status"] = "-1";
|
||||
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());
|
||||
if (lonkF) {
|
||||
out["status_text"] = "Link Verfied";
|
||||
out["status"] = "0";
|
||||
ret = PHP_API_OK;
|
||||
}
|
||||
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 (res != NULL && pgsql_num_rows(res) > 0) {
|
||||
map<const char*, const char*>f = pgsql_fetch_assoc(res, 0);
|
||||
CVars rec;
|
||||
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) {
|
||||
out["status"] = "ERROR";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user