Add option to use a specific string in the URL to bypass disabled signup page

회원 가입을 닫아놓은 상태에서는 관리자도 회원 가입 기능을 테스트할 수 없는
문제를 해소하기 위해, 관리자가 설정한 특정한 문자열을 URL에 포함할 경우
회원 가입 페이지에 접근할 수 있도록 허용하는 옵션 추가
This commit is contained in:
Kijin Sung 2022-10-11 22:19:32 +09:00
parent 24f49d441e
commit 81882e8420
7 changed files with 56 additions and 6 deletions

View file

@ -51,6 +51,8 @@ $lang->group_image_mark_max_width = 'Max Width';
$lang->group_image_mark_max_height = 'Max Height';
$lang->signature_max_height = 'Max Signature Height';
$lang->enable_join = 'Accept New Members';
$lang->enable_join_only_with_url_key = 'Only with valid URL key';
$lang->enable_join_url_key = 'URL Key';
$lang->enable_confirm = 'Email Activation';
$lang->enable_find_account_question = 'Account recovery using question/answer';
$lang->enable_ssl = 'Enable SSL';
@ -236,7 +238,7 @@ $lang->about_active = 'You have to check on active items to show on signup form.
$lang->about_emailhost_check = 'You can limit new member\'s e-mail address providers. You can allow or prohibit some e-mail hosts (eg.: naver.com, gmail.com).<br />If the list is empty, all e-mail hosts will be allowed.';
$lang->about_form_description = 'If you enter description in this form, it will be displayed on join form.';
$lang->about_required = 'Check this to make it mandatory item when signing up.';
$lang->about_enable_join = 'Please check this if you want to allow new members to sign up your site.';
$lang->about_enable_join = 'Please check if you want to accept new members. If you require a URL key, only those who visit with the corresponding string in the URL will be able to join.';
$lang->about_enable_confirm = 'An activation email will be sent to new members. They must click a link in the email to complete the sign up process.';
$lang->about_enable_find_account_question = 'Check if you want to allow members to recover their accounts using a security question and answer.';
$lang->about_enable_ssl = 'Personal information from Sign up/Modify Member Info/Sign in can be sent as SSL(https) mode if server provides SSL service.';

View file

@ -51,6 +51,8 @@ $lang->group_image_mark_max_width = '가로 제한 길이';
$lang->group_image_mark_max_height = '세로 제한 길이';
$lang->signature_max_height = '서명 높이 제한';
$lang->enable_join = '회원 가입 허가';
$lang->enable_join_only_with_url_key = 'URL 키가 일치하는 경우에만 허가';
$lang->enable_join_url_key = 'URL 키';
$lang->enable_confirm = '메일 인증 사용';
$lang->enable_find_account_question = '질문/답변 인증 사용';
$lang->enable_ssl = 'SSL 기능 사용';
@ -243,7 +245,7 @@ $lang->about_active = '활성 항목에 체크를 해야 가입시 정상적으
$lang->about_emailhost_check = '특정 도메인에 소속된 이메일 주소로만 가입할 수 있도록 하거나, 특정 도메인을 금지할 수 있습니다. (예: naver.com, gmail.com)<br />아무 것도 입력하지 않으면 이메일 주소를 제한하지 않습니다.';
$lang->about_form_description = '설명란에 입력을 하면 가입시 표시가 됩니다.';
$lang->about_required = '체크하면 회원가입시 필수항목으로 입력하도록 됩니다.';
$lang->about_enable_join = '체크하면 회원가입을 할 수 있습니다.';
$lang->about_enable_join = '회원 가입을 받을지 선택합니다. URL 키를 사용할 경우, 일치하는 문자열이 포함된 URL로 접속해야 가입할 수 있게 됩니다.';
$lang->about_enable_confirm = '입력된 메일 주소로 인증 메일을 보내 회원 가입을 확인합니다. 가입자가 인증 메일의 링크를 클릭해야 정상적으로 로그인이 가능해집니다.';
$lang->about_enable_find_account_question = '질문/답변을 통한 비밀번호 찾기를 허용합니다. 허용하지 않을 경우 메일을 통한 비밀번호 리셋만 허용됩니다.';
$lang->about_enable_ssl = '서버에서 보안접속(SSL) 지원이 될 경우 회원가입, 정보수정, 로그인 등의 개인정보가 서버로 보내질 때 SSL(https)을 이용하도록 할 수 있습니다.';

