Beispiel #1
0
 function post_uninstall()
 {
     pam_account::unregister_account_type('member');
     // set listener and modifier
     $app_b2c = app::get('b2c');
     $all = $app_b2c->getConf('system.event_listener');
     $len = strlen($ident) + 1;
     foreach ($all as $k => $m) {
         if ($all[$k][$m] == $this->arr_listener[$k]) {
             unset($all[$k][$m]);
         }
     }
     $app_b2c->setConf('system.event_listener', $all);
     $all = $app_b2c->getConf('system.event_listener_key');
     foreach ($all as $k => $m) {
         if ($all[$k][$m] == $this->arr_lister_keys[$k]) {
             unset($all[$k][$m]);
         }
     }
     $app_b2c->setConf('system.event_listener_key', $all);
     // 获取node_id...
     if (base_shopnode::node_id('b2c')) {
         base_shopnode::delete_node_id('b2c');
     }
 }
Beispiel #2
0
 function post_update()
 {
     if ($dbver['dbver'] < 2.1) {
         kernel::single('base_initial', 'wap')->init();
     }
     pam_account::register_account_type('wap', 'member', app::get('wap')->_('前台会员系统'));
 }
Beispiel #3
0
 function __construct()
 {
     $this->account_type = pam_account::get_account_type('desktop');
     if (isset($_SESSION['account'][$this->account_type])) {
         $this->user_id = $_SESSION['account'][$this->account_type];
         if (empty($_SESSION['account']['user_data'])) {
             $_SESSION['account']['user_data'] = array();
             $account = app::get('pam')->model('account');
             if ($row = $account->getList('account_id', array('account_id' => $this->user_id))) {
                 $model = app::get('desktop')->model('users');
                 $data = $model->getList('user_id', array('user_id' => $this->user_id));
                 if (!$data) {
                     unset($_SESSION['account'][$this->account_type]);
                 } else {
                     $_SESSION['account']['user_data'] = app::get('desktop')->model('users')->dump($this->user_id, '*', array(':account@pam' => array('*')));
                 }
             } else {
                 unset($_SESSION['account'][$this->account_type]);
             }
         }
         $this->user_data = $_SESSION['account']['user_data'];
     } else {
         $this->user_data = array();
     }
 }
Beispiel #4
0
 private function login($filter)
 {
     $type = pam_account::get_account_type('desktop');
     $user_data['login_name'] = $filter['uname'];
     $arr = app::get('pam')->model('account')->getList('*', array('login_name' => $filter['uname'], 'login_password' => pam_encrypt::get_encrypted_password($filter['password'], $type, $user_data), 'account_type' => $type, 'disabled' => 'false'), 0, 1);
     return $arr;
 }
Beispiel #5
0
 function save_profile()
 {
     $this->begin();
     $account_id = $this->user->get_id();
     $users = $this->app->model('users');
     $sdf = $users->dump($account_id, '*', array(':account@pam' => array('*'), 'roles' => array('*')));
     $save_data['user_id'] = $save_data['pam_account']['account_id'] = $account_id;
     if ($_POST['reset_password'] == '1') {
         $old_password = $sdf['account']['login_password'];
         $filter['account_id'] = $account_id;
         $filter['account_type'] = pam_account::get_account_type($this->app->app_id);
         $use_pass_data['login_name'] = $sdf['account']['login_name'];
         $use_pass_data['createtime'] = $sdf['account']['createtime'];
         $filter['login_password'] = pam_encrypt::get_encrypted_password(trim($_POST['rp']['old_login_password']), pam_account::get_account_type($this->app->app_id), $use_pass_data);
         $pass_row = app::get('pam')->model('account')->getList('account_id', $filter);
         if (!$pass_row) {
             $this->end(false, '原始密码不正确');
         } elseif (!(strlen($_POST['rp']['new_login_password']) >= 6 && preg_match("/\\d+/", $_POST['rp']['new_login_password']) && preg_match("/[a-zA-Z]+/", $_POST['rp']['new_login_password']))) {
             $this->end(false, '密码必须同时包含字母及数字且长度不能小于6!');
         } elseif ($_POST['rp']['new_login_password'] != $_POST['rp'][':account@pam']['login_password']) {
             $this->end(false, '两次密码不一致');
         } elseif ($sdf['account']['login_name'] == $_POST['rp']['new_login_password']) {
             $this->end(false, '用户名与密码不能相同');
         } else {
             $save_data['pam_account']['login_password'] = pam_encrypt::get_encrypted_password(trim($_POST['rp']['new_login_password']), pam_account::get_account_type($this->app->app_id), $use_pass_data);
         }
     }
     $save_data['op_no'] = $_POST['op_no'];
     $save_data['name'] = $_POST['name'];
     $save_data['avatar'] = $_POST['avatar'];
     $flag = $users->save($save_data);
     $this->end($flag, $flag ? '保存成功' : '保存失败');
 }
