public function call($method, $parameters = array(), $appId = 'default', $identity = "") { if ($identity) { switch ($identity) { case "buyer": pamAccount::setAuthType('sysuser'); $oauth['auth_type'] = pamAccount::getAuthType('sysuser'); break; case "seller": pamAccount::setAuthType('sysshop'); $oauth['auth_type'] = pamAccount::getAuthType('sysshop'); break; case "shopadmin": pamAccount::setAuthType('desktop'); $oauth['auth_type'] = pamAccount::getAuthType('desktop'); break; } $oauth['account_id'] = pamAccount::getAccountId(); $oauth['account_name'] = pamAccount::getLoginName(); } $parameters['oauth'] = $oauth; if ($this->distribute()) { if ($appId != 'default') { $appId = $appId; } return $this->callOutside($method, $parameters, $appId); } else { return $this->callInternal($method, $parameters); } }
function check_name($login_name) { $pam = app::get('desktop')->model('account'); $account_type = pamAccount::getAuthType($this->app->app_id); $aData = $pam->getList('*', array('login_name' => $login_name, 'account_type' => $account_type)); $result = $aData[0]['account_id']; if ($result) { return true; } else { return false; } }
public function listener_login($params) { $account_type = pamAccount::getAuthType('desktop'); if ($account_type === $params['type'] && $params['member_id']) { $users = app::get('desktop')->model('users'); if ($row = $users->getList('*', array('user_id' => $params['member_id']))) { $sdf['lastlogin'] = time(); $sdf['lastip'] = request::getClientIp(); $sdf['logincount'] = $row[0]['logincount'] + 1; $users->update($sdf, array('user_id' => $params['member_id'])); } } }
private function login($filter) { $user_data['login_name'] = $filter['uname']; $user_data['account_type'] = pamAccount::getAuthType('desktop'); $user_data['disabled'] = 0; $arr = app::get('desktop')->model('account')->getRow('account_id,login_password', $user_data); if (!$arr) { return false; } $checkPwd = pam_encrypt::check($filter['password'], $arr['login_password']); if (!$checkPwd) { return false; } return $arr; }
function chkpassword() { $this->begin('?app=desktop&ctl=users&act=index'); $users = $this->app->model('users'); if ($_POST) { $sdf = $users->dump($_POST['user_id'], '*', array(':account@desktop' => array('*'), 'roles' => array('*'))); $old_password = $sdf['account']['login_password']; //这里加了一个判断,判断是自行改密码还是超级管理员去修改 //如果是自行改密码,就去匹配自己的密码。如果是管理员的话,就去匹配超级管理员的密码 if ($_POST['self'] == 'self') { $_POST['user_id'] = $this->user->get_id(); $filter['account_id'] = $this->user->get_id(); $filter['account_type'] = pamAccount::getAuthType(); } else { $super_row = $users->getList('user_id', array('super' => '1')); $filter['account_id'] = $super_row[0]['user_id']; $filter['account_type'] = pamAccount::getAuthType(); $super_data = $users->dump($filter['account_id'], '*', array(':account@desktop' => array('*'))); } $pass_row = app::get('desktop')->model('account')->getRow('account_id,login_password', $filter); if (!$pass_row || !pam_encrypt::check(input::get('old_login_password'), $pass_row['login_password'])) { $this->end(false, app::get('desktop')->_('管理员密码或原始密码不正确')); } elseif (!(strlen($_POST['new_login_password']) >= 6 && preg_match("/\\d+/", $_POST['new_login_password']) && preg_match("/[a-zA-Z]+/", $_POST['new_login_password']))) { $this->end(false, app::get('desktop')->_('密码必须同时包含字母及数字且长度不能小于6!')); } elseif ($sdf['account']['login_name'] == $_POST['new_login_password']) { $this->end(false, app::get('desktop')->_('用户名与密码不能相同')); } elseif ($_POST['new_login_password'] !== $_POST['pam_account']['login_password']) { // //修改0000!=00000为true的问题@lujy $this->end(false, app::get('desktop')->_('两次密码不一致')); } else { $_POST['pam_account']['account_id'] = $_POST['user_id']; $_POST['pam_account']['login_password'] = pam_encrypt::make(trim($_POST['new_login_password'])); $users->save($_POST); $this->end(true, app::get('desktop')->_('密码修改成功')); } } $pagedata['user_id'] = $_GET['id']; $pagedata['self'] = $_GET['self']; $this->adminlog("修改平台管理员密码[{$_POST['user_id']}]", 1); return $this->page('desktop/users/chkpass.html', $pagedata); }
function listener_login($params) { $opencheck = false; $objCertchecks = kernel::servicelist("desktop.cert.check"); foreach ($objCertchecks as $objCertcheck) { if (method_exists($objCertcheck, 'certcheck') && $objCertcheck->certcheck()) { $opencheck = true; break; } } if (!$opencheck || $this->is_internal_ip() || $this->is_demosite()) { return; } if ($params['type'] === pamAccount::getAuthType('desktop')) { $result = $this->check_certid(); if ($result['res'] == 'succ' && $result['info']['valid']) { return; } else { unset($_SESSION['account'][$params['type']]); switch ($result['msg']) { case "invalid_version": $msg = "版本号有误,查看mysql是否运行正常"; break; case "RegUrlError": $msg = "你当前使用的域名与激活码所绑定的域名不一致。</br>如果你确认需要更改域名,请将“老域名”,“新域名”,“shopexid”,“激活码”发送至邮箱:ecstore_service@shopex.cn</br>如果不是更改域名,请使用激活码所绑定的域名来登陆ECstore。</br>"; break; case "SessionError": $msg = "中心请求网店API失败!请找服务商或自行检测网络,保证网络正常。"; break; case "license_error": $msg = "证书号错误!请确认config/certi.php文件真的存在!"; break; case "method_not_exist": $msg = "接口方法不存在!"; break; case "method_file_not_exist": $msg = "接口文件不存在!"; break; case "NecessaryArgsError": $msg = "缺少必填参数!"; break; case "ProductTypeError": $msg = "产品类型错误!"; break; case "UrlFormatUrl": $msg = "URL格式错误!"; break; case "invalid_sign": $msg = "验签错误!"; break; default: $msg = null; break; } if ($result == null) { $msg = "请检测您的服务器域名解析是否正常!"; } $pagedata['msg'] = $msg ? $msg : ""; $pagedata['url'] = $url = url::route('shopadmin'); $pagedata['code_url'] = url::route('shopadmin', array('app' => 'desktop', 'ctl' => 'code', 'act' => 'error_view')); return view::make('desktop/codetip.html', $pagedata); } } }