Skip to content

Commit

Permalink
Merge pull request #237 from orvice/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
orvice committed Aug 21, 2015
2 parents eacee9f + 8527405 commit 25c7884
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 28 deletions.
9 changes: 0 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
ss-panel
========

A simple front end of [Shadowsocks manyuser](https://github.com/mengskysama/shadowsocks/tree/manyuser
)

[Demo](https://cattt.com) [中文安装文档](https://github.com/orvice/ss-panel/wiki/Install-Guide-zh_cn)

### Upgrade from 0.X

[Read this](https://github.com/orvice/ss-panel/blob/master/upgrade_to_v2.md)

### Requirements
* PHP >= 5.4
* PDO Extension
Expand Down
27 changes: 15 additions & 12 deletions user/_resetpwdtwo.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
$mg = new Mailgun($mailgun_key);
$domain = $mailgun_domain;
//
$code = $_GET['code'];
$email = $_GET['email'];
$uid = $_GET['uid'];
$code = $_POST['code'];
$email = $_POST['email'];
$uid = $_POST['uid'];
$password = $_POST['password'];
$repasswd = $_POST['repasswd'];
//
$ur = new \Ss\User\UserInfo($uid);
if($ur->GetEmail() == $email){
Expand All @@ -21,28 +23,29 @@
if(!$rs){
$a['code'] = '0';
$a['msg'] = "邮箱错误";
}elseif($repasswd != $password){
$a['code'] = '0';
$a['msg'] = "两次密码输入不符";
}elseif(strlen($password)<8){
$a['code'] = '0';
$a['msg'] = "密码太短";
}else{
$rst = new \Ss\User\ResetPwd($uid);
$u = new \Ss\User\User($uid);
if($rst->IsCharOK($code,$uid)){
$NewPwd = md5(time().$uid.$email);
$NewPwd = $password;
$mg->sendMessage($domain, array('from' => "no-reply@".$mailgun_domain,
'to' => $email,
'subject' => $site_name."您的新密码",
'text' => "您的新密码为:".$NewPwd));
'subject' => $site_name." 提示:您的新密码重置成功!",
'text' => "您在 ".date("Y-m-d H:i:s")." 重置了密码。"));
$u->UpdatePWd($NewPwd);
$rst->Del($code,$uid);
$a['code'] = '1';
$a['ok'] = '1';
$a['msg'] = "新密码已经发送到您的邮箱";
$a['msg'] = "您的新密码重置成功!";
}else{
$a['code'] = '0';
$a['msg'] = "链接无效";
}
}
echo json_encode($a);





26 changes: 19 additions & 7 deletions user/resetpwd_do.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,19 @@
</div><!-- /.login-logo -->
<div class="login-box-body">
<p class="login-box-msg">重置密码</p>

<input type="hidden" id="code" name="code" class="form-control" value="<?php echo $code;?>" >
<input type="hidden" id="uid" name="uid" class="form-control" value="<?php echo $uid;?>" >

<div class="form-group has-feedback">
<input id="email" name="Email" type="text" class="form-control" placeholder="Email"/>
<span class="glyphicon glyphicon-envelope form-control-feedback"></span>
</div>
<div class="form-group has-feedback">
<input type="password" id="password" class="form-control" placeholder="密码"/>
<span class="glyphicon glyphicon-lock form-control-feedback"></span>
</div>
<div class="form-group has-feedback">
<input type="password" id="repasswd" class="form-control" placeholder="重复密码"/>
<span class="glyphicon glyphicon-log-in form-control-feedback"></span>
</div>

<div class="form-group has-feedback">
<button type="submit" id="reset" class="btn btn-primary btn-block btn-flat">确认重置</button>
Expand Down Expand Up @@ -81,9 +86,16 @@
$(document).ready(function(){
function reset(){
$.ajax({
type:"GET",
url:"_resetpwdtwo.php?code="+$("#code").val()+"&uid="+$("#uid").val()+"&email="+$("#email").val(),
dataType:"json",
type:"POST",
url:"_resetpwdtwo.php",
dataType:"json",
data:{
uid: "<?php echo $uid ?>",
code: "<?php echo $code ?>",
email: $("#email").val(),
password: $("#password").val(),
repasswd: $("#repasswd").val(),
},
success:function(data){
if(data.ok){
$("#msg-error").hide(100);
Expand Down Expand Up @@ -122,4 +134,4 @@ function reset(){


</body>
</html>
</html>

0 comments on commit 25c7884

Please sign in to comment.