reset pin
This commit is contained in:
@@ -1086,7 +1086,6 @@ long WrenchLoadDashData(CVars in, CVars &out) {
|
||||
}
|
||||
|
||||
long WrenchResetMemberPass(CVars in, CVars &out) {
|
||||
|
||||
logfmt(logINFO, "long WrenchResetMemberPass(CVars in, CVars out)");
|
||||
long ret = PHP_API_BAD_PARAM;
|
||||
const char * loc = getenv("REMOTE_ADDR");
|
||||
@@ -1094,23 +1093,19 @@ long WrenchResetMemberPass(CVars in, CVars &out) {
|
||||
try {
|
||||
|
||||
REQ_STRING(in, "email", 2, 49, "(.*)");
|
||||
|
||||
if (load_db_record(out, "SELECT id AS member_id FROM members WHERE username = '%s'", in["email"].c_str())) {
|
||||
member_id = out["member_id"].Long();
|
||||
CVars yy;
|
||||
if (load_db_record(yy, "SELECT id AS member_id, uid AS member_uid FROM members WHERE username = '%s'", in["email"].c_str())) {
|
||||
member_id = yy["member_id"].Long();
|
||||
}
|
||||
|
||||
int r1, r2, r3;
|
||||
char reset_pin[10];
|
||||
srand(time(NULL));
|
||||
r1 = abs(rand()*10000);
|
||||
r1 = abs(rand()*100);
|
||||
sprintf(reset_pin, "%d", r1);
|
||||
|
||||
|
||||
|
||||
|
||||
CVars xx;
|
||||
if (member_id > 0) {
|
||||
|
||||
int r1, r2, r3;
|
||||
char verify_link[100];
|
||||
srand(time(NULL));
|
||||
@@ -1121,7 +1116,6 @@ long WrenchResetMemberPass(CVars in, CVars &out) {
|
||||
xx["email"].set_valid(true);
|
||||
xx["loc"] = loc;
|
||||
xx["loc"].set_valid(true);
|
||||
|
||||
xx["reset_pin"] = reset_pin;
|
||||
xx["reset_pin"].set_valid(true);
|
||||
|
||||
@@ -1133,19 +1127,16 @@ long WrenchResetMemberPass(CVars in, CVars &out) {
|
||||
pgsql_exec("UPDATE password_reset SET expired = now() + '1 day',pass_link=md5(now()::text)||''||md5(%d::text) WHERE id = %lu", r1, out["password_reset_id"].Long());
|
||||
account_email(ACCOUNT_PASSWORD_RESET, in, out);
|
||||
if ( load_db_record(out, "SELECT uid AS reset_uid, id AS password_reset_id FROM password_reset WHERE id = %lu ",in["password_reset_id"].Long())> 0){
|
||||
out["m_uid"] = yy["member_uid"];
|
||||
ret = PHP_API_OK;
|
||||
}
|
||||
}
|
||||
}// if member_id
|
||||
|
||||
} catch (bad_parameter) {
|
||||
out["log_status"] = "Invalid Log Action";
|
||||
}
|
||||
logfmt(logINFO, "/long WrenchResetMemberPass(CVars in, CVars out)");
|
||||
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
long LogWrenchBoardMember(CVars in, CVars &out) {
|
||||
|
||||
Reference in New Issue
Block a user