Beispiel #6
0
 function __construct(&$app)
 {
     parent::__construct($app);
     kernel::single('base_session')->start();
     $this->member_id = $_SESSION['account'][pam_account::get_account_type('b2c')];
     $this->username = $_COOKIE['loginName'];
 }
Beispiel #7
0
 function logout()
 {
     $this->user->login();
     $this->user->logout();
     unset($_SESSION['account'][pam_account::get_account_type($this->app->app_id)]);
     unset($_SESSION['last_error']);
     header('Location: index.php');
 }
Beispiel #8
0
 function __construct()
 {
     $this->account_type = pam_account::get_account_type('desktop');
     if (isset($_SESSION['account'][$this->account_type])) {
         $this->user_id = $_SESSION['account'][$this->account_type];
     }
     $this->user_data = app::get('desktop')->model('users')->dump($this->user_id, '*', array(':account@pam' => array('*')));
 }
Beispiel #9
0
 public function reset_op_password($params)
 {
     $users = app::get('desktop')->model('users');
     $sdf = $users->dump(1, '*', array(':account@pam' => array('*')));
     $use_pass_data['login_name'] = $sdf['account']['login_name'];
     $use_pass_data['createtime'] = $sdf['account']['createtime'];
     $_save_data['pam_account']['login_password'] = pam_encrypt::get_encrypted_password(trim($params['new_password']), pam_account::get_account_type('desktop'), $use_pass_data);
     $_save_data['pam_account']['account_id'] = $_save_data['user_id'] = 1;
     $users->save($_save_data);
     $this->success();
 }
Beispiel #10
0
 function listener_login($params)
 {
     $account_type = pam_account::get_account_type('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['logincount'] = $row[0]['logincount'] + 1;
             $users->update($sdf, array('user_id' => $params['member_id']));
         }
     }
 }
Beispiel #11
0
 function check_name($login_name)
 {
     $pam = app::get('pam')->model('account');
     $account_type = pam_account::get_account_type($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;
     }
 }
Beispiel #12
0
 public function logout($backurl = 'index.php')
 {
     $this->begin('index.php?app=desktop&ctl=dashboard');
     $this->user->login();
     $this->user->logout();
     $auth = pam_auth::instance(pam_account::get_account_type($this->app->app_id));
     foreach (vmc::servicelist('passport') as $k => $passport) {
         if ($auth->is_module_valid($k, $this->app->app_id)) {
             $passport->loginout($auth, $backurl);
         }
     }
     vmc::singleton('base_session')->destory();
     $this->end('true', '成功登出');
 }
