public function seller_login($userData, $vcode = false, &$msg) { $userData = utils::_filter_input($userData); //过滤xss攻击 if (!$vcode || !base_vcode::verify('passport', $vcode)) { $msg = '验证码错误'; return false; } //如果指定了登录类型,则不再进行获取(邮箱登录,手机号登录,用户名登录) if (!$userData['login_type']) { $userPassport = vmc::singleton('seller_user_passport'); $userData['login_type'] = $userPassport->get_login_account_type($userData['login_name']); } $filter = array('login_type' => $userData['login_type'], 'login_name' => $userData['login_name']); $account = app::get('seller')->model('sellers')->getList('member_id, login_name, createtime', $filter); if (!$account) { $msg = '不存在的用户'; return false; } $login_password = pam_encrypt::get_encrypted_password($userData['login_password'], 'member', array('createtime' => $account[0]['createtime'], 'login_name' => $account[0]['login_name'])); if ($account[0]['login_password'] != $login_password) { $msg = '登录密码错误'; return false; } return $account[0]['member_id']; }
public function login($userData, $vcode = false, &$msg) { $userData = utils::_filter_input($userData); //过滤xss攻击 if ($vcode && !$this->vcode_verify($vcode)) { $msg = app::get('pam')->_('验证码错误'); return false; } //如果指定了登录类型,则不再进行获取(邮箱登录,手机号登录,用户名登录) if (!$userData['login_type']) { $userPassport = kernel::single('b2c_user_passport'); $userData['login_type'] = $userPassport->get_login_account_type($userData['login_account']); } $filter = array('login_type' => $userData['login_type'], 'login_account' => $userData['login_account']); $account = app::get('pam')->model('members')->getList('member_id,password_account,login_password,createtime', $filter); if (!$account) { $msg = app::get('pam')->_('用户名或密码错误'); return false; } $login_password = pam_encrypt::get_encrypted_password($userData['login_password'], 'member', array('createtime' => $account[0]['createtime'], 'login_name' => $account[0]['password_account'])); if ($account[0]['login_password'] != $login_password) { $msg = app::get('pam')->_('用户名或密码错误'); return false; } return $account[0]['member_id']; }
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; }
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 ? '保存成功' : '保存失败'); }
public function login($userData, $vcode = false, &$msg, $type = 'b2c') { $userData = utils::_filter_input($userData); //过滤xss攻击 //快速登录不用验证码 if ($vcode != 'quick') { if (!$vcode || !base_vcode::verify('passport', $vcode)) { $msg = '验证码错误'; return false; } } //如果指定了登录类型,则不再进行获取(邮箱登录,手机号登录,用户名登录) if (!$userData['login_type']) { $userPassport = vmc::singleton('b2c_user_passport'); $userData['login_type'] = $userPassport->get_login_account_type($userData['login_account']); } $filter = array('login_type' => $userData['login_type'], 'login_account' => $userData['login_account']); $model = 'members'; $id = 'member_id'; if ($type == 'sellers') { $model = 'sellers'; $id = 'seller_id'; } $account = app::get('pam')->model($model)->getList($id . ',password_account,login_password,createtime', $filter); if (!$account) { $msg = '不存在的用户'; return false; } $login_password = pam_encrypt::get_encrypted_password($userData['login_password'], 'member', array('createtime' => $account[0]['createtime'], 'login_name' => $account[0]['password_account'])); if ($account[0]['login_password'] != $login_password) { $msg = '登录密码错误'; return false; } return $account[0][$id]; }
function shopex_shop_login() { $params = $this->params; //必填应用级参数是否定义 if (!isset($params['user_name']) || !isset($params['password'])) { $error['code'] = null; $error['msg'] = '应用级必填参数未填写'; $this->send_error($error); } //系统级必填参数是否定义 if (!isset($params['api_version']) || !isset($params['ac'])) { $error['code'] = null; $error['msg'] = '系统必填参数未填写'; $this->send_error($error); } elseif ($params['api_version'] != $this->api_version) { //api版本是否一致 $this->send_error('0x011'); } //检查签名是否有效 $sign = $this->get_sign($params, $this->token); if ($sign != $params['ac']) { $error['code'] = null; $error['msg'] = '签名无效'; $this->send_error($error); } $password_string = pam_encrypt::get_encrypted_password($params['password'], 'shopadmin', array('login_name' => $params['user_name'])); $rows = app::get('pam')->model('account')->getList('*', array('login_name' => $params['user_name'], 'login_password' => $password_string, 'account_type' => 'shopadmin', 'disabled' => 'false'), 0, 1); if ($rows[0]) { //判断用户是否启用 $user_data = app::get('desktop')->model('users')->dump(array('user_id' => $rows[0]['account_id'], 'status' => '1'), '*', array(':account@pam' => array('*'))); if ($user_data) { app::get('goodsapi')->setConf('shangpintong_login_id', $rows[0]['account_id']); if (isset($params['is_admin'])) { app::get('goodsapi')->setConf('is_admin', $params['is_admin']); } $session = md5(time() . $rows); //app::get('goodsapi')->setConf('shangpintong_login_session'.$rows[0]['account_id'],$session); $filter = array('prefix' => 'goodsapi', 'key' => 'shangpintong_login_session' . $rows[0]['account_id'], 'value' => $session); $obj_session = kernel::single('base_session'); $obj_session->set_sess_id(md5($session)); $obj_session->set_sess_expires(0); //永久保存 $obj_session->start(); $_SESSION['account']['shopadmin'] = '1'; $_SESSION['account']['user_data'] = $user_data; if (app::get('base')->model('kvstore')->save($filter)) { $data['session'] = $session; $image_size = IMAGE_MAX_SIZE / 1024; //单位为KB $data['image_size'] = $image_size ? $image_size : 2048; $this->send_success($data); } } else { $this->send_error(array('msg' => '管理员账号未启用')); } } else { $this->send_error(array('code' => '0x001')); } }
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(); }
public function post_install($options) { logger::info('Create shopadmin account'); //设置用户体系,前后台互不相干 pam_account::register_account_type('desktop', 'shopadmin', '后台管理系统'); //todo: 封装成更简单的函数 $use_pass_data['login_name'] = $options['admin_uname']; $use_pass_data['createtime'] = time(); $password = pam_encrypt::get_encrypted_password($options['admin_password'], pam_account::get_account_type('desktop'), $use_pass_data); $account = array('pam_account' => array('login_name' => $options['admin_uname'], 'login_password' => $password, 'account_type' => 'shopadmin', 'createtime' => $use_pass_data['createtime']), 'name' => $options['admin_uname'], 'super' => 1, 'status' => 1); app::get('desktop')->model('users')->save($account); }
function editUser(&$data) { if ($data['userpass']) { //$data[':account@pam']['login_password'] = md5(trim($data['userpass'])); $data[':account@pam']['login_password'] = pam_encrypt::get_encrypted_password(trim($data['userpass']), pam_account::get_account_type($this->app->app_id)); } /* else{ $data[':account@pam']['login_password'] = trim($data['oldpass']); } */ $data['pam_account']['account_type'] = pam_account::get_account_type($this->app->app_id); $data['pam_account']['createtime'] = time(); return parent::save($data); }
public function login($userData, $vcode = false, &$msg, $post_date = '') { $userData = utils::_filter_input($userData); //过滤xss攻击 if ($vcode && !$this->vcode_verify($vcode)) { $msg = app::get('pam')->_('验证码错误'); return false; } //如果指定了登录类型,则不再进行获取(邮箱登录,手机号登录,用户名登录) if (!$userData['login_type']) { $userPassport = kernel::single('b2c_user_passport'); $userData['login_type'] = $userPassport->get_login_account_type($userData['login_account']); } $filter = array('login_type' => $userData['login_type'], 'login_account' => $userData['login_account']); $account = app::get('pam')->model('members')->getList('member_id,password_account,login_password,createtime', $filter); if (!$account) { $msg = app::get('pam')->_('用户名或密码错误'); return false; } $login_password = pam_encrypt::get_encrypted_password($userData['login_password'], 'member', array('createtime' => $account[0]['createtime'], 'login_name' => $account[0]['password_account'])); if ($account[0]['login_password'] != $login_password) { $msg = app::get('pam')->_('用户名或密码错误'); return false; } if (isset($post_date['store']) && $post_date['store'] > 0) { $obj_local_store = app::get('b2c')->model('local_store'); $local_store_list = $obj_local_store->getList('*', array('local_id' => intval($post_date['store'])), 0, 1); //$local_store = $obj_local_store->dump(); $local_store = $local_store_list[0]; if ($local_store) { $_SESSION['local_store'] = $local_store; } $obj_member_addrs = app::get('b2c')->model('member_addrs'); $member_addrs = $obj_member_addrs->getList('*', array('member_id' => $account[0]['member_id'], 'local_id' => $local_store['local_id']), 0, 1); $in_addr_data = $local_store; $in_addr_data['member_id'] = $account[0]['member_id']; unset($in_addr_data['local_name']); if ($member_addrs[0]) { $in_addr_data['addr_id'] = $member_addrs[0]['addr_id']; } //print_r($in_addr_data);exit; kernel::single('b2c_member_addrs')->purchase_save_addr($in_addr_data, $in_addr_data['member_id'], $msg); } return $account[0]['member_id']; }
function toadd() { $this->begin(); $obj_member = app::get('b2c')->model('members'); $regtime = $obj_member->getList('regtime', array('member_id' => $_POST['member_id'])); $use_pass_data['login_name'] = $_POST['login_name']; $use_pass_data['createtime'] = $regtime[0]['regtime']; $login_password = pam_encrypt::get_encrypted_password(trim($_POST['login_password']), 'member', $use_pass_data); $over_password = pam_encrypt::get_encrypted_password(trim($_POST['over_password']), 'member', $use_pass_data); $staff_data = array('member_id' => $_POST['member_id'], 'login_name' => $_POST['login_name'], 'staff_name' => $_POST['staff_name'], 'login_password' => $login_password, 'over_password' => $over_password, 'branch_id' => $_POST['branch_id'], 'ctime' => $use_pass_data['createtime'], 'disabled' => $_POST['disabled']); if ($_POST['staff_id']) { if ($this->app->model('local_staff')->update($staff_data, array('staff_id' => $_POST['staff_id']))) { $this->end(true, app::get('b2c')->_('保存成功')); } } else { $data = $this->app->model('local_staff')->getList('*', array('login_name' => $_POST['login_name'])); if ($data) { $this->end(false, app::get('b2c')->_('用户名已存在')); } if ($this->app->model('local_staff')->insert($staff_data)) { $this->end(true, app::get('b2c')->_('添加成功')); } } }
function sendPSW() { $this->begin($this->gen_url(array('app' => 'b2c', 'ctl' => 'site_passport', 'act' => 'index'))); $rows = app::get('pam')->model('account')->getList('*', array('account_type' => 'member', 'login_name' => $_POST['uname'])); $member_id = $rows[0]['account_id']; $obj_member =& $this->app->model('members'); $data = $obj_member->dump($member_id); if ($data['account']['pw_answer'] != $_POST['pw_answer'] || $data['contact']['email'] != $_POST['email']) { $this->end(false, app::get('b2c')->_('问题回答错误或当前账户的邮箱填写错误'), $this->gen_url(array('app' => 'b2c', 'ctl' => 'site_passport', 'act' => 'index')), '', true); } if ($data['pam_account']['account_id'] < 1) { $this->end(false, app::get('b2c')->_('会员信息错误'), $this->gen_url(array('app' => 'b2c', 'ctl' => 'site_passport', 'act' => 'index')), '', true); } $objRepass = $this->app->model('member_pwdlog'); $secret = $objRepass->generate($data['pam_account']['account_id']); $url = $this->gen_url(array('app' => 'b2c', 'ctl' => 'site_passport', 'act' => 'index')); $sdf = app::get('pam')->model('account')->dump($member_id); $new_password = $this->randomkeys(6); $use_pass_data['login_name'] = $rows[0]['login_name']; $use_pass_data['createtime'] = $rows[0]['createtime']; $sdf['login_password'] = pam_encrypt::get_encrypted_password(trim($new_password), pam_account::get_account_type($this->app->app_id), $use_pass_data); if (app::get('pam')->model('account')->save($sdf)) { if ($this->send_email($_POST['uname'], $data['contact']['email'], $new_password, $member_id)) { $this->end(true, app::get('b2c')->_('密码变更邮件已经发送到') . $data['contact']['email'] . app::get('b2c')->_(',请注意查收'), $url, '', true); } else { $this->end(false, app::get('b2c')->_('发送失败,请与商家联系'), $url, '', true); } } else { $this->end(false, app::get('b2c')->_('发送失败,请与商家联系'), $url, '', true); } }
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'); }
public function create_paydetail() { if (!$_POST['staff']) { $this->splash('failed', $this->gen_url(array('app' => 'b2c', 'ctl' => 'site_storepassport', 'act' => 'payDetail')), app::get('b2c')->_('对不起,没有交接的员工!'), true); } $arr_obj = explode('--', $_POST['staff']); $_POST['jieban_id'] = $arr_obj[0]; $_POST['jieban_name'] = $arr_obj[1]; unset($_POST['staff']); $dailycash = app::get('ome')->model('charge'); $_POST['end_time'] = time(); if ($_POST) { /*需要存储的数据*/ $save_data = array('charge_num' => trim($_POST['charge_num']), 'jiaoban_id' => $_POST['jiaoban_id'], 'jiaoban_name' => trim($_POST['jiaoban_name']), 'jieban_id' => $_POST['jieban_id'], 'jieban_name' => trim($_POST['jieban_name']), 'start_time' => trim($_POST['start_time']), 'end_time' => $_POST['end_time'], 'cash' => trim($_POST['cash']), 'webpos' => trim($_POST['webpos']), 'deposit' => trim($_POST['deposit']), 'coupon' => trim($_POST['coupon']), 'amount' => trim($_POST['amount']), 'order_nums' => trim($_POST['order_nums'])); $jieban_id = $_POST['jieban_id']; $account = app::get('b2c')->model('local_staff')->getList('*', array('staff_id' => $jieban_id)); $use_pass_data['login_name'] = $account[0]['login_name']; $use_pass_data['createtime'] = $account[0]['ctime']; $over_password = pam_encrypt::get_encrypted_password(trim($_POST['password']), 'member', $use_pass_data); if ($over_password !== $account[0]['over_password']) { echo json_encode(array('ret' => app::get('b2c')->_('交接员工密码错误,请重试!'))); return; } //print_r($save_data);exit; if ($dailycash->insert($save_data)) { echo json_encode(array('ret' => app::get('b2c')->_('交接班成功!'))); return; } else { echo json_encode(array('ret' => app::get('b2c')->_('交接班失败!'))); return; } } }
function save_weixin_card($card, $card_password, $new_account_password, $type) { $this->userPassport = kernel::single('b2c_user_passport'); $userPassport = kernel::single('b2c_user_passport'); $login_member_id = intval($this->app->member_id); if (!$card || !is_numeric($card)) { $msg = app::get('b2c')->_('请填写正确的会员卡号'); $this->splash('failed', null, $msg, '', '', true); } $member_card = $this->app->model('member_card')->getList('*', array('card_number' => $card)); if (!$member_card) { //先从会员卡表中直接读取卡号,判断卡号是否存在 $msg = app::get('b2c')->_('会员卡不存在'); $this->splash('failed', null, $msg, '', '', true); } else { //会员卡号存在 $member_id = app::get('pam')->model('members')->getList('member_id', array('login_account' => $card)); if ($member_id[0]['member_id']) { //卡号存在且卡已被激活,要检查该会员卡是否被绑定,还要检查是否改了密码,验证密码的一致性 $new_card = ''; $pamMemberData = app::get('pam')->model('members')->getList('*', array('member_id' => $member_id[0]['member_id'])); if (count($pamMemberData) > 1) { //被激活后判断是否被绑定 foreach ($pamMemberData as $pmd) { if ($pmd['login_type'] == 'local' && strlen($pmd['login_account']) > 25) { $msg = app::get('b2c')->_('该会员卡已被绑定过!'); $this->splash('failed', null, $msg, '', '', true); } } } $use_pass_data['login_name'] = $card; $use_pass_data['createtime'] = $pamMemberData[0]['createtime']; $login_password = pam_encrypt::get_encrypted_password($card_password, 'member', $use_pass_data); if ($login_password != $pamMemberData[0]['login_password']) { //会员卡被激活之后,可能被改密码,要进行密码验证 $msg = app::get('b2c')->_('会员卡密码错误'); $this->splash('failed', null, $msg, '', '', true); } } else { //卡号存在且未被激活 $new_card = '1'; $card_psw_isright = $this->app->model('member_card')->getList('*', array('card_number' => $card, 'card_password' => $card_password)); if (!$card_psw_isright) { //直接对比会员卡表中的密码是否一致即可 $msg = app::get('b2c')->_('会员卡密码错误'); $this->splash('failed', null, $msg, '', '', true); } } } $status = $this->userPassport->_bind_member_card($new_card, $type, $login_member_id, $card, $new_account_password); switch ($status) { case 'update_log_failed': $msg = app::get('b2c')->_('绑定日志更新失败'); $this->splash('failed', null, $msg, '', '', true); break; case 'wrong_email': $msg = app::get('b2c')->_('邮箱格式错误'); $this->splash('failed', null, $msg, '', '', true); break; case 'wrong_mobile': $msg = app::get('b2c')->_('手机格式错误'); $this->splash('failed', null, $msg, '', '', true); break; case 'update_coupon_failed': $msg = app::get('b2c')->_('更新优惠券错误'); $this->splash('failed', null, $msg, '', '', true); break; case 'update_passwd_failed': $msg = app::get('b2c')->_('更新密码错误'); $this->splash('failed', null, $msg, '', '', true); break; case 'old_member_wrong': $msg = app::get('b2c')->_('当前会员信息错误'); $this->splash('failed', null, $msg, '', '', true); break; case 'insert_membercard_wrong': $msg = app::get('b2c')->_('会员卡注入错误'); $this->splash('failed', null, $msg, '', '', true); case 'add_advance_wrong': $msg = app::get('b2c')->_('增加预存款失败'); $this->splash('failed', null, $msg, '', '', true); break; case 'reduce_advance_wrong': $msg = app::get('b2c')->_('减少预存款失败'); $this->splash('failed', null, $msg, '', '', true); break; case 'add_point_wrong': $msg = app::get('b2c')->_('增加积分失败'); $this->splash('failed', null, $msg, '', '', true); break; case 'reduce_point_wrong': $msg = app::get('b2c')->_('减少积分失败'); $this->splash('failed', null, $msg, '', '', true); break; case 'delete_oldcard_failed': $msg = app::get('b2c')->_('删除绑定的旧会员卡失败'); $this->splash('failed', null, $msg, '', '', true); break; case 'update_level_failed': $msg = app::get('b2c')->_('等级更新失败'); $this->splash('failed', null, $msg, '', '', true); break; case 'update_newcard_failed': $msg = app::get('b2c')->_('更新新会员卡失败'); $this->splash('failed', null, $msg, '', '', true); break; case 'update_oldcard_failed': $msg = app::get('b2c')->_('更新旧会员卡失败'); $this->splash('failed', null, $msg, '', '', true); break; case 'update_oldmember_failed': $msg = app::get('b2c')->_('更新旧会员失败'); $this->splash('failed', null, $msg, '', '', true); break; case 'update_cardmember_failed': $msg = app::get('b2c')->_('更新会员卡会员失败'); $this->splash('failed', null, $msg, '', '', true); break; case 'update_old_cardmember_failed': $msg = app::get('b2c')->_('更新旧会员卡会员失败'); $this->splash('failed', null, $msg, '', '', true); break; case 'update_lo_failed': $msg = app::get('b2c')->_('更新日志失败'); $this->splash('failed', null, $msg, '', '', true); break; case 'ok': $msg = app::get('b2c')->_('绑定成功!'); $url = kernel::single('wap_controller')->gen_url(array('app' => 'b2c', 'ctl' => 'wap_passport', 'act' => 'logout')); $this->splash('success', $url, $msg, '', '', true); break; } }
public function reset_passport($seller_id, $password) { $pamsellersModel = app::get('pam')->model('sellers'); $pamData = $pamsellersModel->getList('login_account,password_account,createtime', array('seller_id' => $seller_id)); $db = vmc::database(); $db->beginTransaction(); foreach ($pamData as $row) { $use_pass_data['login_name'] = $row['password_account']; $use_pass_data['createtime'] = $row['createtime']; $login_password = pam_encrypt::get_encrypted_password(trim($password), 'seller', $use_pass_data); if (!$pamsellersModel->update(array('login_password' => $login_password), array('login_account' => $row['login_account']))) { $db->rollBack(); return false; } } $db->commit(); return true; }
public function verify_vcode() { $send_type = $_POST['send_type']; if (isset($_POST['password'])) { $pamMembersModel = app::get('pam')->model('members'); $pamData = $pamMembersModel->getList('login_password,password_account,createtime', array('member_id' => $this->app->member_id)); $use_pass_data['login_name'] = $pamData[0]['password_account']; $use_pass_data['createtime'] = $pamData[0]['createtime']; $login_password = pam_encrypt::get_encrypted_password(trim($_POST['password']), 'member', $use_pass_data); if ($login_password !== $pamData[0]['login_password']) { $msg = app::get('b2c')->_('登录密码错误'); $this->splash('failed', null, $msg, true); exit; } else { $_SESSION['vcodeVerifykey']['activation'] = 'true'; $url = $this->gen_url(array('app' => 'b2c', 'ctl' => 'site_member', 'act' => 'verify2', 'arg0' => $_POST['verifyType'])); $this->splash('success', $url); } } $userVcode = kernel::single('b2c_user_vcode'); if (!$userVcode->verify($_POST['vcode'][$send_type], $_POST[$send_type], 'activation')) { $msg = app::get('b2c')->_('验证码错误'); $this->splash('failed', null, $msg, true); exit; } $_SESSION['vcodeVerifykey']['activation'] = 'true'; $url = $this->gen_url(array('app' => 'b2c', 'ctl' => 'site_member', 'act' => 'verify2', 'arg0' => $_POST['verifyType'])); $this->splash('success', $url); }
/** * 修改密码 * @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'); } }
/** * 验证邮箱,正确发送用户密码 * @access public */ public function sendPSW() { $this->begin($this->gen_url(array('app' => 'cps', 'ctl' => 'site_user', 'act' => 'index'))); $rows = app::get('pam')->model('account')->getList('*', array('account_type' => 'cpsuser', 'login_name' => $_POST['uname'])); $userId = $rows[0]['account_id']; $mdlUser = $this->app->model('users'); $data = $mdlUser->dump($userId); if ($data['answer'] != $_POST['pw_answer'] || $data['contact']['email'] != $_POST['email']) { $this->end(false, $this->app->_('问题回答错误或当前账户的邮箱填写错误'), $this->gen_url(array('app' => 'cps', 'ctl' => 'site_user', 'act' => 'index'))); } $url = $this->gen_url(array('app' => 'cps', 'ctl' => 'site_user', 'act' => 'index')); $sdf = app::get('pam')->model('account')->dump($userId); $new_password = $this->randomkeys(6); $sdf['login_password'] = pam_encrypt::get_encrypted_password(trim($new_password), pam_account::get_account_type($this->app->app_id)); if ($this->send_email($_POST['uname'], $data['contact']['email'], $new_password, $userId)) { app::get('pam')->model('account')->save($sdf); $this->end(true, $this->app->_('密码变更邮件已经发送到') . $data['contact']['email'] . $this->app->_(',请注意查收'), $url); } else { $this->end(false, $this->app->_('发送失败,请与商家联系'), $url); } }
/** * 会员登陆校验 */ public function login_verity($request, $rpcService) { if (!$request['user_name'] || !$request['password']) { $rpcService->send_user_error('5001', app::get('b2c')->_('重要参数缺失')); } $password_string = pam_encrypt::get_encrypted_password($request['password'], 'member', array('login_name' => $request['user_name'])); if (!$request['user_name'] || !$password_string || $request['password'] !== '0' && !$request['password']) { $rpcService->send_user_error('5002', app::get('pam')->_('验证失败!')); } $rows = app::get('pam')->model('account')->getList('*', array('login_name' => $request['user_name'], 'login_password' => $password_string, 'account_type' => 'member', 'disabled' => 'false'), 0, 1); $rtn = array('status' => $rows[0] ? 'true' : 'false', 'member_id' => $rows[0]['account_id']); return $rtn; }
/** * add by Jason 绑定会员卡 */ public function verifymember_card() { $this->userPassport = kernel::single('b2c_user_passport'); $userPassport = kernel::single('b2c_user_passport'); $login_member_id = $userPassport->userObject->get_member_id(); $card = trim($_POST['card_number']); $card_password = trim($_POST['card_password']); $type = trim($_POST['type']); //绑定类型,card_to_member为卡转入会员,member_to_card为会员转入卡 if (!$type) { $msg = app::get('b2c')->_('请选择要绑定的类型'); $this->splash('failed', null, $msg, true); } if (!$card || !is_numeric($card)) { $msg = app::get('b2c')->_('请填写正确的会员卡号'); $this->splash('failed', null, $msg, true); } $member_card = $this->app->model('member_card')->getList('*', array('card_number' => $card)); if (!$member_card) { //先从会员卡表中直接读取卡号,判断卡号是否存在 $msg = app::get('b2c')->_('会员卡不存在'); $this->splash('failed', null, $msg, true); } else { //会员卡号存在 $member_id = app::get('pam')->model('members')->getList('member_id', array('login_account' => $card)); if ($member_id[0]['member_id']) { //卡号存在且卡已被激活,要检查该会员卡是否被绑定,还要检查是否改了密码,验证密码的一致性 $new_card = ''; $pamMemberData = app::get('pam')->model('members')->getList('*', array('member_id' => $member_id[0]['member_id'])); if (count($pamMemberData) > 1) { //被激活后判断是否被绑定 $msg = app::get('b2c')->_('该会员卡已被绑定'); $this->splash('failed', null, $msg, true); } $use_pass_data['login_name'] = $pamMemberData[0]['password_account']; $use_pass_data['createtime'] = $pamMemberData[0]['createtime']; $login_password = pam_encrypt::get_encrypted_password($card_password, 'member', $use_pass_data); if ($login_password != $pamMemberData[0]['login_password']) { //会员卡被激活之后,可能被改密码,要进行密码验证 $msg = app::get('b2c')->_('会员卡密码错误'); $this->splash('failed', null, $msg, true); } } else { //卡号存在且未被激活 $new_card = '1'; $card_psw_isright = $this->app->model('member_card')->getList('*', array('card_number' => $card, 'card_password' => $card_password)); if (!$card_psw_isright) { //直接对比会员卡表中的密码是否一致即可 $msg = app::get('b2c')->_('会员卡密码错误'); $this->splash('failed', null, $msg, true); } } } $status = $this->userPassport->_bind_member_card($new_card, $type, $login_member_id, $card); switch ($status) { case 'card_to_card': $msg = app::get('b2c')->_('会员卡不能绑定会员卡'); $this->splash('failed', null, $msg, true); break; case 'old_member_wrong': $msg = app::get('b2c')->_('当前会员信息错误错误'); $this->splash('failed', null, $msg, true); break; case 'insert_membercard_wrong': $msg = app::get('b2c')->_('会员卡注入错误'); $this->splash('failed', null, $msg, true); case 'add_advance_wrong': $msg = app::get('b2c')->_('增加预存款是失败'); $this->splash('failed', null, $msg, true); break; case 'reduce_advance_wrong': $msg = app::get('b2c')->_('减少预存款失败'); $this->splash('failed', null, $msg, true); break; case 'add_point_wrong': $msg = app::get('b2c')->_('增加积分失败'); $this->splash('failed', null, $msg, true); break; case 'reduce_point_wrong': $msg = app::get('b2c')->_('减少积分失败'); $this->splash('failed', null, $msg, true); break; case 'delete_oldcard_failed': $msg = app::get('b2c')->_('删除绑定的旧会员卡失败'); $this->splash('failed', null, $msg, true); break; case 'update_level_failed': $msg = app::get('b2c')->_('等级更新失败'); $this->splash('failed', null, $msg, true); break; case 'update_newcard_failed': $msg = app::get('b2c')->_('更新新会员卡失败'); $this->splash('failed', null, $msg, true); break; case 'update_oldcard_failed': $msg = app::get('b2c')->_('更新旧会员卡失败'); $this->splash('failed', null, $msg, true); break; case 'update_oldmember_failed': $msg = app::get('b2c')->_('更新旧会员失败'); $this->splash('failed', null, $msg, true); break; case 'update_cardmember_failed': $msg = app::get('b2c')->_('更新会员卡会员失败'); $this->splash('failed', null, $msg, true); break; case 'update_old_cardmember_failed': $msg = app::get('b2c')->_('更新旧会员卡会员失败'); $this->splash('failed', null, $msg, true); break; case 'update_lo_failed': $msg = app::get('b2c')->_('更新日志失败'); $this->splash('failed', null, $msg, true); break; case 'update_card_state_failed': $msg = app::get('b2c')->_('更新会员卡状态失败'); $this->splash('failed', null, $msg, true); break; case 'card_is_bind': $msg = app::get('b2c')->_('会员卡已被绑定'); $this->splash('failed', null, $msg, true); break; case 'ok': $msg = app::get('b2c')->_('绑定成功'); $passport_login = $this->gen_url(array('app' => 'b2c', 'ctl' => 'site_passport', 'act' => 'login')); $url = $this->gen_url(array('app' => 'b2c', 'ctl' => 'site_passport', 'act' => 'logout', 'arg0' => $passport_login)); $this->splash('success', $url, $msg, true); break; } }
function create($data) { $arrDefCurrency = app::get('ectools')->model('currency')->getDefault(); $data['currency'] = $arrDefCurrency['cur_code']; $data['pam_account']['account_type'] = pam_account::get_account_type($this->app->app_id); $data['pam_account']['createtime'] = time(); $data['reg_ip'] = base_request::get_remote_addr(); $data['regtime'] = time(); // 2012/10/04 by F0ur // 允许用户名大小写区分 // $data['pam_account']['login_name'] = strtolower($data['pam_account']['login_name']); $use_pass_data['login_name'] = $data['pam_account']['login_name']; $use_pass_data['createtime'] = $data['pam_account']['createtime']; $data['pam_account']['login_password'] = pam_encrypt::get_encrypted_password(trim($data['pam_account']['login_password']), pam_account::get_account_type($this->app->app_id), $use_pass_data); $this->save($data); return $data['member_id']; }
function bind_member($type, $from_to, $login_member_id, $account, $old_account_password, $new_account_password) { if ($type == 'emial') { if (!strstr($account, '@')) { return 'wrong_email'; } } if ($type == 'mobile') { $search = '/^1[34578]{1}[0-9]{9}$/'; if (!preg_match($search, $account)) { return 'wrong_mobile'; } } $this->userPassport = kernel::single('b2c_user_passport'); $objAdvances = $this->app->model("member_advance"); $member_point = $this->app->model('member_point'); $pamMemberMdl = app::get('pam')->model('members'); $userPassport = kernel::single('b2c_user_passport'); $pamMemberData = app::get('pam')->model('members')->getList('*', array('login_account' => $account)); $loginPamData = app::get('pam')->model('members')->getList('*', array('member_id' => $login_member_id)); $loginMemberData = app::get('b2c')->model('members')->getList('*', array('member_id' => $login_member_id)); $db = kernel::database(); $transaction_status = $db->beginTransaction(); if (!$pamMemberData) { if (!$userPassport->set_new_account($login_member_id, $account, $msg)) { $db->rollback(); return 'creat_new_account_failed'; } else { $userPassport->reset_passport($login_member_id, $new_account_password); if ($type == 'mobile') { //会员手机验证赠送积分 $reason_type = 'mobile_score'; $point = 300; $data_rand = rand(0, 10); $error_msg = '微信绑定手机赠送积分'; $member_id = $login_member_id; app::get('b2c')->model('member_point')->change_point($member_id, +$point, $error_msg, $reason_type, $data_rand, $member_id, $member_id); } $db->commit($transaction_status); return 'ok'; } } else { $member_id = $pamMemberData[0]['member_id']; $memberData = app::get('b2c')->model('members')->getList('*', array('member_id' => $pamMemberData[0]['member_id'])); $allPamMemberData = app::get('pam')->model('members')->getList('*', array('member_id' => $pamMemberData[0]['member_id'])); foreach ($allPamMemberData as $pmd) { if ($pmd['login_type'] == 'local' && strlen($pmd['login_account']) > 25) { return 'openid_rebind'; } } $use_pass_data['login_name'] = $pamMemberData[0]['password_account']; $use_pass_data['createtime'] = $pamMemberData[0]['createtime']; $login_password = pam_encrypt::get_encrypted_password($old_account_password, 'member', $use_pass_data); if ($login_password != $pamMemberData[0]['login_password']) { $db->rollback(); return 'wrong_password'; } $new_member_lv = $memberData[0]['member_lv_id'] > $loginMemberData[0]['member_lv_id'] ? $memberData[0]['member_lv_id'] : $loginMemberData[0]['member_lv_id']; //对比得出新等级ID //开始事务 if ($from_to == 'weixin_to_old') { $from_pam_member = $loginPamData; $from_b2c_member = $loginMemberData; $to_pam_member = $allPamMemberData; $to_b2c_member = $memberData; $to_member_id = $allPamMemberData[0]['member_id']; } else { $from_pam_member = $allPamMemberData; $from_b2c_member = $memberData; $to_pam_member = $loginPamData; $to_b2c_member = $loginMemberData; $to_member_id = $loginPamData[0]['member_id']; } /**是否有未完成订单的判断开始 **/ $order = $this->app->model('orders'); if ($order->getList('order_id', array('member_id' => $from_pam_member[0]['member_id'], 'pay_status' => 0, 'ship_status' => array(1, 2, 3)))) { $db->rollback(); return 'order_uncompleted'; } if ($order->getList('order_id', array('member_id' => $from_pam_member[0]['member_id'], 'pay_status' => 1, 'ship_status' => array(0, 2, 3)))) { $db->rollback(); return 'order_uncompleted'; } if ($order->getList('order_id', array('member_id' => $from_pam_member[0]['member_id'], 'pay_status' => 4, 'ship_status' => array(0, 1)))) { $db->rollback(); return 'order_uncompleted'; } if ($order->getList('order_id', array('member_id' => $from_pam_member[0]['member_id'], 'pay_status' => 5, 'ship_status' => array(0, 1)))) { $db->rollback(); return 'order_uncompleted'; } /**是否有未完成订单的判断结束 **/ if (!$this->userPassport->bind_log($from_pam_member, $to_pam_member)) { $db->rollback(); return 'update_log_failed'; } $update_level = app::get('b2c')->model('members')->update(array('member_lv_id' => $new_member_lv), array('member_id' => $to_pam_member[0]['member_id'])); if (!$update_level) { $db->rollback(); return 'update_level_failed'; } $update_bind_tag = app::get('pam')->model('bind_tag')->update(array('member_id' => $to_pam_member[0]['member_id']), array('member_id' => $login_member_id)); } //$stupid_password = pam_encrypt::get_encrypted_password('123456','member',array('login_name'=>$to_pam_member[0]['password_account'],'createtime'=>$to_pam_member[0]['createtime'])); //if($stupid_password == $to_pam_member[0]['login_password']){ //如果微信端是sb密码123456则将密码设置为输入的旧账号密码 // $use_data['login_name'] = $to_pam_member[0]['pay_password']; // $use_data['createtime'] = $to_pam_member[0]['createtime']; // $to_login_password = pam_encrypt::get_encrypted_password($account_password,'member',array('login_name'=>$to_pam_member[0]['password_account'],'createtime'=>$to_pam_member[0]['createtime'])); // $to_pam_member[0]['login_password'] = $to_login_password; // $update_passwd_row = $pamMemberMdl->update( //将原来sb密码123456设置成新密码 // array('login_password'=>$to_pam_member[0]['login_password']), // array('member_id'=>$to_pam_member[0]['member_id'])); // if(!$update_passwd_row){ // $db->rollback(); // return 'update_passwd_failed'; // } //} $update_member_row = $pamMemberMdl->update(array('member_id' => $to_pam_member[0]['member_id'], 'password_account' => $to_pam_member[0]['password_account'], 'login_password' => $to_pam_member[0]['login_password'], 'pay_password' => $to_pam_member[0]['pay_password'], 'createtime' => $to_pam_member[0]['createtime'], 'disabled' => 'true'), array('member_id' => $from_pam_member[0]['member_id'])); if (!$update_member_row) { $db->rollback(); return 'update_member_failed'; } $new_encrypted_password = pam_encrypt::get_encrypted_password($new_account_password, 'member', array('login_name' => $to_pam_member[0]['password_account'], 'createtime' => $to_pam_member[0]['createtime'])); $update_passwd_row = $pamMemberMdl->update(array('login_password' => $new_encrypted_password), array('member_id' => $to_pam_member[0]['member_id'])); if (!$update_passwd_row) { $db->rollback(); return 'update_passwd_failed'; } if ($from_b2c_member[0]['advance'] > 0) { $msg = '会员绑定预存款转移'; if (!$objAdvances->add($to_pam_member[0]['member_id'], $from_b2c_member[0]['advance'], app::get('b2c')->_('会员绑定预存款转移'), $msg)) { //为合并的会员增加预存款 $db->rollback(); return 'add_advance_wrong'; } if (!$objAdvances->deduct($from_pam_member[0]['member_id'], $from_b2c_member[0]['advance'], app::get('b2c')->_('会员卡绑定预存款转移'), $msg)) { //为被合并的会员增加预存款 $db->rollback(); return 'reduce_advance_wrong'; } } if ($from_b2c_member[0]['point'] > 0) { $msg = app::get('b2c')->_('会员绑定积分转移'); if (!$member_point->change_point($to_pam_member[0]['member_id'], $from_b2c_member[0]['point'], $msg, 'operator_adjust', 3, $to_pam_member[0]['member_id'], $to_pam_member[0]['member_id'], 'bindmember')) { $db->rollback(); return 'add_point_wrong'; } if (!$member_point->change_point($from_pam_member[0]['member_id'], -$from_b2c_member[0]['point'], $msg, 'operator_adjust', 3, $from_pam_member[0]['member_id'], $from_pam_member[0]['member_id'], 'bindmember')) { $db->rollback(); return 'reduce_point_wrong'; } } $oCoupon = kernel::single('b2c_coupon_mem'); $oData = $oCoupon->get_list_m($from_pam_member[0]['member_id']); if ($oData) { $update_oCoupon_row = $this->app->model('member_coupon')->update(array('member_id' => $to_pam_member[0]['member_id']), array('member_id' => $from_pam_member[0]['member_id'])); if (!$update_oCoupon_row) { $db->rollback(); return 'update_coupon_failed'; } } $db->commit($transaction_status); return 'ok'; }
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; }
/** * 认证用户名密码以及验证码等 * @param object $auth pam_auth对象 * @param array $usrdata 认证提示信息 * @return bool|int返回认证成功与否 */ function login($auth, &$usrdata) { if ($auth->is_enable_vcode()) { $key = $auth->appid; if (!base_vcode::verify($key, intval($_POST['verifycode']))) { $usrdata['log_data'] = app::get('pam')->_('验证码不正确!'); $_SESSION['error'] = app::get('pam')->_('验证码不正确!'); return false; } } $password_string = pam_encrypt::get_encrypted_password($_POST['password'], $auth->type, array('login_name' => $_POST['uname'])); if (!$_POST['uname'] || !$password_string || $_POST['password'] !== '0' && !$_POST['password']) { $usrdata['log_data'] = app::get('pam')->_('验证失败!'); $_SESSION['error'] = app::get('pam')->_('用户名或密码错误'); $_SESSION['error_count'][$auth->appid] = $_SESSION['error_count'][$auth->appid] + 1; return false; } $rows = app::get('pam')->model('account')->getList('*', array('login_name' => $_POST['uname'], 'login_password' => $password_string, 'account_type' => $auth->type, 'disabled' => 'false'), 0, 1); if ($rows[0]) { if ($_POST['remember'] === "true") { setcookie('pam_passport_basic_uname', $_POST['uname'], time() + 365 * 24 * 3600, '/'); } else { setcookie('pam_passport_basic_uname', '', 0, '/'); } $usrdata['log_data'] = app::get('pam')->_('用户') . $_POST['uname'] . app::get('pam')->_('验证成功!'); unset($_SESSION['error_count'][$auth->appid]); if (substr($rows[0]['login_password'], 0, 1) !== 's') { $pam_filter = array('account_id' => $rows[0]['account_id']); $string_pass = md5($rows[0]['login_password'] . $rows[0]['login_name'] . $rows[0]['createtime']); $update_data['login_password'] = '******' . substr($string_pass, 0, 31); app::get('pam')->model('account')->update($update_data, $pam_filter); } return $rows[0]['account_id']; } else { $usrdata['log_data'] = app::get('pam')->_('用户') . $_POST['uname'] . app::get('pam')->_('验证失败!'); $_SESSION['error'] = app::get('pam')->_('用户名或密码错误'); $_SESSION['error_count'][$auth->appid] = $_SESSION['error_count'][$auth->appid] + 1; return false; } }
function verify() { $this->begin($this->gen_url('passport', 'login')); $member_model =& $this->app->model('members'); $verifyCode = app::get('b2c')->getConf('site.register_valide'); if ($verifyCode == "true") { if (!base_vcode::verify('LOGINVCODE', strval($_POST['loginverifycode']))) { $this->splash('failed', $this->gen_url(array('app' => 'b2c', 'ctl' => 'site_passport', 'act' => 'index')), app::get('b2c')->_('验证码错误'), true); } } $rows = app::get('pam')->model('account')->getList('account_id', array('account_type' => 'member', 'disabled' => 'false', 'login_name' => $_POST['login'], 'login_password' => pam_encrypt::get_encrypted_password($_POST['passwd'], pam_account::get_account_type($this->app->app_id), array('login_name' => $_POST['login'])))); if ($rows) { $_SESSION['account'][pam_account::get_account_type($this->app->app_id)] = $rows[0]['account_id']; $this->bind_member($rows[0]['account_id']); $this->end(true, app::get('b2c')->_('登录成功,进入会员中心'), $this->gen_url(array('app' => 'b2c', 'ctl' => 'site_member', 'act' => 'index'))); } else { $_SESSION['login_msg'] = app::get('b2c')->_('用户名或密码错误'); $this->end(false, $_SESSION['login_msg'], $this->gen_url(array('app' => 'b2c', 'ctl' => 'site_passport', 'act' => 'login'))); } }
public function reset_passport($member_id, $password) { $pamMembersModel = app::get('seller')->model('sellers'); $pamData = $pamMembersModel->getList('member_id, login_name, createtime', array('member_id' => $member_id)); $db = vmc::database(); $db->beginTransaction(); foreach ($pamData as $row) { //s15a24d4d5c94c440b4fc9aba4983cab s15a24d4d5c94c440b4fc9aba4983cab $use_pass_data['createtime'] = $row['createtime']; $use_pass_data['login_name'] = $row['login_name']; $login_password = pam_encrypt::get_encrypted_password(trim($password), 'member', $use_pass_data); if (!$pamMembersModel->update(array('login_password' => $login_password), array('member_id' => $row['member_id']))) { $db->rollBack(); return false; } } $db->commit(); return true; }