thirdpayment
ljl 11 months ago
parent c07cba2c4e
commit 5082d68140

@ -93,6 +93,20 @@ class AccountController extends AbstractController
return $this->success(['token' => $token]); return $this->success(['token' => $token]);
} }
public function updatePassword(RequestInterface $request)
{
$userInfo = $this->checkUser($request);
$oldPassword = $request->input('oldPassword');
$password = $request->input('password');
$account = Account::where('id', $userInfo['userId'])->first();
if (md5($oldPassword . $account->salt) != $account->password) {
throw new BusinessException('旧密码错误');
}
$account->password = md5($password . $account->salt);
$account->save();
return $this->success();
}
public function openAccount(RequestInterface $request) public function openAccount(RequestInterface $request)
{ {
$userInfo = $this->checkUser($request); $userInfo = $this->checkUser($request);

@ -48,6 +48,7 @@ Router::addGroup('/account',function () {
Router::post('/transfer-pay', [AccountController::class, 'transferPay']); Router::post('/transfer-pay', [AccountController::class, 'transferPay']);
Router::post('/user-info', [AccountController::class, 'getUserInfo']); Router::post('/user-info', [AccountController::class, 'getUserInfo']);
Router::get('/company-register', [AccountController::class, 'companyRegister']); Router::get('/company-register', [AccountController::class, 'companyRegister']);
Router::post('/update-password', [AccountController::class, 'updatePassword']);
}, []); }, []);
Router::addGroup('/notify',function () { Router::addGroup('/notify',function () {

@ -16,6 +16,7 @@
<el-col :span="24"> <el-col :span="24">
<el-descriptions title="用户信息"> <el-descriptions title="用户信息">
<el-descriptions-item label="用户名">{{username}} <el-button type="primary" @click="logout" size="mini" round>退出登录</el-button></el-descriptions-item> <el-descriptions-item label="用户名">{{username}} <el-button type="primary" @click="logout" size="mini" round>退出登录</el-button></el-descriptions-item>
<el-descriptions-item label="登录密码" @click="updatePasswordVisible = true">修改</el-descriptions-item>
</el-descriptions> </el-descriptions>
</el-col> </el-col>
</el-row> </el-row>
@ -77,6 +78,25 @@
<el-button @click="payInfoVisible = false">确 定</el-button> <el-button @click="payInfoVisible = false">确 定</el-button>
</div> </div>
</el-dialog> </el-dialog>
<el-dialog title="修改登录密码" :visible.sync="updatePasswordVisible" width="40%">
<div>
<el-form ref="updatePasswordForm" :model="updatePasswordForm" label-width="80px">
<el-form-item label="原密码">
<el-input show-password v-model="updatePasswordForm.oldPassword"></el-input>
</el-form-item>
<el-form-item label="密码">
<el-input show-password v-model="updatePasswordForm.password"></el-input>
</el-form-item>
<el-form-item label="确认密码">
<el-input show-password v-model="updatePasswordForm.confirm_password"></el-input>
</el-form-item>
</el-form>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="updatePasswordVisible = false">取 消</el-button>
<el-button type="primary" @click="updatePassword">确 定</el-button>
</div>
</el-dialog>
</div> </div>
</body> </body>
<!-- import Vue before Element --> <!-- import Vue before Element -->
@ -90,6 +110,7 @@
data() { data() {
return { return {
activeName: 'user', activeName: 'user',
updatePasswordVisible: false,
username: '', username: '',
payForm: { payForm: {
amount: 0 amount: 0
@ -104,6 +125,11 @@
apply_no: '', apply_no: '',
is_platform_account: '' is_platform_account: ''
}, },
updatePasswordForm: {
oldPassword: '',
password: '',
confirm_password: ''
},
bankCard: { bankCard: {
id: 0, id: 0,
bank_name: '', bank_name: '',
@ -166,6 +192,26 @@
}); });
console.log('submit!'); console.log('submit!');
}, },
updatePassword() {
if (this.registerForm.confirm_password != this.registerForm.password) {
this.$message.error('密码和确认密码不一致');
return;
}
axios.post('/account/update-password', {token: window.sessionStorage.getItem('token'), oldPassword: this.updatePasswordForm.oldPassword, password: this.updatePasswordForm.password})
.then( (response) => {
console.log(response);
let result = response.data
if (result.code != 1000) {
return this.$message.error(response.data.message);
}
this.$message.success('修改成功');
})
.catch((error) => {
this.$message.error('请求错误');
console.log(error);
});
console.log('submit!');
},
resetPayPassword() { resetPayPassword() {
axios.post('/account/reset-pay-password', {token: window.sessionStorage.getItem('token')}) axios.post('/account/reset-pay-password', {token: window.sessionStorage.getItem('token')})
.then( (response) => { .then( (response) => {

@ -79,6 +79,10 @@
}, },
methods: { methods: {
register() { register() {
if (this.registerForm.confirm_password != this.registerForm.password) {
this.$message.error('密码和确认密码不一致');
return;
}
axios.post('/account/register', this.registerForm) axios.post('/account/register', this.registerForm)
.then( (response) => { .then( (response) => {
console.log(response); console.log(response);

Loading…
Cancel
Save