diff --git a/wrenchboard/src/shared_tool/account.cc b/wrenchboard/src/shared_tool/account.cc index 098a8402..3cb8755b 100644 --- a/wrenchboard/src/shared_tool/account.cc +++ b/wrenchboard/src/shared_tool/account.cc @@ -1099,6 +1099,14 @@ long WrenchResetMemberPass(CVars in, CVars &out) { member_id = out["member_id"].Long(); } + int r1, r2, r3; + char reset_pin[10]; + srand(time(NULL)); + r1 = abs(rand()*100000); + sprintf(reset_pin, "%lu", r1); + + + CVars xx; if (member_id > 0) { @@ -1114,6 +1122,9 @@ long WrenchResetMemberPass(CVars in, CVars &out) { xx["loc"] = loc; xx["loc"].set_valid(true); + xx["reset_pin"] = reset_pin; + xx["reset_pin"].set_valid(true); + out["password_reset_id"] = insert_db_record(DBS_VALID, "password_reset", "password_reset_id_seq", xx); if (out["password_reset_id"].Long() > 0) {