Fixed registration admin override with account_activation set to disable.
authorDan
Mon, 19 Apr 2010 18:07:43 -0400
changeset 1243 db42b7c50e57
parent 1242 9aa09b0a7544
child 1244 ba80cfffb673
child 1246 330f4de4c937
Fixed registration admin override with account_activation set to disable.
language/english/user.json
plugins/SpecialUserFuncs.php
--- a/language/english/user.json	Sat Apr 17 03:33:14 2010 -0400
+++ b/language/english/user.json	Mon Apr 19 18:07:43 2010 -0400
@@ -151,7 +151,7 @@
 			reg_err_captcha: 'The confirmation code you entered was incorrect.',
 			reg_err_disabled_title: 'Registration disabled',
 			reg_err_disabled_body: 'The administrator has disabled the registration of new accounts on this site.',
-			reg_err_disabled_body_adminblurb: 'Oops...it seems that you <em>are</em> the administrator...hehe...you can also <a href="%reg_link%">force account registration to work</a>.',
+			reg_msg_admin_forced: 'Registrations are disabled. You have been granted access to this page due to your administrator privileges.',
 			reg_err_username_invalid: 'Your username must be at least two characters in length and may not contain any of the following characters: &lt; &gt; _ &amp; ? \' " % / \\.',
 			// Not exactly an error
 			reg_err_password_good: 'The password you entered is valid.',
--- a/plugins/SpecialUserFuncs.php	Sat Apr 17 03:33:14 2010 -0400
+++ b/plugins/SpecialUserFuncs.php	Mon Apr 19 18:07:43 2010 -0400
@@ -549,6 +549,7 @@
 	global $db, $session, $paths, $template, $plugins; // Common objects
 	global $lang;
 	
+	// block registration except for guests and admins
 	if ( $session->user_level < USER_LEVEL_ADMIN && $session->user_logged_in )
 	{
 		$paths->main_page();
@@ -561,10 +562,9 @@
 	
 	$terms = getConfig('register_tou');
 	
-	if(getConfig('account_activation') == 'disable' && ( ( $session->user_level >= USER_LEVEL_ADMIN && !isset($_GET['IWannaPlayToo']) ) || $session->user_level < USER_LEVEL_ADMIN || !$session->user_logged_in ))
+	if ( getConfig('account_activation') == 'disable' && $session->user_level < USER_LEVEL_ADMIN )
 	{
-		$s = ($session->user_level >= USER_LEVEL_ADMIN) ? '<p>' . $lang->get('user_reg_err_disabled_body_adminblurb', array( 'reg_link' => makeUrl($paths->page, 'IWannaPlayToo&coppa=no', true) )) . '</p>' : '';
-		die_friendly($lang->get('user_reg_err_disabled_title'), '<p>' . $lang->get('user_reg_err_disabled_body') . '</p>' . $s);
+		die_friendly($lang->get('user_reg_err_disabled_title'), '<p>' . $lang->get('user_reg_err_disabled_body') . '</p>');
 	}
 	// are we locked out from logging in? if so, also lock out registration
 	if ( getConfig('lockout_policy') === 'lockout' )
@@ -588,8 +588,11 @@
 	{
 		$_GET['coppa'] = ( isset($_POST['coppa']) ) ? $_POST['coppa'] : 'x';
 		
-		$captcharesult = $session->get_captcha($_POST['captchahash']);
-		$session->kill_captcha();
+		if ( $session->user_level < USER_LEVEL_ADMIN )
+		{
+			$captcharesult = $session->get_captcha($_POST['captchahash']);
+			$session->kill_captcha();
+		}
 		// bypass captcha if logged in (at this point, if logged in, we're admin)
 		if ( !$session->user_logged_in && strtolower($captcharesult) != strtolower($_POST['captchacode']) )
 		{
@@ -683,6 +686,11 @@
 	$template->header();
 	echo $lang->get('user_reg_msg_greatercontrol');
 	
+	if ( getConfig('account_activation') == 'disable' && $session->user_level >= USER_LEVEL_ADMIN )
+	{
+		echo '<div class="info-box">' . $lang->get('user_reg_msg_admin_forced') . '</div>';
+	}
+	
 	if ( getConfig('enable_coppa') != '1' || ( isset($_GET['coppa']) && in_array($_GET['coppa'], array('yes', 'no')) ) )
 	{
 		$coppa = ( isset($_GET['coppa']) && $_GET['coppa'] == 'yes' );