mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-14 10:37:30 -07:00
parent
491c03c243
commit
728a40408f
4 changed files with 45 additions and 0 deletions
|
@ -378,6 +378,18 @@ $bb_cfg['unique_ip'] = false; // Disallow registration from multiple IP addresse
|
|||
$bb_cfg['new_user_reg_restricted'] = false; // Disallow registration in below hours
|
||||
$bb_cfg['new_user_reg_interval'] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]; // Available hours
|
||||
$bb_cfg['reg_email_activation'] = true; // Demand to activate profile by email confirmation
|
||||
// Invites
|
||||
$bb_cfg['invite_only'] = true;
|
||||
// Invite codes
|
||||
// Syntax: 'invite_code' => 'validity_period'
|
||||
// The 'validity_period' value is based on strtotime() function: https://www.php.net/manual/en/function.strtotime.php
|
||||
// Invite link example: site_url/profile.php?mode=register&invite=new_year
|
||||
$bb_cfg['invite_codes'] = [
|
||||
'new_year' => '+1 month',
|
||||
'ein_volk' => '29 July 1936',
|
||||
'catch_up_overtake' => '1917-10-09'
|
||||
];
|
||||
|
||||
$bb_cfg['password_symbols'] = [
|
||||
// Whay symbols should be required in the password
|
||||
'nums' => true, // Numeric
|
||||
|
|
|
@ -71,6 +71,7 @@ switch ($mode) {
|
|||
'username' => true,
|
||||
'user_password' => true,
|
||||
'user_email' => true,
|
||||
'invite_code' => true,
|
||||
'user_timezone' => true,
|
||||
'user_lang' => true,
|
||||
'user_opt' => true
|
||||
|
@ -81,6 +82,7 @@ switch ($mode) {
|
|||
'username' => '',
|
||||
'user_password' => '',
|
||||
'user_email' => '',
|
||||
'invite_code' => '',
|
||||
'user_timezone' => $bb_cfg['board_timezone'],
|
||||
'user_lang' => $bb_cfg['default_lang'],
|
||||
'user_opt' => 0,
|
||||
|
@ -197,6 +199,25 @@ foreach ($profile_fields as $field => $can_edit) {
|
|||
$tp_data['USERNAME'] = $pr_data['username'];
|
||||
break;
|
||||
|
||||
/**
|
||||
* Invite code (reg)
|
||||
*/
|
||||
case 'invite_code':
|
||||
if ($bb_cfg['invite_only']) {
|
||||
$invite_code = $_POST['invite_code'] ?? '';
|
||||
if ($submit) {
|
||||
if (isset($bb_cfg['invite_codes'][$invite_code])) {
|
||||
if (TIMENOW > strtotime($bb_cfg['invite_codes'][$invite_code])) {
|
||||
$errors[] = $lang['INVITE_EXPIRED'];
|
||||
}
|
||||
}
|
||||
else {
|
||||
$errors[] = $lang['INCORRECT_INVITE'];
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
/**
|
||||
* Пароль (edit, reg)
|
||||
*/
|
||||
|
@ -660,6 +681,7 @@ $template->assign_vars([
|
|||
'ADM_EDIT' => $adm_edit,
|
||||
'SHOW_PASS' => ($adm_edit || ($mode == 'register' && IS_ADMIN)),
|
||||
'PASSWORD_LONG' => sprintf($lang['PASSWORD_LONG'], PASSWORD_MAX_LENGTH, PASSWORD_MIN_LENGTH),
|
||||
'INVITE_CODE' => !empty($_GET['invite']) ? htmlCHR($_GET['invite']) : '',
|
||||
'CAPTCHA_HTML' => ($need_captcha) ? bb_captcha('get') : '',
|
||||
|
||||
'LANGUAGE_SELECT' => \TorrentPier\Legacy\Select::language($pr_data['user_lang'], 'user_lang'),
|
||||
|
|
|
@ -688,6 +688,11 @@ $lang['LIKE_OWN_POST'] = 'You can\'t vote for your own topic';
|
|||
$lang['NO_LIKES'] = 'Nobody gave a vote yet';
|
||||
$lang['LIKE_ALREADY'] = 'You already voted this topic';
|
||||
|
||||
// Invites
|
||||
$lang['INVITE_CODE'] = 'Invite code';
|
||||
$lang['INCORRECT_INVITE'] = 'Invite not found';
|
||||
$lang['INVITE_EXPIRED'] = 'Invite expired';
|
||||
|
||||
// Group control panel
|
||||
$lang['GROUP_CONTROL_PANEL'] = 'User Groups';
|
||||
$lang['GROUP_CONFIGURATION'] = 'Group Configuration';
|
||||
|
|
|
@ -95,6 +95,12 @@
|
|||
<input id="pass_confirm" onBlur="ajax.exec({ action: 'user_register', mode: 'check_pass', pass: $('#pass').val(), pass_confirm: $('#pass_confirm').val() }); return false;" type="<!-- IF SHOW_PASS -->text<!-- ELSE -->password<!-- ENDIF -->" name="cfm_pass" size="35" maxlength="32" value=""/> <span id="check_pass"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- IF $bb_cfg['invite_only'] and not EDIT_PROFILE -->
|
||||
<tr>
|
||||
<td class="prof-title">{L_INVITE_CODE}: *</td>
|
||||
<td><input type="text" name="invite_code" size="35" value="{INVITE_CODE}"/></td>
|
||||
</tr>
|
||||
<!-- ENDIF -->
|
||||
<!-- IF CAPTCHA_HTML -->
|
||||
<tr>
|
||||
<td class="prof-title">{L_CAPTCHA}: *</td>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue