1
0
mirror of https://e.coding.net/circlecloud/McAccount.git synced 2024-11-21 01:38:55 +00:00

修复邮箱验证 增加验证检测 使用默认的企业邮箱...

This commit is contained in:
502647092 2015-11-05 20:22:48 +08:00
parent 5425b2b1e4
commit 5f9bc7ec12
5 changed files with 144 additions and 117 deletions

View File

@ -22,10 +22,10 @@ $Config ['DBname'] = 'minecraft'; // 数据库名称
$Config ['CharSet'] = "UTF-8"; $Config ['CharSet'] = "UTF-8";
// 邮箱信息配置********************************************** // 邮箱信息配置**********************************************
$Config ['smtp'] = "smtp.163.com"; $Config ['smtp'] = "smtp.citycraft.cn";
$Config ['port'] = "25"; $Config ['port'] = "25";
$Config ['user'] = "jtb1@163.com"; $Config ['user'] = "authme@citycraft.cn";
$Config ['sender'] = "jtb1@163.com"; $Config ['sender'] = "authme@citycraft.cn";
$Config ['pass'] = "jtb2hww"; $Config ['pass'] = "Email2Check";
$Config ['debug'] = false; $Config ['debug'] = false;

View File

@ -33,7 +33,11 @@ class mail_status extends AmysqlController {
* 显示邮箱验证状态 * 显示邮箱验证状态
*/ */
function stat() { function stat() {
JsonSuccess ( $this->_model ( 'mail_model' )->status ( @$_SESSION ['username'] ) ); if ($this->_model ( 'mail_model' )->status ( @$_SESSION ['username'] )) {
JsonSuccess ( '邮箱已验证!' );
} else {
JsonError ( "邮箱未验证!" );
}
} }
} }
?> ?>

View File

@ -14,7 +14,7 @@ class mail_model extends AmysqlModel {
return $this->_update ( 'mail', $data, "WHERE user='" . $user . "'" ) != 0; return $this->_update ( 'mail', $data, "WHERE user='" . $user . "'" ) != 0;
} }
public function status($user) { public function status($user) {
$sql = "SELECT * FROM `mail` WHERE `user` = '" . $user . "'"; $sql = "SELECT * FROM `mail` WHERE `user` = '" . $user . "' and `statu` = 1";
return $this->_all ( $sql ); return $this->_all ( $sql );
} }
} }

View File

@ -1,121 +1,124 @@
<?php <?php
if (empty ( $_SESSION ['username'] )) if (empty ( $_SESSION ['username'] ))
header ( 'Location:' . Url ( 'index', 'login' ) ); header ( 'Location:' . Url ( 'index', 'login' ) );
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title><?=$title?></title> <title><?=$title?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- bootstrap --> <!-- bootstrap -->
<link href="View/public/css/bootstrap/bootstrap.css" rel="stylesheet" /> <link href="View/public/css/bootstrap/bootstrap.css" rel="stylesheet" />
<link href="View/public/css/bootstrap/bootstrap-responsive.css" <link href="View/public/css/bootstrap/bootstrap-responsive.css"
rel="stylesheet" /> rel="stylesheet" />
<link href="View/public/css/bootstrap/bootstrap-overrides.css" <link href="View/public/css/bootstrap/bootstrap-overrides.css"
type="text/css" rel="stylesheet" /> type="text/css" rel="stylesheet" />
<!-- libraries --> <!-- libraries -->
<link href="View/public/css/lib/bootstrap-wysihtml5.css" type="text/css" <link href="View/public/css/lib/bootstrap-wysihtml5.css" type="text/css"
rel="stylesheet" /> rel="stylesheet" />
<link href="View/public/css/lib/uniform.default.css" type="text/css" <link href="View/public/css/lib/uniform.default.css" type="text/css"
rel="stylesheet" /> rel="stylesheet" />
<link href="View/public/css/lib/select2.css" type="text/css" <link href="View/public/css/lib/select2.css" type="text/css"
rel="stylesheet" /> rel="stylesheet" />
<link href="View/public/css/lib/bootstrap.datepicker.css" <link href="View/public/css/lib/bootstrap.datepicker.css"
type="text/css" rel="stylesheet" /> type="text/css" rel="stylesheet" />
<link href="View/public/css/lib/font-awesome.css" type="text/css" <link href="View/public/css/lib/font-awesome.css" type="text/css"
rel="stylesheet" /> rel="stylesheet" />
<!-- global styles --> <!-- global styles -->
<link rel="stylesheet" type="text/css" href="View/public/css/layout.css" /> <link rel="stylesheet" type="text/css" href="View/public/css/layout.css" />
<link rel="stylesheet" type="text/css" <link rel="stylesheet" type="text/css"
href="View/public/css/elements.css" /> href="View/public/css/elements.css" />
<link rel="stylesheet" type="text/css" href="View/public/css/icons.css" /> <link rel="stylesheet" type="text/css" href="View/public/css/icons.css" />
<!-- this page specific styles --> <!-- this page specific styles -->
<link rel="stylesheet" href="View/public/css/compiled/form-showcase.css" <link rel="stylesheet" href="View/public/css/compiled/form-showcase.css"
type="text/css" media="screen" /> type="text/css" media="screen" />
<!--[if lt IE 9]> <!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]--> <![endif]-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head> </head>
<body> <body>
<!-- navbar --> <!-- navbar -->
<?=load('header')?> <?=load('header')?>
<!-- end navbar --> <!-- end navbar -->
<!-- sidebar --> <!-- sidebar -->
<?=load('left')?> <?=load('left')?>
<!-- end sidebar --> <!-- end sidebar -->
<!-- main container --> <!-- main container -->
<div class="content"> <div class="content">
<div class="container-fluid"> <div class="container-fluid">
<div id="pad-wrapper"> <div id="pad-wrapper">
<div class="table-products section"> <div class="table-products section">
<div class="row-fluid form-wrapper"> <div class="row-fluid form-wrapper">
<div class="container-fluid col-xs-12"> <div class="container-fluid col-xs-12">
<div id="pad-wrapper" class="form-page"> <div id="pad-wrapper" class="form-page">
<div class="row-fluid form-wrapper"> <div class="row-fluid form-wrapper">
<!-- left column --> <!-- left column -->
<div class="span8 column"> <div class="span8 column">
<table class="table table-hover col-xs-12" <table class="table table-hover col-xs-12"
style="width: 570px;"> style="width: 570px;">
<tbody> <tbody>
<!-- row --> <!-- row -->
<tr class="first"> <tr class="first">
<td>邮箱地址</td> <td>邮箱地址</td>
<td class="description"><input style="width: 250px;" <td class="description"><input style="width: 250px;"
class="span8 inline-input" id="mail" type="text" disabled="disabled"/></td> class="span8 inline-input" id="mail" type="text"
<td><button style="width: 90px;" id="submit" type="button" disabled="disabled" /></td>
class="btn-glow primary btn-next" >发送验证码</button></td> <td><button style="width: 90px;" id="submit" type="button"
</tr> class="btn-glow primary btn-next">发送验证码</button> <span
<!-- row --> id="status"></span></td>
<tr> </tr>
<td>邮箱验证码</td> <!-- row -->
<td class="pass"><input style="width: 250px;" <tr>
class="span8 inline-input" id="verify" type="text" /></td> <td>邮箱验证码</td>
<td> <td class="pass"><input style="width: 250px;"
<button style="width: 80px;" id="status" type="button" class="span8 inline-input" id="verify" type="text" /></td>
class="btn-glow primary btn-next">验证邮箱</button> <td>
</td> <button style="width: 80px;" id="check" type="button"
</tr> class="btn-glow primary btn-next">验证邮箱</button>
</tbody> </td>
</table> </tr>
</div> </tbody>
</div> </table>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- end table sample --> </div>
</div> </div>
</div> <!-- end table sample -->
</div> </div>
</div>
<!-- end main container --> </div>
<!-- scripts for this page --> <!-- end main container -->
<script src="View/public/js/wysihtml5-0.3.0.js"></script>
<script src="View/public/js/jquery-latest.js"></script> <!-- scripts for this page -->
<script src="View/public/js/bootstrap.min.js"></script> <script src="View/public/js/wysihtml5-0.3.0.js"></script>
<script src="View/public/js/bootstrap-wysihtml5-0.0.2.js"></script> <script src="View/public/js/jquery-latest.js"></script>
<script src="View/public/js/bootstrap.datepicker.js"></script> <script src="View/public/js/bootstrap.min.js"></script>
<script src="View/public/js/jquery.uniform.min.js"></script> <script src="View/public/js/bootstrap-wysihtml5-0.0.2.js"></script>
<script src="View/public/js/select2.min.js"></script> <script src="View/public/js/bootstrap.datepicker.js"></script>
<script src="View/public/js/theme.js"></script> <script src="View/public/js/jquery.uniform.min.js"></script>
<script src="View/public/js/select2.min.js"></script>
<script src="View/public/js/theme.js"></script>
<script type="text/javascript"> <script type="text/javascript">
select() select()
var data = "user=<?=$_SESSION['username']?>"; var data = "user=<?=$_SESSION['username']?>";
function select(){ function select(){
$("#submit").disabled = true; $("#submit").attr("disabled",true);
$("#check").attr("disabled",true);
$.ajax({ $.ajax({
type:"GET", type:"GET",
dataType:"json", dataType:"json",
@ -126,8 +129,28 @@ if (empty ( $_SESSION ['username'] ))
{ {
if(rdata.status == "success") if(rdata.status == "success")
{ {
$.ajax({
type:"GET",
dataType:"json",
data:data,
url:"<?=Url('mail_status', "stat")?>",
success:function(data){
if(data.status != "success")
{
$("#status").html("邮箱状态:尚未验证 ");
$("#status").css("color", "red");
$("#submit").attr("disabled",false);
}else{
$('#status').html("邮箱验证状态:已验证");
$("#status").css("color", "green");
}
},
error:function(){
alert("邮箱验证状态读取失败");
return false;
}
})
$("#mail").val(content.email); $("#mail").val(content.email);
$("#submit").disabled = false;
} }
} }
)}, )},
@ -150,7 +173,7 @@ $(document).ready(function(){
url:'<?=Url('mail_status','sendmail')?>', url:'<?=Url('mail_status','sendmail')?>',
success:function(rdata){ success:function(rdata){
switch(rdata.status){ switch(rdata.status){
case "success": alert(rdata.info); break; case "success": alert(rdata.info); $("#submit").attr("disabled",true);$("#check").attr("disabled",false);break;
case "error": alert(rdata.info); break; case "error": alert(rdata.info); break;
} }
} }
@ -158,7 +181,7 @@ $(document).ready(function(){
}); });
}); });
$(document).ready(function(){ $(document).ready(function(){
$("#status").click(function(){ $("#check").click(function(){
var mail = $("#mail").val(); var mail = $("#mail").val();
var key = $("#verify").val(); var key = $("#verify").val();
var stat = "mail=" + mail + "&verify=" + key; var stat = "mail=" + mail + "&verify=" + key;
@ -185,6 +208,6 @@ $(document).ready(function(){
}) })
}) })
}) })
</script> </script>
</body> </body>
</html> </html>

View File

@ -119,7 +119,7 @@ if (empty ( $_SESSION ['username'] ))
data:data, data:data,
url:"<?=Url('mail_status', "stat")?>", url:"<?=Url('mail_status', "stat")?>",
success:function(data){ success:function(data){
if(data.status == "success") if(data.status != "success")
{ {
$("#status").html("邮箱验证状态:尚未验证 <a href='<?=Url('index', 'mail')?>' onclick='display()'>点击进行验证</a>"); $("#status").html("邮箱验证状态:尚未验证 <a href='<?=Url('index', 'mail')?>' onclick='display()'>点击进行验证</a>");
$("#status").css("color", "red"); $("#status").css("color", "red");