Explorar o código

Merge pull request #986 from Arantor/release-2.1

Registrationy stuff
Arantor %!s(int64=11) %!d(string=hai) anos
pai
achega
709bd5d82f

+ 1 - 1
Sources/ManageRegistration.php

@@ -281,7 +281,7 @@ function ModifyRegistrationSettings($return_config = false)
 
 	$config_vars = array(
 			array('select', 'registration_method', array($txt['setting_registration_standard'], $txt['setting_registration_activate'], $txt['setting_registration_approval'], $txt['setting_registration_disabled'])),
-			array('check', 'enableOpenID'),
+			array('select', 'enableOpenID', array(0 => $txt['enableOpenID_disabled'], 1 => $txt['enableOpenID_enabled'], 2 => $txt['enableOpenID_enabled_login'])),
 			array('check', 'notify_new_registration'),
 			array('check', 'send_welcomeEmail'),
 		'',

+ 1 - 1
Sources/Profile.php

@@ -236,7 +236,7 @@ function ModifyProfile($post_errors = array())
 					'file' => 'Profile-Modify.php',
 					'function' => 'authentication',
 					'icon' => 'openid.png',
-					'enabled' => !empty($modSettings['enableOpenID']) || !empty($cur_profile['openid_uri']),
+					'enabled' => !empty($modSettings['enableOpenID']) && ($modSettings['enableOpenID'] == 1 || !empty($cur_profile['openid_uri'])),
 					'sc' => 'post',
 					'token' => 'profile-au%u',
 					'hidden' => empty($modSettings['enableOpenID']) && empty($cur_profile['openid_uri']),

+ 1 - 1
Themes/default/Profile.template.php

@@ -3130,7 +3130,7 @@ function template_authentication_method()
 				<div class="content">
 					<dl>
 						<dt>
-							<input type="radio" onclick="updateAuthMethod();" name="authenticate" value="openid" id="auth_openid"', $context['auth_method'] == 'openid' ? ' checked="checked"' : '', ' class="input_radio" /><label for="auth_openid"><strong>', $txt['authenticate_openid'], '</strong></label>&nbsp;<em><a href="', $scripturl, '?action=helpadmin;help=register_openid" onclick="return reqOverlayDiv(this.href);" class="help">(?)</a></em><br />
+							<input type="radio" onclick="updateAuthMethod();" name="authenticate" value="openid" id="auth_openid"', $context['auth_method'] == 'openid' ? ' checked="checked"' : '', ' class="input_radio" /><label for="auth_openid"><strong>', $txt['authenticate_openid'], '</strong></label>&nbsp;<em><a href="', $scripturl, '?action=helpadmin;help=register_openid" onclick="return reqOverlayDiv(this.href);" class="help"><img class="icon" src="', $settings['images_url'], '/helptopics.png" alt="', $txt['help'], '" /></a></em><br />
 							<input type="radio" onclick="updateAuthMethod();" name="authenticate" value="passwd" id="auth_pass"', $context['auth_method'] == 'password' ? ' checked="checked"' : '', ' class="input_radio" /><label for="auth_pass"><strong>', $txt['authenticate_password'], '</strong></label>
 						</dt>
 						<dd>

+ 2 - 2
Themes/default/Register.template.php

@@ -116,7 +116,7 @@ function template_registration_form()
 					</dl>';
 
 	// If OpenID is enabled, give the user a choice between password and OpenID.
-	if (!empty($modSettings['enableOpenID']))
+	if (!empty($modSettings['enableOpenID']) && $modSettings['enableOpenID'] != 2)
 	{
 		echo '
 					<dl class="register_form" id="authentication_group">
@@ -158,7 +158,7 @@ function template_registration_form()
 					</dl>';
 
 	// If OpenID is enabled, give the user a choice between password and OpenID.
-	if (!empty($modSettings['enableOpenID']))
+	if (!empty($modSettings['enableOpenID']) && $modSettings['enableOpenID'] != 2)
 	{
 		echo '
 

+ 3 - 0
Themes/default/languages/Login.english.php

@@ -79,6 +79,9 @@ $txt['approval_after_registration'] = 'Thank you for registering. The admin must
 $txt['admin_settings_desc'] = 'Here you can change a variety of settings related to registration of new members.';
 
 $txt['setting_enableOpenID'] = 'Allow users to register using OpenID';
+$txt['enableOpenID_disabled'] = 'No, disable all OpenID use';
+$txt['enableOpenID_enabled'] = 'Enable OpenID for registrations and logins';
+$txt['enableOpenID_enabled_login'] = 'Enable OpenID only for existing users, but not new registrations';
 
 $txt['setting_registration_method'] = 'Method of registration employed for new members';
 $txt['setting_registration_disabled'] = 'Registration Disabled';

+ 11 - 13
Themes/default/scripts/register.js

@@ -277,9 +277,9 @@ function updateAuthMethod()
 	if (!document.getElementById('auth_openid'))
 		return true;
 
-	document.forms.registration.openid_url.disabled = currentAuthMethod == 'openid' ? false : true;
-	document.forms.registration.smf_autov_pwmain.disabled = currentAuthMethod == 'passwd' ? false : true;
-	document.forms.registration.smf_autov_pwverify.disabled = currentAuthMethod == 'passwd' ? false : true;
+	document.getElementById('openid_url').disabled = currentAuthMethod == 'openid' ? false : true;
+	document.getElementById('smf_autov_pwmain_div').disabled = currentAuthMethod == 'passwd' ? false : true;
+	document.getElementById('smf_autov_pwverify_div').disabled = currentAuthMethod == 'passwd' ? false : true;
 	document.getElementById('smf_autov_pwmain_div').style.display = currentAuthMethod == 'passwd' ? '' : 'none';
 	document.getElementById('smf_autov_pwverify_div').style.display = currentAuthMethod == 'passwd' ? '' : 'none';
 
@@ -287,19 +287,17 @@ function updateAuthMethod()
 	{
 		verificationHandle.refreshMainPassword();
 		verificationHandle.refreshVerifyPassword();
-		document.forms.registration.openid_url.style.backgroundColor = '';
-		document.getElementById('password1_group').style.display = '';
-		document.getElementById('password2_group').style.display = '';
-		document.getElementById('openid_group').style.display = 'none';
+		document.getElementById('openid_url').style.backgroundColor = '';
+		document.getElementById('auth_pass_div').style.display = '';
+		document.getElementById('auth_openid_div').style.display = 'none';
 	}
 	else
 	{
-		document.forms.registration.smf_autov_pwmain.style.backgroundColor = '';
-		document.forms.registration.smf_autov_pwverify.style.backgroundColor = '';
-		document.forms.registration.openid_url.style.backgroundColor = '#FFF0F0';
-		document.getElementById('password1_group').style.display = 'none';
-		document.getElementById('password2_group').style.display = 'none';
-		document.getElementById('openid_group').style.display = '';
+		document.getElementById('smf_autov_pwmain').style.backgroundColor = '';
+		document.getElementById('smf_autov_pwverify').style.backgroundColor = '';
+		document.getElementById('openid_url').style.backgroundColor = '#FFF0F0';
+		document.getElementById('auth_pass_div').style.display = 'none';
+		document.getElementById('auth_openid_div').style.display = '';
 	}
 
 	return true;