Beispiel #13
0
 function post_login()
 {
     $url = $this->gen_url(array('app' => 'b2c', 'ctl' => 'site_member', 'act' => 'index'));
     $member_id = $_SESSION['account'][pam_account::get_account_type('b2c')];
     if ($member_id) {
         $obj_mem = app::get('b2c')->model('members');
         $obj_openid = app::get('openid')->model('openid');
         $member_point = app::get('b2c')->model('member_point');
         $member_data = $obj_mem->dump($member_id);
         $lv_model = app::get('b2c')->model('member_lv');
         $member_lv_id = $lv_model->get_default_lv();
         $result = kernel::single('openid_denglu')->get_user();
         $data = array('member_id' => $member_id, 'member_lv_id' => $member_lv_id, 'email' => $result['data']['email'], 'name' => empty($result['data']['nickname']) ? $result['data']['realname'] : $result['data']['nickname'], 'addr' => $result['data']['address'], 'sex' => $this->gender($result['data']['gender']), 'trust_name' => empty($result['data']['nickname']) ? $result['data']['realname'] : $result['data']['nickname']);
         $save = array('member_id' => $member_id, 'openid' => $result['data']['openid'], 'provider_code' => $result['data']['provider_code'], 'provider_openid' => $result['data']['provider_openid'], 'avatar' => $result['data']['avatar'], 'email' => $result['data']['email'], 'address' => $result['data']['address'], 'gender' => $result['data']['gender'], 'nickname' => $result['data']['nickname'], 'realname' => $result['data']['realname']);
         if (!$member_data) {
             $data['regtime'] = time();
             //注册时间
             if ($obj_mem->insert($data)) {
                 $obj_openid->insert($save);
                 $this->bind_member($member_id);
                 $this->splash('success', $url, app::get('b2c')->_('登录成功'));
             } else {
                 $this->splash('failed', $url, app::get('b2c')->_('登录失败,请联系商店管理员'));
             }
         } else {
             if ($obj_mem->update($data, array('member_id' => $member_id))) {
                 $obj_openid->update($save, array('openid' => $save['openid']));
             }
             $sdf = $obj_mem->dump($member_id);
             $obj_order = app::get('b2c')->model('orders');
             $msg = kernel::single('b2c_message_msg');
             $sdf['order_num'] = count($obj_order->getList('order_id', array('member_id' => $member_id)));
             $sdf['unreadmsg'] = count($msg->getList('*', array('to_id' => $member_id, 'has_sent' => 'true', 'for_comment_id' => 'all', 'mem_read_status' => 'false')));
             unset($msg);
             if (app::get('b2c')->getConf('site.level_switch') == 1) {
                 $sdf['member_lv']['member_group_id'] = $obj_mem->member_lv_chk($sdf['member_lv']['member_group_id'], $sdf['experience']);
             }
             if (app::get('b2c')->getConf('site.level_switch') == 0 && app::get('b2c')->getConf('site.level_point') == 1) {
                 $sdf['member_lv']['member_group_id'] = $member_point->member_lv_chk($member_id, $sdf['member_lv']['member_group_id'], $sdf['score']['total']);
             }
             $obj_mem->save($sdf);
             $this->bind_member($member_id);
             $this->splash('success', $url, app::get('b2c')->_('登录成功'));
         }
     } else {
         $this->splash('failed', kernel::base_url(1), app::get('b2c')->_('参数错误'));
     }
 }
