Fix incompatibilities found after removing signup ruleset

This commit is contained in:
Kijin Sung 2021-01-29 15:41:41 +09:00
parent 41ed1d7bec
commit 4377c06d6b

View file

@ -814,7 +814,7 @@ class memberController extends member
{ {
$use_phone = true; $use_phone = true;
} }
if($formInfo->isDefaultForm && ($formInfo->isUse || $formInfo->required || $formInfo->mustRequired)) if($formInfo->isUse || $formInfo->required || $formInfo->mustRequired)
{ {
$getVars[] = $formInfo->name; $getVars[] = $formInfo->name;
} }
@ -3834,18 +3834,15 @@ class memberController extends member
foreach($config->signupForm as $formInfo) foreach($config->signupForm as $formInfo)
{ {
if($formInfo->required || $formInfo->mustRequired) if($formInfo->isUse && ($formInfo->required || $formInfo->mustRequired))
{ {
if ($mode === 'update' && in_array($formInfo->name, $not_required_in_update)) if ($mode === 'update' && in_array($formInfo->name, $not_required_in_update))
{ {
// pass // pass
} }
else elseif (!isset($args->{$formInfo->name}) || !$args->{$formInfo->name})
{ {
if (!isset($args->{$formInfo->name}) || !$args->{$formInfo->name}) return new BaseObject(-1, sprintf(lang('common.filter.isnull'), $formInfo->title));
{
return new BaseObject(-1, sprintf(lang('common.filter.isnull'), $formInfo->title));
}
} }
} }
if ($formInfo->name === 'email_address' && $args->{$formInfo->name} && !Mail::isVaildMailAddress($args->{$formInfo->name})) if ($formInfo->name === 'email_address' && $args->{$formInfo->name} && !Mail::isVaildMailAddress($args->{$formInfo->name}))
@ -3856,9 +3853,13 @@ class memberController extends member
{ {
return new BaseObject(-1, sprintf(lang('common.filter.invalid_user_id'), $formInfo->title)); return new BaseObject(-1, sprintf(lang('common.filter.invalid_user_id'), $formInfo->title));
} }
if ($formInfo->name === 'password' && $args->password && ($args->password !== Context::get('password2'))) if ($formInfo->name === 'password' && $args->{$formInfo->name})
{ {
return new BaseObject(-1, 'msg_password_mismatch'); $password_check = trim(Context::get('password2'));
if ($password_check !== '' && !hash_equals($args->password, $password_check))
{
return new BaseObject(-1, 'msg_password_mismatch');
}
} }
} }