-
Notifications
You must be signed in to change notification settings - Fork 473
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
zhiyicx/thinksns-plus-android#2390
- Loading branch information
Showing
5 changed files
with
128 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* +----------------------------------------------------------------------+ | ||
* | ThinkSNS Plus | | ||
* +----------------------------------------------------------------------+ | ||
* | Copyright (c) 2018 Chengdu ZhiYiChuangXiang Technology Co., Ltd. | | ||
* +----------------------------------------------------------------------+ | ||
* | This source file is subject to version 2.0 of the Apache license, | | ||
* | that is bundled with this package in the file LICENSE, and is | | ||
* | available through the world-wide-web at the following url: | | ||
* | http://www.apache.org/licenses/LICENSE-2.0.html | | ||
* +----------------------------------------------------------------------+ | ||
* | Author: Slim Kit Group <[email protected]> | | ||
* | Homepage: www.thinksns.com | | ||
* +----------------------------------------------------------------------+ | ||
*/ | ||
|
||
namespace Zhiyi\Plus\Admin\Controllers\Setting; | ||
|
||
use Illuminate\Http\Request; | ||
use Illuminate\Http\Response; | ||
use function Zhiyi\Plus\setting; | ||
use Illuminate\Http\JsonResponse; | ||
use Zhiyi\Plus\Admin\Controllers\Controller; | ||
|
||
class Security extends Controller | ||
{ | ||
/** | ||
* Get pay validate password switch. | ||
* @return \Illuminate\Http\JsonResponse | ||
*/ | ||
public function payValidateSwitch(): JsonResponse | ||
{ | ||
$switch = (bool) setting('pay', 'validate-password', false); | ||
|
||
return new JsonResponse(['switch' => $switch], JsonResponse::HTTP_OK); | ||
} | ||
|
||
/** | ||
* Change pay validate password switch. | ||
* @param \Illuminate\Http\Request $request | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function changePayValidateSwitch(Request $request): Response | ||
{ | ||
$switch = (bool) $request->input('switch', false); | ||
setting('pay')->set('validate-password', $switch); | ||
|
||
return new Response('', Response::HTTP_NO_CONTENT); | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
resources/assets/admin/components/modules/setting/security-pay-validate-password.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<template> | ||
<div class="panel panel-default"> | ||
<div class="panel-heading">支付验证密码</div> | ||
<div class="panel-body"> | ||
<sb-ui-loading v-if="loading" /> | ||
<div class="form-horizontal" v-else> | ||
<div class="form-group"> | ||
<label class="col-sm-2 control-label">开关</label> | ||
<div class="col-sm-4"> | ||
<sb-ui-button | ||
class="btn btn-primary" | ||
:label="setting ? '关闭' : '开启'" | ||
@click="changeSwitchHandler" | ||
> | ||
</sb-ui-button> | ||
</div> | ||
<div class="col-sm-6 help-block"> | ||
默认关闭,如果开启那么用户发生付款行为需要用户输入登录密码进行安全验证,关闭后泽不需要输入密码验证! | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import request, { createRequestURI } from '../../../util/request'; | ||
export default { | ||
data: () => ({ | ||
loading: false, | ||
setting: false, | ||
}), | ||
created() { | ||
this.loading = true; | ||
request.get(createRequestURI('setting/security/pay-validate-password'), { | ||
validateStatus: status => status === 200, | ||
}).then(({ data }) => { | ||
this.setting = data.switch || false; | ||
this.loading = false; | ||
}).catch(() => { | ||
this.$store.dispatch('alert-open', { type: 'danger', message: '获取配置失败,请联系技术人员!' }); | ||
}); | ||
}, | ||
methods: { | ||
changeSwitchHandler({ stopProcessing }) { | ||
request.put( | ||
createRequestURI('setting/security/pay-validate-password'), | ||
{ switch: !this.setting }, | ||
{ | ||
validateStatus: status => status === 204 | ||
} | ||
).then(() => { | ||
this.setting = ! this.setting; | ||
this.submiting = false; | ||
stopProcessing(); | ||
}).catch(() => { | ||
this.$store.dispatch('alert-open', { type: 'danger', message: '更新配置失败,请联系技术人员!' }); | ||
stopProcessing(); | ||
}); | ||
} | ||
} | ||
} | ||
</script> | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters