login path
This commit is contained in:
@@ -65,7 +65,7 @@ $routes->post('/en/wrench/api/v1/startresetpasword', 'WrenchAuth::passwordReset
|
||||
|
||||
// $routes->post('/en/wrench/api/v1/userlogin', 'WrenchApi::apigate');
|
||||
$routes->post('/en/wrench/api/v1/userlogin', 'WrenchAuth::userLogin'); // New routes defined
|
||||
$routes->post('/en/wrench/api/v1/qrlogin', 'WrenchApi::apigate');
|
||||
$routes->post('/en/wrench/api/v1/qrlogin', 'WrenchAuth::qrLogin'); //'WrenchApi::apigate'
|
||||
|
||||
$routes->post('/en/wrench/api/v1/homebanners', 'WrenchApi::apigate');
|
||||
$routes->post('/en/wrench/api/v1/startjoblist', 'WrenchApi::apigate');
|
||||
|
||||
@@ -50,6 +50,44 @@ class WrenchAuth extends BaseController
|
||||
return $this->respond( $this->summaryReturnData($in,$out), 200);
|
||||
}
|
||||
|
||||
public function qrLogin(){
|
||||
|
||||
$in["action"] = WRENCHBOARD_ACCOUNT_QRLOGIN;
|
||||
$in["login_mode"] = MOBILE_LOGIN;
|
||||
$pieces = explode("@", $in['username']);
|
||||
if ( count($pieces) == 3 ){
|
||||
$in['member_uid'] = $pieces[0];
|
||||
$in['member_username'] = $pieces[1];
|
||||
$in['family_uid'] = $pieces[2];
|
||||
}
|
||||
|
||||
$outF["username"] = $in['member_username'] ;
|
||||
$fail_endpoint = "QRLOGIN_FAILED-".$outF["username"]."-";
|
||||
//===================REDIS DATA IN CASE OF FAIL
|
||||
$out_redis = $this->getCache($fail_endpoint); // try find in cache
|
||||
if (isset($out_redis["fail_count"]) && $out_redis["fail_count"] > 2){
|
||||
// we need stop here
|
||||
}else{
|
||||
$outF["fail_count"] = isset( $out_redis["fail_count"] ) ? $out_redis["fail_count"]+1:1;
|
||||
}
|
||||
|
||||
log_message('critical', "************************ qrlogin 0001 ".$in['member_uid']);
|
||||
$out = [];
|
||||
$ret = $this->wrenchboard->wrenchboard_api($in, $out);
|
||||
$out['internal_return'] = $ret;
|
||||
log_message('critical', "***** ***** WrenchAuth::userLogin Ret = ".$ret );
|
||||
if ( $out['internal_return'] == 100 ){
|
||||
$endpoint = "QR_SESSION-". str_pad($out["member_id"], 12, "0", STR_PAD_LEFT) ."-";
|
||||
log_message('critical', "***** ***** WrenchAuth::qrLogin QR_SESSION = ".$endpoint );
|
||||
$this->saveCache($endpoint,$out,15000);
|
||||
}else
|
||||
{
|
||||
log_message('critical', "***** ***** WrenchAuth::qrLogin QR_SESSION = ".$fail_endpoint );
|
||||
$this->saveCache($fail_endpoint,$outF,15000);
|
||||
}
|
||||
return $this->respond( $this->summaryReturnData($in,$out), 200);
|
||||
|
||||
}
|
||||
|
||||
public function passwordReset(){
|
||||
|
||||
|
||||
Reference in New Issue
Block a user