Commit ee630520 authored by ZhuChunYang's avatar ZhuChunYang

设置钱包密码

parent 7168672d
<?php
/**
* Created by PhpStorm.
* User: ZCY
* Date: 2018/12/17
* Time: 10:13
*/
namespace backend\controllers;
use common\models\psources\CoinApplicationCategory;
use Yii;
class WalletController extends BaseController
{
public function actionSetPasswd()
{
if (Yii::$app->request->isPost) {
$old_passwd = Yii::$app->request->post('old_passwd');
$new_passwd = Yii::$app->request->post('new_passwd');
$confirm_passwd = Yii::$app->request->post('confirm_passwd');
$passwd = Yii::$app->redis->get('wallet_passwd');
if(!$passwd){
Yii::$app->redis->set('wallet_passwd',$new_passwd);
$this->success('钱包密码设置成功', Yii::$app->request->getReferrer());
}
if($passwd != $old_passwd){
$this->error('原始密码错误', Yii::$app->request->getReferrer());
}
if($new_passwd != $confirm_passwd){
$this->error('确认密码和设置的密码不一致', Yii::$app->request->getReferrer());
}
Yii::$app->redis->set('wallet_passwd',$new_passwd);
$this->success('钱包密码设置成功', Yii::$app->request->getReferrer());
}
return $this->render('set-passwd');
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: ZCY
* Date: 18-12-18
* Time: 上午10:26
*/
?>
<h4>设置密码</h4>
<style>
.layui-form-label {
width: 100px;
}
</style>
<div class="layui-row" style="padding: 5px;">
<div class="layui-col-md3">
<form class="layui-form" method="post" action="">
<input name="_csrf" type="hidden" value="<?= Yii::$app->request->getCsrfToken() ?>">
<div class="layui-form-item">
<label class="layui-form-label">原始密码</label>
<div class="layui-input-block">
<input name="old_passwd" type="password" required class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">设置密码</label>
<div class="layui-input-block">
<input class="layui-input" name="new_passwd" required type="password">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">确认密码</label>
<div class="layui-input-block">
<input class="layui-input" name="confirm_passwd" required type="password">
</div>
</div>
<div class="layui-form-item">
<button class="layui-btn">提交</button>
</div>
</form>
</div>
</div>
<script>
var form = layui.form;
form.render();
</script>
......@@ -159,7 +159,8 @@ class CoinReleaseCheck extends BaseActiveRecord
} else {
$isToken = true;
}
Chain33Business::unLockWallet("beanwalletGD666");
$walletpasswd = Yii::$app->redis->get('wallet_passwd');
Chain33Business::unLockWallet($walletpasswd);
$result = Chain33Business::transToken(
trim($address),
trim($this->to_address),
......
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