|
|
@@ -22,7 +22,7 @@ class login {
|
|
|
}
|
|
|
|
|
|
private function getLoginSql() {
|
|
|
- return "select first_name,last_name,user_login,
|
|
|
+ return "select first_name,last_name,user_login,user_id,
|
|
|
redant_decode(temp_password) as temp_password,(temp_password_expires > LOCALTIMESTAMP) as is_temp_password_expires,
|
|
|
employee_company_name,employee_contact_id_user,employee_search_type,employee_air_company_name,employee_air_contact_id_user,employee_air_search_type,
|
|
|
(select active from public.employee ee where ee.employee_id=u.employee_id) as employee_id_active,
|
|
|
@@ -299,14 +299,20 @@ class login {
|
|
|
|
|
|
//添加FAQ客户的访问类型
|
|
|
$loginCount = common::excuteOneSql("select count(*) from public.ra_online_user_login_log where lower(user_name) = '".strtolower(common::check_input($uname))."' and date_time >= CURRENT_DATE - INTERVAL '30 day' AND date_time <= CURRENT_DATE");
|
|
|
+ //查询该用户下的mapping
|
|
|
+ $kam_customers_name = common::excuteListSql("select
|
|
|
+ (select user_login from public.ra_online_user u where u.user_id = m.responsible_customers_id) as kam_customers_name
|
|
|
+ from public.ra_online_user_kam_mapping m where m.kam_account_id = '".$rs['user_id']."'");
|
|
|
$kln_user_info = array("uname"=>$rs['user_login'],
|
|
|
"employee_email"=>$rs['employee_email'],
|
|
|
//"employee_email"=>"andy.wu@united-cn.net",
|
|
|
"user_type"=>strtolower($rs['user_type']),
|
|
|
+ //"user_type"=>strtolower('customer'),
|
|
|
"first_name"=>$rs['first_name'],
|
|
|
"last_name"=>$rs['last_name'],
|
|
|
"is_desensitization_kln"=>$rs['is_desensitization_kln'],
|
|
|
"email"=>$rs['email'],
|
|
|
+ "kam_customers_name"=>$kam_customers_name,
|
|
|
"expire_day"=>$PASSWORD_CHANGE_CYCLE - $rs['last_pwd_change_date'],
|
|
|
"PASSWORD_CHANGE_CYCLE"=>intval($PASSWORD_CHANGE_CYCLE),
|
|
|
"subscribe_notification_default_init"=>$subscribe_notification_default_init,
|
|
|
@@ -685,25 +691,28 @@ class login {
|
|
|
return $captcha;
|
|
|
}
|
|
|
|
|
|
- public function do_login_auto() {
|
|
|
+ public function do_login_auto($is_demo = '') {
|
|
|
$uname = common::check_input($_GET['u']);
|
|
|
$password = common::check_input($_GET['p']);
|
|
|
$login_error_times = common::excuteOneSql("select ra_value from ra_online_config where ra_name='Login_Error_Times'");
|
|
|
$lock_user_seconds = common::excuteOneSql("select ra_value from ra_online_config where ra_name='Lock_User_Seconds'");
|
|
|
if (!empty($uname) || !empty($password)) {
|
|
|
-
|
|
|
+
|
|
|
} else {
|
|
|
$uname = common::check_input($_POST['uname']);
|
|
|
+ //检查长度,大于50,返回 no_exist
|
|
|
+ common::checkUserNameLength($uname);
|
|
|
+
|
|
|
$sql = $this->getLoginSql();
|
|
|
$rs = common::excuteObjectPrepareSql($sql,[md5(strtolower($uname))]);
|
|
|
- if (empty($rs['belong_schemas'])) {
|
|
|
- $rs['belong_schemas'] = "public";
|
|
|
- }
|
|
|
- if (empty($rs['main_schemas'])) {
|
|
|
- $rs['main_schemas'] = "public";
|
|
|
- }
|
|
|
|
|
|
if (!empty($rs)) {
|
|
|
+ if (empty($rs['belong_schemas'])) {
|
|
|
+ $rs['belong_schemas'] = "public";
|
|
|
+ }
|
|
|
+ if (empty($rs['main_schemas'])) {
|
|
|
+ $rs['main_schemas'] = "public";
|
|
|
+ }
|
|
|
//验证employee是否active
|
|
|
if (!empty($rs["employee_id"]) && $rs["employee_id_active"] != "t") {
|
|
|
if (strtolower(Soure) =='topocean'){
|
|
|
@@ -714,20 +723,21 @@ class login {
|
|
|
}
|
|
|
}
|
|
|
if (strtolower(Soure) =='apex'){
|
|
|
- $data = "<a href='mailto:maria.jj.wang@kln.com'>maria.jj.wang@kln.com</a>";
|
|
|
+ $data = "<a href='mailto:maria.wang@apexshipping.com.cn'>maria.wang@apexshipping.com.cn</a>";
|
|
|
}
|
|
|
|
|
|
$data = array(
|
|
|
- 'msg' => 'no_active',
|
|
|
+ 'code' => 'no_active',
|
|
|
'login_version' => $rs["login_version"],
|
|
|
- 'data' => $data
|
|
|
+ 'data' => $data,
|
|
|
+ 'msg' => "Please check with Doc Center $data for searching function"
|
|
|
);
|
|
|
common::echo_json_encode(500, $data);
|
|
|
$this->failedLogin($uname, 'Employee not active');
|
|
|
exit();
|
|
|
}
|
|
|
|
|
|
- //add 处理登录状态
|
|
|
+ //处理登录状态
|
|
|
$userInfo = common::check_input($_COOKIE['userInfo']);
|
|
|
|
|
|
$noCheckPwd = false;
|
|
|
@@ -740,79 +750,108 @@ class login {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- //if (!$noCheckPwd) {
|
|
|
- if ($rs['error_login_count'] > $login_error_times && $rs['second'] < $lock_user_seconds) {
|
|
|
+
|
|
|
+ if ($rs['error_login_count'] > $login_error_times && $rs['second'] < $lock_user_seconds) {
|
|
|
$data = array(
|
|
|
'msg' => 'error_times',
|
|
|
'login_version' => $rs["login_version"],
|
|
|
'data' => ceil(($lock_user_seconds - $rs['second']) / 60)
|
|
|
);
|
|
|
- common::echo_json_encode(500, $data);
|
|
|
+ common::echo_json_encode(400, $data);
|
|
|
|
|
|
$this->failedLogin($uname, 'Failed login too times');
|
|
|
exit();
|
|
|
+ }
|
|
|
+ if ($rs['is_online'] != 't') {
|
|
|
+ if (strtolower($rs['user_type']) != "employee") {
|
|
|
+ $data =array(
|
|
|
+ 'code' => 'no_online',
|
|
|
+ 'login_version' => $rs["login_version"],
|
|
|
+ 'data' => '',
|
|
|
+ 'msg' => 'No activation or insufficient permissions'
|
|
|
+ );
|
|
|
+ common::echo_json_encode(500, $data);
|
|
|
+ $this->failedLogin($uname, 'Online is not active');
|
|
|
+ exit();
|
|
|
}
|
|
|
- if ($rs['is_online'] != 't') {
|
|
|
- if (strtolower($rs['user_type']) != "employee") {
|
|
|
- $data =array(
|
|
|
- 'msg' => 'no_online',
|
|
|
+ }
|
|
|
+
|
|
|
+ //if ($rs['decrypt_password'] != $_POST['psw']) {
|
|
|
+ if ($noCheckPwd) {
|
|
|
+
|
|
|
+ }else{
|
|
|
+ //如是是token登录,则不用验证密码
|
|
|
+ if(isset($_POST['token']) && !empty($_POST['token'])){
|
|
|
+ $is_verify = $_POST['token'];
|
|
|
+ //$AES_encrypted = utils::AES_encrypted($is_verify,true,"fT5!R1k$7Mv@4Q9X","1234567890123456");
|
|
|
+ $AES_encrypted = utils::AES_encrypted($is_verify,true,"USAIandy20244Q9X","1234567890123456");
|
|
|
+ $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");
|
|
|
+ //记录这次的密钥记录
|
|
|
+ common::excuteUpdateSql("INSERT INTO public.customer_service_secret_key(secret_key, create_time)VALUES ('$is_verify', now());");
|
|
|
+ //密钥解析失败或者有重复的记录这提示登录失败
|
|
|
+ if(!(!empty($AES_encrypted) && empty($secret_key))){
|
|
|
+ $data = array(
|
|
|
+ 'msg' => 'Invalid token',
|
|
|
'login_version' => $rs["login_version"],
|
|
|
'data' => ''
|
|
|
);
|
|
|
- common::echo_json_encode(500, $data);
|
|
|
- $this->failedLogin($uname, 'Online is not active');
|
|
|
+ common::echo_json_encode(400, $data);
|
|
|
exit();
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- //if ($rs['decrypt_password'] != $_POST['psw']) {
|
|
|
- if ($noCheckPwd) {
|
|
|
- }else{
|
|
|
- if ($rs['password'] != $_POST['psw']) {
|
|
|
+ }else{
|
|
|
+ if ($rs['password'] != $_POST['psw'] && ($rs['temp_password'] != $_POST['psw'] || $rs['is_temp_password_expires'] == 'f')) {
|
|
|
common::excuteUpdateSql("update public.ra_online_user set error_login_count=error_login_count+1, error_login_time=now() where lower(user_login) = '" . strtolower($uname) . "'");
|
|
|
$data = array(
|
|
|
'msg' => 'password_error',
|
|
|
'login_version' => $rs["login_version"],
|
|
|
'data' => ''
|
|
|
);
|
|
|
- common::echo_json_encode(500, $data);
|
|
|
+ common::echo_json_encode(400, $data);
|
|
|
$this->failedLogin($uname, 'Password is wrong');
|
|
|
exit();
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- if ($rs['online_active'] != 't') {
|
|
|
- $data = array(
|
|
|
- 'msg' => 'no_active',
|
|
|
- 'login_version' => $rs["login_version"],
|
|
|
- 'data' => ''
|
|
|
- );
|
|
|
- common::echo_json_encode(500, $data);
|
|
|
- $this->failedLogin($uname, 'Online is not active');
|
|
|
- exit();
|
|
|
- }
|
|
|
- //check password length
|
|
|
- $tar = utils::checkPassword($rs['password']);
|
|
|
- if (!empty($tar)) {
|
|
|
- $data = array(
|
|
|
- 'msg' => $tar,
|
|
|
- 'login_version' => $rs["login_version"],
|
|
|
- 'data' => ''
|
|
|
- );
|
|
|
- common::echo_json_encode(500, $data);
|
|
|
- exit();
|
|
|
- }
|
|
|
- if (empty($rs['last_pwd_change'])) {
|
|
|
- $data = array(
|
|
|
- 'msg' => 'first_login',
|
|
|
- 'login_version' => $rs["login_version"],
|
|
|
- 'data' => ''
|
|
|
- );
|
|
|
- common::echo_json_encode(500, $data);
|
|
|
- exit();
|
|
|
}
|
|
|
- //}
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($rs['online_active'] != 't') {
|
|
|
+ $data = array(
|
|
|
+ 'code' => 'no_active',
|
|
|
+ 'login_version' => $rs["login_version"],
|
|
|
+ 'data' => '',
|
|
|
+ 'msg' => 'Please check with Doc Center for searching function'
|
|
|
+ );
|
|
|
+ common::echo_json_encode(500, $data);
|
|
|
+ $this->failedLogin($uname, 'Online is not active');
|
|
|
+ exit();
|
|
|
+ }
|
|
|
+ //check password length
|
|
|
+ $tar = utils::checkPassword($rs['password']);
|
|
|
+ if (!empty($tar)) {
|
|
|
+ $data = array(
|
|
|
+ 'code' => $tar,
|
|
|
+ 'login_version' => $rs["login_version"],
|
|
|
+ 'data' => '',
|
|
|
+ 'msg' => $tar
|
|
|
+ );
|
|
|
+ common::echo_json_encode(500, $data);
|
|
|
+ exit();
|
|
|
+ }
|
|
|
+ //第一次登录,改密码
|
|
|
+ if (empty($rs['last_pwd_change'])) {
|
|
|
+ $data = array(
|
|
|
+ 'login_version' => $rs["login_version"],
|
|
|
+ 'data' => '',
|
|
|
+ 'uname' =>$uname,
|
|
|
+ 'user_info' => array("uname"=>$uname),
|
|
|
+ 'msg' => 'First login, please change your password'
|
|
|
+ );
|
|
|
+ common::echo_json_encode(400, $data);
|
|
|
+ exit();
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
//get more infor by employee_id or contact_id
|
|
|
$sql = '';
|
|
|
@@ -868,42 +907,85 @@ class login {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /* if ($diffdate > $PASSWORD_CHANGE_CYCLE) {// Timeout
|
|
|
- echo json_encode(array(
|
|
|
- 'msg' => 'password_require_change',
|
|
|
- 'login_version' => $rs["login_version"],
|
|
|
- 'data' => ''
|
|
|
- ));
|
|
|
- $this->failedLogin($uname, 'Required password change');
|
|
|
- exit();
|
|
|
- }*/
|
|
|
-
|
|
|
$loginName = $rs['user_login'];
|
|
|
$email = $rs['email'];
|
|
|
- if ($diffdate > $PASSWORD_CHANGE_CYCLE) {// Timeout
|
|
|
+ //Timeout
|
|
|
+ if ($diffdate > $PASSWORD_CHANGE_CYCLE) {
|
|
|
if(empty($email)){
|
|
|
$data = array(
|
|
|
'status' => '0',
|
|
|
- 'msg' => 'login user email is empty',
|
|
|
+ 'code' => 'login user email is empty',
|
|
|
'login_version' => $rs["login_version"],
|
|
|
- 'data' => ''
|
|
|
+ 'msg' => 'login user email is empty'
|
|
|
);
|
|
|
common::echo_json_encode(500, $data);
|
|
|
exit();
|
|
|
}else{
|
|
|
- //$this -> passwordExpires($loginName,$email);
|
|
|
+ $this -> passwordExpires($loginName,$email,$uname);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //kln新版查询 date_format,numbers_format
|
|
|
+ $kln_user = common::excuteObjectSql("select * from public.kln_user_extend where lower(user_login) = '".strtolower($uname)."'");
|
|
|
+
|
|
|
+ //检查用户是否是设置过subscribe_notification,加在这里,少一次请求
|
|
|
+ $count = common::excuteOneSql("select count(*) from public.notifications_rules where
|
|
|
+ notifications_type = 'Subscribe'
|
|
|
+ and lower(user_login) = '".strtolower($uname)."'");
|
|
|
+ $subscribe_notification_default_init = $count > 0 ? false:true;
|
|
|
+
|
|
|
+ //添加FAQ客户的访问类型
|
|
|
+ $loginCount = common::excuteOneSql("select count(*) from public.ra_online_user_login_log where lower(user_name) = '".strtolower(common::check_input($uname))."' and date_time >= CURRENT_DATE - INTERVAL '30 day' AND date_time <= CURRENT_DATE");
|
|
|
+
|
|
|
+ //查询该用户下的mapping
|
|
|
+ // $kam_customers_name = common::excuteListSql("select
|
|
|
+ // (select user_login from public.ra_online_user u where u.user_id = m.responsible_customers_id) as kam_customers_name
|
|
|
+ // from public.ra_online_user_kam_mapping m where m.kam_account_id = '".$rs['user_id']."'");
|
|
|
+ $kln_user_info = array("uname"=>$rs['user_login'],
|
|
|
+ "employee_email"=>$rs['employee_email'],
|
|
|
+ //"employee_email"=>"andy.wu@united-cn.net",
|
|
|
+ "user_type"=>strtolower($rs['user_type']),
|
|
|
+ "first_name"=>$rs['first_name'],
|
|
|
+ "last_name"=>$rs['last_name'],
|
|
|
+ "is_desensitization_kln"=>$rs['is_desensitization_kln'],
|
|
|
+ "email"=>$rs['email'],
|
|
|
+ //"kam_customers_name"=>$kam_customers_name,
|
|
|
+ "expire_day"=>$PASSWORD_CHANGE_CYCLE - $rs['last_pwd_change_date'],
|
|
|
+ "PASSWORD_CHANGE_CYCLE"=>intval($PASSWORD_CHANGE_CYCLE),
|
|
|
+ "subscribe_notification_default_init"=>$subscribe_notification_default_init,
|
|
|
+ "last_pwd_change"=>$rs['last_pwd_change'],
|
|
|
+ "date_format"=>$kln_user['date_format'],
|
|
|
+ "numbers_format"=>$kln_user['numbers_format'],
|
|
|
+ "loginCount"=>intval($loginCount));
|
|
|
+ //添加密码是否快过期的消息通知 7 天内,3天内的通知
|
|
|
+ $expire_day = ($PASSWORD_CHANGE_CYCLE - $rs['last_pwd_change_date']);
|
|
|
+ if($expire_day <= 7){
|
|
|
+ $exist = common::excuteListSql("select notifiation_type from public.kln_notifiation_info where notifiation_type = 'Passwond_Notifcations'
|
|
|
+ and lower(user_login) = '".strtolower($uname)."' and other_pnum = '".$expire_day."'");
|
|
|
+ if (empty($exist)){
|
|
|
+ $other_name = "Password Expiration in $expire_day Days";
|
|
|
+ $other_desc = "Your password will expire in $expire_day days. To ensure the security of your
|
|
|
+ account, please change your password as soon as possible.";
|
|
|
+ $message_sql ="INSERT INTO public.kln_notifiation_info(notifiation_type, other_name, other_desc, other_img, notifications_method, email_method,
|
|
|
+ user_login, insert_date, readed_date, is_send_message, is_send_email,
|
|
|
+ frequency_type, other_type, other_pnum)
|
|
|
+ VALUES ('Passwond_Notifcations','".$other_name."','".$other_desc."','',true,false,'".$uname."',now(),null,null,null,'Instant','password','".$expire_day."');";
|
|
|
+ common::excuteUpdateSql($message_sql);
|
|
|
+ }
|
|
|
+ }
|
|
|
if ($diffdate == $PASSWORD_CHANGE_CYCLE) {// Due today
|
|
|
$login_tmp = array(
|
|
|
'msg' => 'today',
|
|
|
+ "uname"=>$uname,
|
|
|
+ 'user_info' => $kln_user_info,
|
|
|
'login_version' => $rs["login_version"],
|
|
|
'data' => ''
|
|
|
);
|
|
|
} elseif ($diffdate >= ($PASSWORD_CHANGE_CYCLE - $PASSWORD_CHANGE_ALERT)) {// Password expires soon, JS Tips
|
|
|
$login_tmp = array(
|
|
|
'msg' => 'last',
|
|
|
+ "uname"=>$uname,
|
|
|
+ 'user_info' => $kln_user_info,
|
|
|
'login_version' => $rs["login_version"],
|
|
|
'data' => $PASSWORD_CHANGE_CYCLE - $diffdate,
|
|
|
'is_only_vgm' => $rs["is_only_vgm"]
|
|
|
@@ -917,15 +999,21 @@ class login {
|
|
|
common::excuteUpdateSql("update public.ra_online_user set Last_Login_Time = now(), error_login_count=0, error_login_time=null where lower(user_login) = '" . strtolower($uname) . "'");
|
|
|
//自动登录。为了方便调用,先注销掉
|
|
|
if (isset($login_tmp)) {
|
|
|
- //common::echo_json_encode(500, $login_tmp);
|
|
|
+ if($is_demo <> 'test'){
|
|
|
+ common::echo_json_encode(500, $login_tmp);
|
|
|
+ }
|
|
|
} else {
|
|
|
$data = array(
|
|
|
'msg' => 'success',
|
|
|
+ "uname"=>$uname,
|
|
|
+ 'user_info' => $kln_user_info,
|
|
|
'login_version' => $rs["login_version"],
|
|
|
'data' => '',
|
|
|
'is_only_vgm' => $rs["is_only_vgm"]
|
|
|
);
|
|
|
- //common::echo_json_encode("200", $data);
|
|
|
+ if($is_demo <> 'test'){
|
|
|
+ common::echo_json_encode(200, $data);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
$online_user = $rs;
|
|
|
@@ -948,9 +1036,9 @@ class login {
|
|
|
}
|
|
|
|
|
|
if (!empty($online_user['docdownload']))
|
|
|
- $sql = "select string_agg(standard, ';') as standard,string_agg(serial_no, ';') as serial_no, string_agg(m_h, ';') as m_h, display_name from ra_online_file_format where lower(serial_no) " . common::getInNotInSql($online_user['docdownload']) . " and active = true group by display_name order by min(id)";
|
|
|
+ $sql = "select string_agg(standard, ';') as standard,string_agg(serial_no, ';') as serial_no, string_agg(m_h, ';') as m_h, display_name from ra_online_file_format where lower(serial_no) " . common::getInNotInSql($online_user['docdownload']) . " and active = true group by display_name order by min(id)";
|
|
|
else {
|
|
|
- $sql = "select string_agg(standard, ';') as standard,string_agg(serial_no, ';') as serial_no, string_agg(m_h, ';') as m_h, display_name from ra_online_file_format where active = true";
|
|
|
+ $sql = "select string_agg(standard, ';') as standard,string_agg(serial_no, ';') as serial_no, string_agg(m_h, ';') as m_h, display_name from ra_online_file_format where active = true";
|
|
|
if (strtolower($online_user['user_type']) == "customer")
|
|
|
$sql .= " and client_display = true";
|
|
|
$sql .= " group by display_name order by min(id)";
|
|
|
@@ -958,9 +1046,9 @@ class login {
|
|
|
$online_user['view_doc_type'] = common::excuteListSql($sql);
|
|
|
|
|
|
if (!empty($online_user['view_air_file_format']))
|
|
|
- $sql = "select string_agg(standard, ';') as standard,string_agg(serial_no, ';') as serial_no, string_agg(m_h, ';') as m_h, display_name from air_file_format where lower(serial_no) " . common::getInNotInSql($online_user['view_air_file_format']) . " and active = true group by display_name order by min(id)";
|
|
|
+ $sql = "select string_agg(standard, ';') as standard,string_agg(serial_no, ';') as serial_no, string_agg(m_h, ';') as m_h, display_name from air_file_format where lower(serial_no) " . common::getInNotInSql($online_user['view_air_file_format']) . " and active = true group by display_name order by min(id)";
|
|
|
else {
|
|
|
- $sql = "select string_agg(standard, ';') as standard,string_agg(serial_no, ';') as serial_no, string_agg(m_h, ';') as m_h, display_name from air_file_format where active = true";
|
|
|
+ $sql = "select string_agg(standard, ';') as standard,string_agg(serial_no, ';') as serial_no, string_agg(m_h, ';') as m_h, display_name from air_file_format where active = true";
|
|
|
if (strtolower($online_user['user_type']) == "customer")
|
|
|
$sql .= " and client_display = true";
|
|
|
$sql .= " group by display_name order by min(id)";
|
|
|
@@ -1001,18 +1089,18 @@ class login {
|
|
|
continue;
|
|
|
}
|
|
|
$ttdd = common::excuteObjectSql("select contact_id_user, employee_id, contact_id, user_type, email, user_webtype_id, active, is_online, station, allow_login_remote, can_see_amslog,can_view_eccn, can_see_isflog, can_see_isflog_withaddress,
|
|
|
- customer_search_type, customer_destination, can_add_ams, can_add_isf, air_station, air_sales, ocean_station, ocean_sales,ocean_following_sales,ocean_following_sales_or,air_following_sales,air_following_sales_or, trucking_station, ocean_dest_op, can_see_password, can_add_opsales_code, ocean_station_or, ocean_agent_or, ocean_sales_or, ocean_dest_op_or, air_station_or, air_sales_or, trucking_station_or,
|
|
|
- can_add_user, can_add_employee, can_add_contact, company_name, ams_email, isf_email, customer_discharge, online_active, is_super, ocean_agent,active, can_send_email, view_file_format as docdownload, container_status, consolidated_cbsa_code, can_add_aci,
|
|
|
- air_customers, air_customer_search_type,trucking_customers,trucking_customer_search_type, upload_document, view_file_format, event_type, po_status, view_air_file_format, special_customer_event, can_edi_vgm, isf_aci_ams_station, is_kerry_shipment from " . $sv['schemas_name'] . ".ra_online_user where lower(user_login) = '" . strtolower($uname) . "'");
|
|
|
+ customer_search_type, customer_destination, can_add_ams, can_add_isf, air_station, air_sales, ocean_station, ocean_sales,ocean_following_sales,ocean_following_sales_or,air_following_sales,air_following_sales_or, trucking_station, ocean_dest_op, can_see_password, can_add_opsales_code, ocean_station_or, ocean_agent_or, ocean_sales_or, ocean_dest_op_or, air_station_or, air_sales_or, trucking_station_or,
|
|
|
+ can_add_user, can_add_employee, can_add_contact, company_name, ams_email, isf_email, customer_discharge, online_active, is_super, ocean_agent,active, can_send_email, view_file_format as docdownload, container_status, consolidated_cbsa_code, can_add_aci,
|
|
|
+ air_customers, air_customer_search_type,trucking_customers,trucking_customer_search_type, upload_document, view_file_format, event_type, po_status, view_air_file_format, special_customer_event, can_edi_vgm, isf_aci_ams_station, is_kerry_shipment from " . $sv['schemas_name'] . ".ra_online_user where lower(user_login) = '" . strtolower($uname) . "'");
|
|
|
if (empty($ttdd)) {
|
|
|
unset($schemas_list[$sk]);
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
if (!empty($ttdd['docdownload'])) {
|
|
|
- $sql = "select string_agg(standard, ';') as standard,string_agg(serial_no, ';') as serial_no, string_agg(m_h, ';') as m_h, display_name from " . $sv['schemas_name'] . ".ra_online_file_format where lower(serial_no) " . common::getInNotInSql($ttdd['docdownload']) . " and active = true group by display_name order by min(id)";
|
|
|
+ $sql = "select string_agg(standard, ';') as standard,string_agg(serial_no, ';') as serial_no, string_agg(m_h, ';') as m_h, display_name from " . $sv['schemas_name'] . ".ra_online_file_format where lower(serial_no) " . common::getInNotInSql($ttdd['docdownload']) . " and active = true group by display_name order by min(id)";
|
|
|
} else {
|
|
|
- $sql = "select string_agg(standard, ';') as standard,string_agg(serial_no, ';') as serial_no, string_agg(m_h, ';') as m_h, display_name from " . $sv['schemas_name'] . ".ra_online_file_format where active = true";
|
|
|
+ $sql = "select string_agg(standard, ';') as standard,string_agg(serial_no, ';') as serial_no, string_agg(m_h, ';') as m_h, display_name from " . $sv['schemas_name'] . ".ra_online_file_format where active = true";
|
|
|
if (strtolower($ttdd['user_type']) == "customer")
|
|
|
$sql .= " and client_display = true";
|
|
|
$sql .= " group by display_name order by min(id)";
|
|
|
@@ -1020,9 +1108,9 @@ class login {
|
|
|
$ttdd['view_doc_type'] = common::excuteListSql($sql);
|
|
|
|
|
|
if (!empty($ttdd['view_air_file_format'])) {
|
|
|
- $sql = "select string_agg(standard, ';') as standard,string_agg(serial_no, ';') as serial_no, string_agg(m_h, ';') as m_h, display_name from " . $sv['schemas_name'] . ".air_file_format where lower(serial_no) " . common::getInNotInSql($ttdd['view_air_file_format']) . " and active = true group by display_name order by min(id)";
|
|
|
+ $sql = "select string_agg(standard, ';') as standard,string_agg(serial_no, ';') as serial_no, string_agg(m_h, ';') as m_h, display_name from " . $sv['schemas_name'] . ".air_file_format where lower(serial_no) " . common::getInNotInSql($ttdd['view_air_file_format']) . " and active = true group by display_name order by min(id)";
|
|
|
} else {
|
|
|
- $sql = "select string_agg(standard, ';') as standard,string_agg(serial_no, ';') as serial_no, string_agg(m_h, ';') as m_h, display_name from " . $sv['schemas_name'] . ".air_file_format where active = true";
|
|
|
+ $sql = "select string_agg(standard, ';') as standard, string_agg(serial_no, ';') as serial_no, string_agg(m_h, ';') as m_h, display_name from " . $sv['schemas_name'] . ".air_file_format where active = true";
|
|
|
if (strtolower($ttdd['user_type']) == "customer")
|
|
|
$sql .= " and client_display = true";
|
|
|
$sql .= " group by display_name order by min(id)";
|
|
|
@@ -1049,21 +1137,23 @@ class login {
|
|
|
}
|
|
|
}
|
|
|
//自动登录。为了方便调用,先注销掉
|
|
|
- //exit();
|
|
|
+ if($is_demo <> 'test'){
|
|
|
+ exit();
|
|
|
+ }
|
|
|
} else {
|
|
|
$data = array(
|
|
|
- 'msg' => 'database_error',
|
|
|
+ 'code' => 'database_error',
|
|
|
'login_version' => $rs["login_version"],
|
|
|
- 'data' => ''
|
|
|
+ 'msg' => 'database_error'
|
|
|
);
|
|
|
common::echo_json_encode(500, $data);
|
|
|
exit();
|
|
|
}
|
|
|
} else {
|
|
|
$data = array(
|
|
|
- 'msg' => 'no_exist',
|
|
|
+ 'code' => 'no_exist',
|
|
|
'login_version' => $rs["login_version"],
|
|
|
- 'data' => ''
|
|
|
+ 'msg' => 'The username or password you entered is incorrect'
|
|
|
);
|
|
|
common::echo_json_encode(500, $data);
|
|
|
exit();
|