View file

@ -223,6 +223,7 @@ class memberAdminController extends member
{
$args = Context::gets(
'enable_join',
'enable_join_key',
'enable_confirm',
'authmail_expires',
'authmail_expires_unit',
@ -238,6 +239,16 @@ class memberAdminController extends member
'member_profile_view'
);
if ($args->enable_join === 'KEY')
{
$args->enable_join = 'N';
$args->enable_join_key = escape(trim(utf8_normalize_spaces(rawurldecode($args->enable_join_key))));
}
else
{
$args->enable_join_key = null;
}
$args->authmail_expires = max(0, intval($args->authmail_expires));
if(!$args->authmail_expires)
{

View file

@ -625,9 +625,12 @@ class memberController extends member
if(!$trigger_output->toBool ()) return $trigger_output;
// Check if an administrator allows a membership
if($config->enable_join !== 'Y' || !$config->signupForm)
if ($config->enable_join !== 'Y' || !$config->signupForm)
{
throw new Rhymix\Framework\Exceptions\FeatureDisabled('msg_signup_disabled');
if (empty($config->enable_join_key) || !isset($_SESSION['signup_allowed']) || !$_SESSION['signup_allowed'])
{
throw new Rhymix\Framework\Exceptions\FeatureDisabled('msg_signup_disabled');
}
}
// Check if the user accept the license terms (only if terms exist)

View file

@ -211,8 +211,28 @@ class memberView extends member
// call a trigger (before)
$trigger_output = ModuleHandler::triggerCall('member.dispMemberSignUpForm', 'before', $member_config);
if(!$trigger_output->toBool()) return $trigger_output;
// Error appears if the member is not allowed to join
if($member_config->enable_join != 'Y') throw new Rhymix\Framework\Exceptions\FeatureDisabled('msg_signup_disabled');
if ($member_config->enable_join !== 'Y')
{
if (!empty($member_config->enable_join_key))
{
if (strpos(escape(rawurldecode(\RX_REQUEST_URL)), $member_config->enable_join_key) !== false)
{
$_SESSION['signup_allowed'] = true;
}
else
{
$_SESSION['signup_allowed'] = false;
throw new Rhymix\Framework\Exceptions\FeatureDisabled('msg_signup_disabled');
}
}
else
{
$_SESSION['signup_allowed'] = false;
throw new Rhymix\Framework\Exceptions\FeatureDisabled('msg_signup_disabled');
}
}
$formTags = getAdminView('member')->_getMemberInputTag();
Context::set('formTags', $formTags);

View file

@ -9,7 +9,10 @@
<div class="x_control-label">{$lang->enable_join}</div>
<div class="x_controls">
<label class="x_inline" for="enable_join_yes"><input type="radio" name="enable_join" id="enable_join_yes" value="Y" checked="checked"|cond="$config->enable_join == 'Y'" /> {$lang->cmd_yes}</label>
<label class="x_inline" for="enable_join_no"><input type="radio" name="enable_join" id="enable_join_no" value="N" checked="checked"|cond="$config->enable_join != 'Y'" /> {$lang->cmd_no}</label>
<label class="x_inline" for="enable_join_no"><input type="radio" name="enable_join" id="enable_join_no" value="N" checked="checked"|cond="$config->enable_join != 'Y' && empty($config->enable_join_key)" /> {$lang->cmd_no}</label>
<label class="x_inline" for="enable_join_only_with_key"><input type="radio" name="enable_join" id="enable_join_only_with_key" value="KEY" checked="checked"|cond="$config->enable_join != 'Y' && !empty($config->enable_join_key)" /> {$lang->enable_join_only_with_url_key}</label>
<input type="text" name="enable_join_key" id="enable_join_key" value="{$config->enable_join_key ?? ''}" placeholder="{$lang->enable_join_url_key}" style="display:none"|cond="empty($config->enable_join_key)" />
<p class="x_help-block">{$lang->about_enable_join}</p>
</div>
</div>
<div class="x_control-group">

View file

@ -1,4 +1,13 @@
jQuery(function($){
$('input[name=enable_join]').on('change', function() {
if ($('#enable_join_only_with_key').is(':checked')) {
$('#enable_join_key').show();
} else {
$('#enable_join_key').hide();
}
});
$('.__sync').click(function (){
exec_xml(
'importer', // module