wallet
This commit is contained in:
@@ -2165,20 +2165,16 @@ long LoginWrenchBoardAccount(CVars in, CVars &out) {
|
||||
ret = load_db_record(out, "SELECT *,id AS member_id , to_char(last_login, 'Day Mon dd, yyyy HH:MI AM') AS last_login2,country FROM members WHERE status=1 AND LOWER(username)=LOWER('%s') AND password= md5('%s')", in["username"].c_str(), in["password"].c_str());
|
||||
if (ret) {
|
||||
|
||||
if ( out["country"] !=""){
|
||||
CVars vw;
|
||||
load_db_record(vw, "SELECT code AS currency FROM currency WHERE country='%s'",out["country"].c_str());
|
||||
if ( vw["currency"] !=""){
|
||||
//vw["currency"] = "NAIRA"; // this might become a variable based on the country
|
||||
vw["currency"].set_valid( true );
|
||||
long wallet_id = CheckWallet(out["member_id"].Long(),vw);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
load_db_record( out, "SELECT amount AS balance FROM members_wallet WHERE member_id = %lu AND currency='%s' ", out["member_id"].Long(), vw["currency"].c_str());
|
||||
|
||||
if ( out["country"] !=""){
|
||||
CVars vw;
|
||||
load_db_record(vw, "SELECT code AS currency FROM currency WHERE country='%s'",out["country"].c_str());
|
||||
if ( vw["currency"] !=""){
|
||||
//vw["currency"] = "NAIRA"; // this might become a variable based on the country
|
||||
vw["currency"].set_valid( true );
|
||||
long wallet_id = CheckWallet(out["member_id"].Long(),vw);
|
||||
load_db_record( out, "SELECT amount AS balance FROM members_wallet WHERE member_id = %lu AND currency='%s' ", out["member_id"].Long(), vw["currency"].c_str()); // retired
|
||||
}
|
||||
}
|
||||
|
||||
pgsql_exec("DELETE FROM members_session WHERE member_id=%ld ", out["member_id"].Long());
|
||||
// remove all existing session
|
||||
@@ -2200,8 +2196,6 @@ long LoginWrenchBoardAccount(CVars in, CVars &out) {
|
||||
} else {
|
||||
out["status"] = "Invalid username and/or password";
|
||||
}
|
||||
|
||||
|
||||
logfmt(logINFO, "/LoginWrenchBoardAccount()");
|
||||
return ret;
|
||||
}
|
||||
@@ -2317,9 +2311,21 @@ long LoginWrenchBoardExternal(CVars in, CVars &out) {
|
||||
xx["external_idp_provider_id"] = in["external_idp_provider_id"];
|
||||
xx["external_idp_provider_id"].set_valid(true);
|
||||
out["member_id"] = insert_db_record(DBS_VALID, "members", "members_id_seq", xx);
|
||||
ret = load_db_record(out, "SELECT *,id AS member_id FROM members WHERE id='%ld'", out["member_id"].Long());
|
||||
ret = load_db_record(out, "SELECT *,id AS member_id,country FROM members WHERE id='%ld'", out["member_id"].Long());
|
||||
}
|
||||
if (out["member_id"].Long() > 0) {
|
||||
|
||||
if ( out["country"] !=""){ // need to construct wallet if needed.
|
||||
CVars vw;
|
||||
load_db_record(vw, "SELECT code AS currency FROM currency WHERE country='%s'",out["country"].c_str());
|
||||
if ( vw["currency"] !=""){
|
||||
//vw["currency"] = "NAIRA"; // this might become a variable based on the country
|
||||
vw["currency"].set_valid( true );
|
||||
long wallet_id = CheckWallet(out["member_id"].Long(),vw);
|
||||
load_db_record( out, "SELECT amount AS balance FROM members_wallet WHERE member_id = %lu AND currency='%s' ", out["member_id"].Long(), vw["currency"].c_str()); // retired
|
||||
}
|
||||
}
|
||||
|
||||
pgsql_exec("DELETE FROM members_session WHERE member_id=%ld ", out["member_id"].Long());
|
||||
// remove all existing session
|
||||
if (SessionCheck(out["id"].Long(), in["sessionid"].c_str(), 1) > 0) {
|
||||
|
||||
Reference in New Issue
Block a user