add email whitelist config

This commit is contained in:
Tokumeikoi 2020-02-09 18:09:48 +08:00
parent 078e1e7bd6
commit 6b9e424b74
3 changed files with 5 additions and 5 deletions

View File

@ -18,10 +18,10 @@ class AuthController extends Controller
{
public function register(AuthRegister $request)
{
if ((int)config('v2board.email_suffix_enable', 0)) {
if ((int)config('v2board.email_whitelist_enable', 0)) {
if (!Helper::emailSuffixVerify(
$request->input('email'),
config('v2board.email_suffix_whitelist', Dict::EMAIL_WHITELIST_SUFFIX_DEFAULT))
config('v2board.email_whitelist_suffix', Dict::EMAIL_WHITELIST_SUFFIX_DEFAULT))
) {
abort(500, '邮箱后缀不处于白名单中');
}

View File

@ -21,8 +21,8 @@ class CommController extends Controller
'data' => [
'isEmailVerify' => (int)config('v2board.email_verify', 0) ? 1 : 0,
'isInviteForce' => (int)config('v2board.invite_force', 0) ? 1 : 0,
'emailSuffixWhiteList' => (int)config('v2board.email_suffix_enable', 0)
? config('v2board.email_suffix_whitelist', Dict::EMAIL_WHITELIST_SUFFIX_DEFAULT)
'emailWhitelistSuffix' => (int)config('v2board.email_whitelist_enable', 0)
? config('v2board.email_whitelist_suffix', Dict::EMAIL_WHITELIST_SUFFIX_DEFAULT)
: 0
]
]);

View File

@ -23,7 +23,7 @@ class ConfigSave extends FormRequest
'try_out_plan_id' => 'integer',
'try_out_hour' => 'numeric',
'email_whitelist_enable' => 'in:0,1',
'email_suffix_whitelist' => '',
'email_whitelist_suffix' => '',
// server
'server_token' => 'nullable|min:16',
'server_license' => 'nullable',