|
|
@@ -43,7 +43,7 @@ class login {
|
|
|
if(!(isset($_POST['token']))){
|
|
|
$is_verify = common::check_input($_POST['verifcation_code']);
|
|
|
//首先校用户登录
|
|
|
- $AES_encrypted = $this->AES_encrypted($is_verify);
|
|
|
+ $AES_encrypted = utils::AES_encrypted($is_verify);
|
|
|
$secret_key = common::excuteOneSql("select secret_key from customer_service_secret_key
|
|
|
where secret_key = '$is_verify'
|
|
|
and create_time >= current_date - INTERVAL '3 months' limit 1");
|
|
|
@@ -144,7 +144,7 @@ class login {
|
|
|
//如是是token登录,则不用验证密码
|
|
|
if(isset($_POST['token']) && !empty($_POST['token'])){
|
|
|
$is_verify = $_POST['token'];
|
|
|
- $AES_encrypted = $this->AES_encrypted($is_verify);
|
|
|
+ $AES_encrypted = utils::AES_encrypted($is_verify);
|
|
|
$secret_key = common::excuteOneSql("select secret_key from customer_service_secret_key
|
|
|
where secret_key = '$is_verify'
|
|
|
and create_time >= current_date - INTERVAL '3 months' limit 1");
|
|
|
@@ -616,7 +616,7 @@ class login {
|
|
|
$email = common::check_input($_POST['email']);
|
|
|
$is_verify = common::check_input($_POST['verifcation_code']);
|
|
|
//首先校用户验证
|
|
|
- $AES_encrypted = $this->AES_encrypted($is_verify);
|
|
|
+ $AES_encrypted = utils::AES_encrypted($is_verify);
|
|
|
$secret_key = common::excuteOneSql("select secret_key from customer_service_secret_key
|
|
|
where secret_key = '$is_verify'
|
|
|
and create_time >= current_date - INTERVAL '3 months' limit 1");
|
|
|
@@ -634,12 +634,15 @@ class login {
|
|
|
|
|
|
$msg = "";
|
|
|
if (!empty($email) || !empty($login)) {
|
|
|
- $sql_p = "select User_Login, ra_password as password from public.ra_online_user where md5(lower(user_login)) = ? and md5(lower(email)) = ?";
|
|
|
+ $sql_p = "select User_Login, ra_password as password,user_type,
|
|
|
+ to_char(now(), 'Mon-DD-YYYY') as current_date,to_char(now(), 'Mon-DD-YYYY HH:mm:ss') as current_time
|
|
|
+ from public.ra_online_user where md5(lower(user_login)) = ? and md5(lower(email)) = ?";
|
|
|
//$rs = common::excuteObjectSql($sql_p);
|
|
|
$rs = common::excuteObjectPrepareSql($sql_p,[md5(strtolower($login)),md5(strtolower($email))]);
|
|
|
|
|
|
if (!empty($rs)) {
|
|
|
$r = utils::sendEmailByPassword($login, $rs['password'], $email);
|
|
|
+ //$r = utils::sendEmailByResetPassword($rs, $email);
|
|
|
if ($r == 'success') {
|
|
|
$msg = "success";
|
|
|
} else {
|
|
|
@@ -1266,7 +1269,7 @@ class login {
|
|
|
$db->Execute("INSERT INTO public.tracking_login_record(ip, visit_count,visit_time,type)VALUES ('$ip', '1', now(),'".common::check_input($_POST['type'])."');") or ( (!$db->ErrorMsg()) or error_log($db->ErrorMsg(), 0));
|
|
|
}else{
|
|
|
if ($ipInfo['visit_count'] > $Tracking_Search_Count){
|
|
|
- $AES_encrypted = $this->AES_encrypted($is_verify);
|
|
|
+ $AES_encrypted = utils::AES_encrypted($is_verify);
|
|
|
$secret_key = common::excuteOneSql("select secret_key from customer_service_secret_key
|
|
|
where secret_key = '$is_verify'
|
|
|
and create_time >= current_date - INTERVAL '3 months' limit 1");
|
|
|
@@ -1539,16 +1542,75 @@ class login {
|
|
|
FROM $_schemas.contacts c WHERE o.final_desination::text = c.contact_id::text) fd ON true";
|
|
|
return $sql;
|
|
|
}
|
|
|
-
|
|
|
- private function AES_encrypted($encrypted_string,$isbase64_encode = true){
|
|
|
- $key = 'fT5!R1k$7Mv@4Q9X'; // 16 bytes key
|
|
|
- $iv = '1234567890123456'; // 16 bytes IV
|
|
|
- if($isbase64_encode){
|
|
|
- $decrypted = openssl_decrypt(base64_decode($encrypted_string), 'AES-128-CBC', $key, OPENSSL_RAW_DATA, $iv);
|
|
|
- }else{
|
|
|
- $decrypted = openssl_decrypt($encrypted_string, 'AES-128-CBC', $key, OPENSSL_RAW_DATA, $iv);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 邮件链接 重置密码或者激活密码
|
|
|
+ */
|
|
|
+ private function resetAndActivateInit(){
|
|
|
+ $verifcation_code = $_REQUEST['verifcation_code'];
|
|
|
+ $AES_encrypted = utils::AES_encrypted($verifcation_code);
|
|
|
+
|
|
|
+ $secret_key = common::excuteOneSql("select secret_key from customer_service_secret_key
|
|
|
+ where secret_key = '$verifcation_code'
|
|
|
+ and create_time >= current_date - INTERVAL '7 days' limit 1");
|
|
|
+
|
|
|
+ if(!empty($AES_encrypted) && !empty($secret_key)){
|
|
|
+ //验证成功且数据库里有该code,进行密码的重置和修改逻辑
|
|
|
+ $data = array(
|
|
|
+ 'msg' => "success",
|
|
|
+ 'data' => ''
|
|
|
+ );
|
|
|
+ common::echo_json_encode(200, $data);
|
|
|
+ exit();
|
|
|
+ } else {
|
|
|
+ $data = array(
|
|
|
+ 'msg' => 'verifcation_Invalid',
|
|
|
+ 'data' => ''
|
|
|
+ );
|
|
|
+ common::echo_json_encode(500, $data);
|
|
|
+ exit();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private function resetAndActivateUpdate(){
|
|
|
+ $verifcation_code = $_REQUEST['verifcation_code'];
|
|
|
+ $AES_encrypted = utils::AES_encrypted($verifcation_code);
|
|
|
+
|
|
|
+ $secret_key = common::excuteOneSql("select secret_key from customer_service_secret_key
|
|
|
+ where secret_key = '$verifcation_code'
|
|
|
+ and create_time >= current_date - INTERVAL '7 days' limit 1");
|
|
|
+
|
|
|
+ if(!empty($AES_encrypted) && !empty($secret_key)){
|
|
|
+ //使用后,移除之前数据库里安全密
|
|
|
+ common::excuteUpdateSql("delete from customer_service_secret_key where secret_key = '$verifcation_code'");
|
|
|
+ //提交的时候再次验证通过,进行修改密码
|
|
|
+ $loginName = $AES_encrypted;
|
|
|
+ $password = $_REQUEST['password'];
|
|
|
+
|
|
|
+ $msg = $this->updateExpirePassword($loginName, $password);
|
|
|
+ if($msg == "success"){
|
|
|
+ $data = array(
|
|
|
+ 'msg' => "success",
|
|
|
+ 'data' => ''
|
|
|
+ );
|
|
|
+ common::echo_json_encode(200, $data);
|
|
|
+ exit();
|
|
|
+ } else {
|
|
|
+ $data = array(
|
|
|
+ 'msg' => $msg,
|
|
|
+ 'data' => ''
|
|
|
+ );
|
|
|
+ common::echo_json_encode(500, $data);
|
|
|
+ exit();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $data = array(
|
|
|
+ 'msg' => 'verifcation_Invalid',
|
|
|
+ 'data' => ''
|
|
|
+ );
|
|
|
}
|
|
|
- return $decrypted;
|
|
|
+ common::echo_json_encode(500, $data);
|
|
|
+ exit();
|
|
|
}
|
|
|
}
|
|
|
|