Beispiel #14
0
    function logout($backurl = 'index.php')
    {
        $this->begin('javascript:Cookie.dispose("basicloginform_password");Cookie.dispose("basicloginform_autologin");
					   location="' . kernel::router()->app->base_url(1) . '"');
        $this->user->login();
        $this->user->logout();
        $auth = pam_auth::instance(pam_account::get_account_type($this->app->app_id));
        foreach (kernel::servicelist('passport') as $k => $passport) {
            if ($auth->is_module_valid($k, $this->app->app_id)) {
                $passport->loginout($auth, $backurl);
            }
        }
        kernel::single('base_session')->destory();
        $this->end('true', app::get('desktop')->_('已成功退出系统,正在转向...'));
        /* $this->redirect('');*/
    }
Beispiel #15
0
 function __construct($app)
 {
     $this->defaultwg = $this->defaultWorkground;
     parent::__construct($app);
     kernel::single('base_session')->start();
     $auth = pam_auth::instance(pam_account::get_account_type('desktop'));
     $account = $auth->account();
     if (get_class($this) != 'desktop_ctl_passport' && !$account->is_valid()) {
         $url = $this->app->router()->gen_url(array(), 1);
         $url = base64_encode($url);
         echo "<script>top.location='index.php?ctl=passport&url=" . $url . "'</script>";
         exit;
     }
     $this->user = kernel::single('desktop_user');
     if ($_GET['ctl'] != "passport" && $_GET['ctl'] != "") {
         $this->status = $this->user->get_status();
         if (!$this->status && $this->status == 0) {
             #echo "未启用";exit;
             //echo "<script>alert('管理员未启用')</script>";
             echo "<script>window.location='index.php?ctl=passport&act=logout'</script>";
             exit;
         }
     }
     ###如果不是超级管理员就查询操作权限
     if (!$this->user->is_super()) {
         if (!$this->user->chkground($this->workground)) {
             echo "您无权操作";
             exit;
         }
     }
     $this->_finish_modifier = array();
     foreach (kernel::servicelist(sprintf('desktop_controller_content.%s.%s.%s', $_GET['app'], $_GET['ctl'], $_GET['act'])) as $class_name => $service) {
         if ($service instanceof desktop_interface_controller_content) {
             if (method_exists($service, 'modify')) {
                 $this->_finish_modifier[$class_name] = $service;
             }
             if (method_exists($service, 'boot')) {
                 $service->boot($this);
             }
         }
     }
     if ($this->_finish_modifier) {
         ob_start();
         register_shutdown_function(array(&$this, 'finish_modifier'));
     }
     $this->url = 'index.php?app=' . $this->app->app_id . '&ctl=' . $_GET['ctl'];
 }
Beispiel #16
0
 function callback()
 {
     app::get('openid')->setConf('trust_token', $_GET['token']);
     $callback = kernel::single('pam_callback');
     $params['module'] = 'openid_passport_trust';
     $params['type'] = pam_account::get_account_type('b2c');
     $back_url = $this->gen_url(array('app' => 'openid', 'ctl' => 'site_trust', 'act' => 'post_login', 'full' => 1));
     $params['redirect'] = base64_encode($back_url);
     $callback->login($params);
     if ($result_m['redirect_url']) {
         echo "script>window.location=decodeURIComponent('" . $result_m['redirect_url'] . "');</script>";
         exit;
     } else {
         echo "<script>top.window.location='" . $back_url . "'</script>";
         exit;
     }
 }
Beispiel #17
0
 function addnew()
 {
     $roles = $this->app->model('roles');
     $users = $this->app->model('users');
     if ($_POST) {
         $this->begin('index.php?app=desktop&ctl=users&act=index');
         if ($users->validate($_POST, $msg)) {
             if ($_POST['super'] == 0 && !$_POST['role']) {
                 $this->end(false, __('请至少选择一个工作组'));
                 /*
                         foreach($workgroup as $roles)
                         $_POST['roles'][]=array('role_id'=>$roles['role_id']);
                         }
                         elseif($_POST['role']){
                         foreach($_POST['role'] as $roles)
                         $_POST['roles'][]=array('role_id'=>$roles);
                         
                         }*/
                 //else{
             } elseif ($_POST['super'] == 0 && $_POST['role']) {
                 foreach ($_POST['role'] as $roles) {
                     $_POST['roles'][] = array('role_id' => $roles);
                 }
             }
             $_POST['pam_account']['login_password'] = md5($_POST['pam_account']['login_password']);
             $_POST['pam_account']['account_type'] = pam_account::get_account_type($this->app->app_id);
             if ($users->save($_POST)) {
                 if ($_POST['super'] == 0) {
                     //是超管就不保存
                     $this->save_ground($_POST);
                 }
                 $this->end(true, __('保存成功'));
             } else {
                 $this->end(false, __('保存失败'));
             }
         } else {
             $this->end(false, __($msg));
         }
     } else {
         $workgroup = $roles->getList('*');
         $this->pagedata['workgroup'] = $workgroup;
         $this->display('users/users_add.html');
     }
 }
Beispiel #18
0
 public function __construct($app)
 {
     header('Cache-Control:no-store, no-cache, must-revalidate');
     // HTTP/1.1
     header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
     // 强制查询etag
     header('Progma: no-cache');
     if (app::get('base')->getConf('shell_base_url') != vmc::base_url(1)) {
         app::get('base')->setConf('shell_base_url', vmc::base_url(1));
     }
     $this->fix_location();
     $this->defaultwg = $this->defaultWorkground;
     parent::__construct($app);
     vmc::singleton('base_session')->start();
     if ($_COOKIE['autologin'] > 0) {
         vmc::singleton('base_session')->set_sess_expires($_COOKIE['autologin']);
     }
     //如果有自动登录,设置session过期时间,单位:分
     $auth = pam_auth::instance(pam_account::get_account_type('desktop'));
     $account = $auth->account();
     if (get_class($this) != 'desktop_ctl_passport' && !$account->is_valid()) {
         if (get_class($this) != 'desktop_ctl_default') {
             $url = app::get('desktop')->router()->gen_url($_GET, 1);
         } else {
             $url = app::get('desktop')->router()->gen_url(array(), 1);
         }
         $url = base64_encode($url);
         $_SESSION['passport_redirect_url'] = $url;
         echo "<script>top.location = '?ctl=passport'</script>";
         exit;
     }
     $this->user = vmc::singleton('desktop_user');
     if ($_GET['ctl'] != 'passport' && $_GET['ctl'] != '') {
         $this->status = $this->user->get_status();
         if (!$this->status && $this->status == 0) {
             unset($_SESSION['account']);
             $url = app::get('desktop')->router()->gen_url(array(), 1);
             $url = base64_encode($url);
             $_SESSION['passport_redirect_url'] = $url;
             header('Content-Type:text/html; charset=utf-8');
             $this->pagedata['link_url'] = '?ctl=passport';
             echo $this->fetch('auth_error.html');
             exit;
         }
     }
     ###如果不是超级管理员就查询操作权限
     if (!$this->user->is_super()) {
         if (!$this->user->chkground()) {
             echo $this->fetch('auth_error.html');
             exit;
         }
     }
     $this->_finish_modifier = array();
     foreach (vmc::servicelist(sprintf('desktop_controller_content.%s.%s.%s', $_GET['app'], $_GET['ctl'], $_GET['act'])) as $class_name => $service) {
         if ($service instanceof desktop_interface_controller_content) {
             if (method_exists($service, 'modify')) {
                 $this->_finish_modifier[$class_name] = $service;
             }
             if (method_exists($service, 'boot')) {
                 $service->boot($this);
             }
         }
     }
     //修改tab detail 里的内容
     foreach (vmc::servicelist(sprintf('desktop_controller_content_finderdetail.%s.%s.%s.%s', $_GET['app'], $_GET['ctl'], $_GET['act'], (string) (isset($_GET['finderview']) ? $_GET['finderview'] : '0'))) as $class_name => $service) {
         if ($service instanceof desktop_interface_controller_content) {
             if (method_exists($service, 'modify')) {
                 $this->_finish_modifier[$class_name] = $service;
             }
             if (method_exists($service, 'boot')) {
                 $service->boot($this);
             }
         }
     }
     if ($this->_finish_modifier) {
         ob_start();
         register_shutdown_function(array(&$this, 'finish_modifier'));
     }
     $this->url = 'index.php?app=' . $this->app->app_id . '&ctl=' . $_GET['ctl'];
     foreach (vmc::servicelist('desktop_controller_destruct') as $service) {
         if (is_object($service) && method_exists($service, 'construct')) {
             $service->construct();
         }
     }
 }
Beispiel #19
0
 /**
  * 得到当前登陆用户的信息
  * @param null
  * @return array 用户信息
  */
 public function get_current_member()
 {
     if (!$this->app->member_id) {
         kernel::single('base_session')->start();
         $this->app->member_id = $_SESSION['account'][pam_account::get_account_type($this->app->app_id)];
     }
     if ($this->member_info) {
         return $this->member_info;
     }
     #获取会员基本信息 jiaolei
     return $this->get_member_info($this->app->member_id);
 }
Beispiel #20
0
 function listener_login($params)
 {
     $this->check($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'] === pam_account::get_account_type('desktop')) {
         $result = $this->check_certid();
         if ($result['res'] == 'succ') {
             if ($result['info']['valid']) {
                 app::get('desktop')->setConf('activation_code_check', true);
                 if (!app::get('base')->getConf('certificate_code_url')) {
                     app::get('base')->setConf('certificate_code_url', kernel::base_url(1));
                 }
                 return;
             } else {
                 $this->app->setConf('activation_code', '');
             }
         } else {
             $url = $this->app->base_url(1);
             $code_url = $url . 'index.php?app=desktop&ctl=code&act=error_info_view&result[msg]=' . $result['msg'];
             echo "<script>location.href='" . $code_url . "'</script>";
             exit;
         }
     }
 }
Beispiel #21
0
 public function post_update()
 {
     vmc::singleton('base_initial', 'mobile')->init();
     pam_account::register_account_type('mobile', 'member', '前台会员系统');
 }
Beispiel #22
0
 function is_exists($uname)
 {
     $account_type = pam_account::get_account_type($this->app->app_id);
     $obj_pam_account = new pam_account($account_type);
     return $obj_pam_account->is_exists($uname);
 }
Beispiel #23
0
 /**
  * 得到当前登陆用户的信息
  * @param null
  * @return array 用户信息
  */
 public function get_current_member()
 {
     if (!$this->app->member_id) {
         # 解决在命令行执行时, 因为没有session会报诡异问题的bug
         if (substr(PHP_SAPI_NAME(), 0, 3) !== 'cli') {
             kernel::single('base_session')->start();
             $this->app->member_id = $_SESSION['account'][pam_account::get_account_type($this->app->app_id)];
         }
     }
     if ($this->member_info) {
         return $this->member_info;
     }
     #获取会员基本信息 jiaolei
     return $this->get_member_info($this->app->member_id);
 }
Beispiel #24
0
 function chkpassword()
 {
     $this->begin('index.php?app=desktop&ctl=users&act=index');
     $users = $this->app->model('users');
     if ($_POST) {
         $sdf = $users->dump($_POST['user_id'], '*', array(':account@pam' => array('*'), 'roles' => array('*')));
         $old_password = $sdf['account']['login_password'];
         $super_row = $users->getList('user_id', array('super' => '1'));
         $filter['account_id'] = $super_row[0]['user_id'];
         $filter['account_type'] = pam_account::get_account_type($this->app->app_id);
         $super_data = $users->dump($filter['account_id'], '*', array(':account@pam' => array('*')));
         $use_pass_data['login_name'] = $super_data['account']['login_name'];
         $use_pass_data['createtime'] = $super_data['account']['createtime'];
         $filter['login_password'] = pam_encrypt::get_encrypted_password(trim($_POST['old_login_password']), pam_account::get_account_type($this->app->app_id), $use_pass_data);
         $pass_row = app::get('pam')->model('account')->getList('account_id', $filter);
         if (!$pass_row) {
             $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'];
             $use_pass_data['login_name'] = $sdf['account']['login_name'];
             $use_pass_data['createtime'] = $sdf['account']['createtime'];
             $_POST['pam_account']['login_password'] = pam_encrypt::get_encrypted_password(trim($_POST['new_login_password']), pam_account::get_account_type($this->app->app_id), $use_pass_data);
             $users->save($_POST);
             $this->end(true, app::get('desktop')->_('密码修改成功'));
         }
     }
     $this->pagedata['user_id'] = $_GET['id'];
     $this->page('users/chkpass.html');
 }
Beispiel #25
0
 protected function check_login()
 {
     vmc::singleton('base_session')->start();
     if ($_SESSION['account'][pam_account::get_account_type($this->app->app_id)]) {
         return true;
     } else {
         return false;
     }
 }
Beispiel #26
0
 function chkpassword()
 {
     $account_id = $this->user->get_id();
     $users = $this->app->model('users');
     $sdf = $users->dump($account_id, '*', array(':account@pam' => array('*'), 'roles' => array('*')));
     $old_password = $sdf['account']['login_password'];
     $filter['account_id'] = $account_id;
     $filter['account_type'] = pam_account::get_account_type($this->app->app_id);
     $use_pass_data['login_name'] = $sdf['account']['login_name'];
     $use_pass_data['createtime'] = $sdf['account']['createtime'];
     $filter['login_password'] = pam_encrypt::get_encrypted_password(trim($_POST['old_login_password']), pam_account::get_account_type($this->app->app_id), $use_pass_data);
     $pass_row = app::get('pam')->model('account')->getList('account_id', $filter);
     if ($_POST) {
         $this->begin();
         if (!$pass_row) {
             $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 ($_POST['new_login_password'] != $_POST[':account@pam']['login_password']) {
             $this->end(false, app::get('desktop')->_('两次密码不一致'));
         } elseif ($sdf['account']['login_name'] == $_POST['new_login_password']) {
             $this->end(false, app::get('desktop')->_('用户名与密码不能相同'));
         } else {
             $_POST['pam_account']['account_id'] = $account_id;
             $_POST['pam_account']['login_password'] = pam_encrypt::get_encrypted_password(trim($_POST['new_login_password']), pam_account::get_account_type($this->app->app_id), $use_pass_data);
             $users->save($_POST);
             $this->end(true, app::get('desktop')->_('密码修改成功'));
         }
     }
     $ui = new base_component_ui($this);
     $arrGroup = array(array('title' => app::get('desktop')->_('原始密码'), 'type' => 'password', 'name' => 'old_login_password', 'required' => true), array('title' => app::get('desktop')->_('新密码'), 'type' => 'password', 'name' => 'new_login_password', 'required' => true), array('title' => app::get('desktop')->_('再次输入新密码'), 'type' => 'password', 'name' => ':account@pam[login_password]', 'required' => true));
     $html .= $ui->form_start(array('method' => 'POST'));
     foreach ($arrGroup as $arrVal) {
         $html .= $ui->form_input($arrVal);
     }
     $html .= $ui->form_end();
     echo $html;
     //return $html;
 }
Beispiel #27
0
 /**
  * 修改密码
  * @access public
  */
 public function user_password_edit()
 {
     if ($_POST) {
         $mdlUser = $this->app->model('users');
         $url = $this->gen_url(array('app' => 'cps', 'ctl' => 'site_welcome', 'act' => 'user_password_edit'));
         //修正密码判断走model定义的通用方法
         if (!$mdlUser->validate_password($_POST, $msg)) {
             $this->splash('failed', $url, $msg);
         }
         $mdlAcc = app::get('pam')->model('account');
         $rows = $mdlAcc->getList('account_id', array('account_id' => $this->app->cpsUserId, 'login_password' => pam_encrypt::get_encrypted_password($_POST['old_passwd'], pam_account::get_account_type($this->app->app_id))));
         if ($rows[0]) {
             if ($mdlAcc->update(array('login_password' => pam_encrypt::get_encrypted_password($_POST['password'], pam_account::get_account_type($this->app->app_id))), array('account_id' => $this->app->cpsUserId))) {
                 $this->splash('success', $url, '修改成功');
             } else {
                 $this->splash('failed', $url, '修改失败');
             }
         } else {
             $this->splash('failed', $url, '旧密码输入不正确');
         }
     } else {
         $this->set_tmpl('cps_common');
         $this->page('site/user/user_password.html');
     }
 }
Beispiel #28
0
 function unset_member()
 {
     $auth = pam_auth::instance(pam_account::get_account_type($this->app->app_id));
     foreach (kernel::servicelist('passport') as $k => $passport) {
         $passport->loginout($auth);
     }
     $this->app->member_id = 0;
     $this->cookie_path = kernel::base_url() . '/';
     $this->set_cookie('MEMBER', null, time() - 3600);
     $this->set_cookie('UNAME', '', time() - 3600);
     $this->set_cookie('MLV', '', time() - 3600);
     $this->set_cookie('CUR', '', time() - 3600);
     $this->set_cookie('LANG', '', time() - 3600);
     $this->set_cookie('S[MEMBER]', '', time() - 3600);
     foreach (kernel::servicelist('member_logout') as $service) {
         $service->logout();
     }
 }
Beispiel #29
0
 function get_current_member_lv()
 {
     vmc::singleton('base_session')->start();
     if ($member_id = $_SESSION['account'][pam_account::get_account_type($this->app->app_id)]) {
         $member_lv_row = app::get("pam")->model("account")->db->selectrow("select member_lv_id from vmc_b2c_members where member_id=" . intval($member_id));
         return $member_lv_row ? $member_lv_row['member_lv_id'] : -1;
     } else {
         return -1;
     }
 }
Beispiel #30
0
 public function unset_seller()
 {
     $auth = pam_auth::instance(pam_account::get_account_type('seller'));
     foreach (vmc::servicelist('passport') as $k => $passport) {
         $passport->loginout($auth);
     }
     $this->app->seller_id = 0;
     vmc::singleton('base_session')->set_cookie_expires(0);
     $this->cookie_path = vmc::base_url() . '/';
     $this->set_cookie('UNAME', '', time() - 3600);
     //用户名
     $this->set_cookie('SELLER_IDENT', 0, time() - 3600);
     //会员ID
     foreach (vmc::servicelist('seller.logout_after') as $service) {
         $service->logout();
     }
 }