Commit 9b37ab01 authored by liuqiao's avatar liuqiao

弱密码

parent e79b0e82
......@@ -7,7 +7,7 @@ class zsb_api_model extends MY_Model{
private $apiSource = 'PC';// 访问API使用的公用source
private $apiVersion = '1.0.0';// 访问API使用的公用版本号
private $token = 'ZSB_API';
private $host_preview = 'http://newrenttest.house365.com';
private $host_preview = 'http://newrent.house365.com';
private $apiUrl = array(
......@@ -25,6 +25,8 @@ class zsb_api_model extends MY_Model{
'vr_add'=>'/zsbapi/broker/vr-add',//VR申请提交
'vr_cancel'=>'/zsbapi/broker/vr-cancel',//VR申请取消
'uploadPic' => '/ajax-action/upload-file', // 上传图片接口
'login_qr_code' => '/zsbapinj/qr-code-login/login-qr-code', // 登录二维码
'user_by_qr_code' => '/zsbapinj/qr-code-login/login-qr-code-data', // 校验是否确认登录
);
......
......@@ -444,8 +444,8 @@ $config['left_menu']['house_manage'] = array(
array('rent_manage','rent_manage_invalid','rent_manage_frozen')
);
$config['left_menu']['ucenter'] = array(
'ucenter/my_growth',
'ucenter/my_information',
'ucenter/my_growth',
'ucenter/my_information'=>array('ucenter/my_information/index','ucenter/edit_password'),
'ucenter/my_history',
array('ucenter/my_message_list', 'ucenter/my_message_detail'),
array('loan_index','loan_record'),
......
......@@ -437,6 +437,10 @@ class Login extends MY_Controller {
$log_data = array('kind'=>'brokercp', 'uid'=>$uid, 'logintime'=>$now, 'ip'=>$ip);
$this->broker_model->log_broker_login($log_data);
// 弱密码校验
if ($this->broker_model->checkWeakPassword($password)) {
$this->session->set_userdata('zsb_user_weak_password',1);
}
return TRUE;
}
else
......@@ -449,6 +453,58 @@ class Login extends MY_Controller {
return 'yzm_error';
}
}
/**
* 生成二维码
* @author Livfer
*/
public function qrCode()
{
$this->load->model('zsb_api_model');// 租售宝API调用类
$data = $this->zsb_api_model->getRequrstData('login_qr_code');
echo json_encode($data);exit();
}
/**
* 轮询请求判断是否已确认登录
* @author Livfer
*/
public function qrCodeLogin()
{
$uuid = $this->input->post('uuid');
$params = array(
'key' => $uuid,
);
$this->load->model('zsb_api_model');// 租售宝API调用类
// 通过key获取缓存用户数据
$data = $this->zsb_api_model->getRequrstData('user_by_qr_code',$params);
// 过期
if ($data['expired']) {
$response = array('msg' => 'expired');
echo json_encode($response);exit;
} else {
// 如果APP已确认登录
if ($data['login_check'] && $data['username']) {
$sellUserName = isset($sessionUserData['sell']['username']) ? $sessionUserData['sell']['username'] : '';
$rentUserName = isset($sessionUserData['rent']['username']) ? $sessionUserData['rent']['username'] : '';
// 已经写入session
if (($data['username'] == $sellUserName) || ($data['username'] == $rentUserName)) {
$response = array('msg' => 'has_login');
echo json_encode($response);exit;
}
$this->load->model('broker_model');
$codeData = $this->broker_model->qrCodeLogin($data['username']);
$response = array('msg' => $codeData);
echo json_encode($response);exit;
} else {
$response = array('msg' => 'wait');
echo json_encode($response);exit;
}
}
}
}
/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */
......@@ -858,4 +858,17 @@ class ucenter_information extends MY_Controller{
}
}
/**
* 修改密码页面
* @author Livfer
*/
public function edit_password()
{
$data = array();
$data['page_title'] = '租售宝-个人中心-基本资料';
$data['css'] = load_css('zsb/css/v1.0/style1.css,zsb/css/v1.0/jquery.Jcrop.css'); //需要加载的css
$data['js'] = load_js('zsb/js/v1.0/jquery.validate.min.js,zsb/js/v1.0/messages_zh.js.js,zsb/js/v1.0/jquery.Jcrop.min.js,zsb/js/v1.0/js2.js'); //需要加载的css
$this->view('ucenter', 'ucenter/edit_password',$data);
}
}
\ No newline at end of file
......@@ -62,6 +62,12 @@ class MY_Controller extends CI_Controller
$this->mc->set('getHitNum_MY_Controller_055',$count,86400);
} */
// 弱密码,并且当前请求不是修改密码或退出则跳转到修改密码页面
if ($this->session->userdata('zsb_user_weak_password') && ($_SERVER['REQUEST_URI'] != '/ucenter_information/edit_password' && $_SERVER['REQUEST_URI'] != '/login/quit/')) {
header("Location: /ucenter_information/edit_password");
exit;
}
}
/**
......
......@@ -1392,6 +1392,63 @@ class Broker_model extends Broker_base_model {
return $rent_allow_release;
}
/**
* 判断密码是否为纯数字或纯字母
* @param $password
* @return bool
* @author Livfer
*/
public function checkWeakPassword($password)
{
if (preg_match('/^\d+$/i', $password) || preg_match('/^[a-zA-Z]+$/i', $password)) {
return true;
}
return false;
}
public function qrCodeLogin($username)
{
$authnum = $this->session->userdata('authnum');
//清空SESSION数据
$this->session->unset_userdata('authnum');
$this->dbback->select("uid,accid,telno,truename,smallphoto");
$this->dbback->where("username = '".$username."'");
//查询
$arr_data = $this->dbback->get('broker')->row_array();
$this->yunxinLogin($username);
$uid = isset($arr_data['uid']) ? $arr_data['uid'] : 0;
//设置UID
$this->set_uid($uid);
//获取经纪人信息
$broker_info = $this->get_broker_info();
//当前时间
$now = time();
//判断账号是否到期
$now_ymd = date('Y-m-d', $now);
if($broker_info['expiredate'] < $now_ymd)
{
return 'exp_error';
}
//判断账号是否禁用
if($broker_info['valid_flag'] != '1')
{
return 'vad_error';
}
//验证无误,把用户基本信息存入SESSION,并记录登陆日志
$this->broker_model->set_user_session($broker_info);
$this->broker_model->set_rand_post();
$ip = get_ip(); //登陆IP
$log_data = array('kind'=>'qrcode', 'uid'=>$uid, 'logintime'=>$now, 'ip'=>$ip);
$this->log_broker_login($log_data);
return 'success';
}
}
/* End of file Broker_model.php */
......
......@@ -40,6 +40,26 @@ $phone = getPhone(4);
#demo{height: 270px;position: relative;overflow:hidden;}
#demo1,#demo2{ height: auto;}
.notice-close{ position: absolute; border: 1px solid #666; bottom: 0px; padding:2px; cursor:pointer;left:0}
.qrcode_login{}
.qrcode_login .qrcode_left{float: left;width: 50%}
.qrcode_login .qrcode_right{float: left;width: 46%}
.qrcode_right .account-btn {
font-size: 14px;
color: #fff;
height: 35px;
padding: 0 15px;
background-color: #07c160;
border: 1px solid #07c160;
line-height: 2;
text-align: center;
border-radius: 2px;
cursor: pointer;
transition: opacity 0.2s;
outline: none;
position: relative;
}
.qrcode_login .qrcode_text{font-size: 16px;margin-top: 20px;text-align: center}
.qrcode_text_color { color: #fe8b41}
</style>
<div class="notice">
<div class="noticewap">
......@@ -117,8 +137,17 @@ $phone = getPhone(4);
<div id="errorBlock"><span class="ico">&nbsp;</span><span id="errorInner"></span></div>
<div class="forms">
<div class="qrcode_login">
<div class="qrcode_left">
<img id="qrcode_img" src="<?php echo $default_login_qr_code;?>" alt="" style="width: 150px;height: 150px">
</div>
<div class="qrcode_right">
<div class="qrcode_text">打开<span class="qrcode_text_color">租售宝APP</span></div>
<div class="qrcode_text">扫描二维码安全登录</div>
<div class="qrcode_text account-btn">账户登录</div>
</div>
</div>
<div class="forms" style="display: none">
<div class="item clearfix">
<?php
$login_citys = array(
......@@ -240,6 +269,9 @@ $phone = getPhone(4);
<!--<script type='text/javascript'>var isa_website = '2,16,43';var isa_city = 'nj';var isa_addones = '';var isa_context_id = '';var _analyze365 = (('https:' == document.location.protocol) ? ' https://': ' http://');document.write(unescape('%3Cscript src="'+ _analyze365 + 'isa.house365.com/js/analyze.js?v=2.1" type="text/javascript"%3E%3C/script%3E'));</script>-->
<script src="/source/zsb/js/layer-v3.1.1/layer/layer.js"></script>
<link href="/source/zsb/layui/css/mylayui.css" rel="stylesheet" type="text/css">
<script src="/source/zsb/layui/layui.js"></script>
<?php //if($google_analytics != '' ){ echo $google_analytics ;}?>
<script type="text/javascript">
......@@ -353,6 +385,74 @@ var _hmt = _hmt || [];
$(this).find(".select_list").hide();
});
$('.account-btn').click(function (){
$('.qrcode_login').hide();
$('.forms').show();
})
// $.ajax({
// url: '/login/qrCode',
// type: 'get',
// dataType: 'json',
// sync: true,
// success: function (response) {
// console.log(response);
// if (response.result === '0') {
// layer.msg(response.msg);
// }
// $("#qrcode_img").attr('src',response.login_img);
// var uuid = response.key;
// var qrcodeLogin = setInterval(function (){
// $.ajax({
// url: '/login/qrCodeLogin',
// type: 'post',
// dataType: 'json',
// data: {uuid:uuid},
// sync: true,
// success: function (response) {
// console.log(response);
// var msg = response.msg;
//
// if (msg === 'expired') {
// clearInterval(qrcodeLogin);
// layer.msg('登录失败,请刷新二维码重新登录');
// return;
// }
//
// if (msg === 'wait') {
// return;
// }
//
// if (msg === 'success' || msg === 'has_login') {
// clearInterval(qrcodeLogin);
// layer.msg('登录成功',{
// icon: 1,
// time: 2000
// },function (){
// location.href = "/";
// })
// } else {
// var errorMsg = '';
// switch(msg) {
// case 'u_p_error':
// errorMsg = '账号不正确,请刷新二维码重新扫描';
// break;
// case 'vad_error':
// case 'exp_error':
// errorMsg = '该账号已到期,请联系网站工作人员!';
// break;
// default:
// errorMsg = '登陆失败,请稍后再试!';
// break;
// }
// clearInterval(qrcodeLogin);
// layer.msg(errorMsg);
// }
//
// }
// })
// },1000 * 10)
// }
// })
})
</script>
......
<div id="centre" class="layout">
<div class="centreInner ">
<div class="mainInner radius5 ">
<div class="belongBox radius3 belongBox_jub">
<div class="forms">
<div class="yz-msg">
修改密码
</div>
<form action="" id="jsForm_jub" method="post" onsubmit="return false">
<dl class="list">
<dd class="list_item clearfix">
<label class="label">输入旧密码:</label>
<div class="fields">
<div class="fgInput jsFgInput">
<input id="oldpassword" type="password" class="input_text w205" name="oldpassword" value=""
placeholder="请输入当前正在使用的租售宝密码"/>
<label class="error" style="display:none;" >请填写当前正在使用的密码。</label>
</div>
</div>
</dd>
<!---->
<dd class="list_item clearfix">
<label class="label">输入新密码:</label>
<div class="fields">
<div class="fgInput jsFgInput">
<input id="newpassword" type="password" class="input_text w205" name="newpassword"
placeholder="密码中必须要包含数字和字母"/>
<label class="error" id="newpassworderr" style="display:none;" ></label>
</div>
</div>
</dd>
<!---->
<dd class="list_item clearfix">
<label class="label">确认新密码:</label>
<div class="fields nameInput">
<div class="fgInput jsNameInput jsFgInput">
<input id="newpassword2" type="password" class="input_text w205" name="newpassword2"
id="newpassword2" placeholder="密码中必须要包含数字和字母"/>
<label class="error" style="display:none;" >两次输入的密码不一致。</label>
</div>
</div>
</dd>
<dd>
<div class="btnFBbox">
<button id="jsAlterSubmitPassword" class="btnB btnSubmit radius5" style="line-height:30px; " type="button"
can="yes">确认修改
</button>
</div>
</dd>
</dl>
<!---->
</form>
</div>
</div>
<!---->
</div>
</div>
</div>
<div id="jsAlterPasswordT" class="dialog radius5" >
<div class="hd">
<h3 class="h3">提示</h3>
<p class="close close-win" title="关闭">关闭 </p>
</div>
<div class="mod">
<div class="textMod"><img alt="" src="<?=STATIC_SOURCE_URL?>/zsb/images/v1.0/okBg.png" > 密码修改成功!!</div>
</div>
</div>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment