formated result
This commit is contained in:
@@ -61,7 +61,7 @@ $routes->post('/en/wrench/api/v1/profilepasschange', 'WrenchApi::apigate'); /
|
||||
|
||||
$routes->post('/en/wrench/api/v1/createmobileuser', 'WrenchApi::apigate');
|
||||
$routes->post('/en/wrench/api/v1/completemobileuser', 'WrenchApi::apigate');
|
||||
$routes->post('/en/wrench/api/v1/startresetpasword', 'WrenchApi::apigate');
|
||||
$routes->post('/en/wrench/api/v1/startresetpasword', 'WrenchAuth::passwordReset'); //'WrenchApi::apigate'
|
||||
|
||||
// $routes->post('/en/wrench/api/v1/userlogin', 'WrenchApi::apigate');
|
||||
$routes->post('/en/wrench/api/v1/userlogin', 'WrenchAuth::userLogin'); // New routes defined
|
||||
|
||||
@@ -471,6 +471,6 @@ abstract class BaseController extends Controller
|
||||
$final_out["family_types"] = $this->familyTypes();
|
||||
$final_out["history_types"] = $this->historyTypes();
|
||||
$final_out["refer_link"] = "https://www.wrenchboard.com";
|
||||
return json_encode( $final_out );
|
||||
return json_encode( $final_out );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,42 @@ class WrenchAuth extends BaseController
|
||||
return $this->respond( $this->summaryReturnData($in,$out), 200);
|
||||
}
|
||||
|
||||
|
||||
public function passwordReset(){
|
||||
|
||||
$raw_json = file_get_contents('php://input');
|
||||
$in = json_decode($raw_json, true);
|
||||
$out = [];
|
||||
|
||||
$in["action"] = WRENCHBOARD_RESET_PASSWORD;
|
||||
$in["rloc"] = 'WRENCHBOARD_RESET_PASSWORD'.rand(1000,9999);
|
||||
$email_string = $this->restringEmailRedis($in['email']);
|
||||
$endpoint = "PASS_RESET-". $email_string;
|
||||
$out_redis = $this->getCache($endpoint); // try find in cache
|
||||
if (isset($out_redis["password_reset_id"]) && $out_redis["password_reset_id"] > 0){
|
||||
// we need stop here
|
||||
return $this->respond( ["error"=>'Wait and try latter'], 200);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$ret = $this->wrenchboard->wrenchboard_api($in, $out);
|
||||
$out['internal_return'] = $ret;
|
||||
log_message('critical', "***** ***** WrenchAuth::passwordReset Ret = ".$ret );
|
||||
if ( $out['internal_return'] == 100 ){
|
||||
log_message('critical', "***** ***** WrenchAuth::userLogin USER_SESSION = ".$endpoint );
|
||||
$this->saveCache($endpoint,$out,1500);
|
||||
}
|
||||
|
||||
return $this->respond( $this->summaryReturnData($in,$out), 200);
|
||||
|
||||
}
|
||||
|
||||
private function restringEmailRedis($str_in){
|
||||
$str_out = str_replace("@", "_", $str_in);
|
||||
return str_replace(".", "_", $str_out);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// WrenchAuth::userLogin
|
||||
Reference in New Issue
Block a user