浏览代码

Add an alert box when someone changes their email and $modSettings['send_validation_onChange'] is set

Signed-off-by: Suki <[email protected]>
Suki 10 年之前
父节点
当前提交
cdd823d853
共有 3 个文件被更改,包括 8 次插入1 次删除
  1. 6 0
      Sources/Profile-Modify.php
  2. 1 1
      Themes/default/Profile.template.php
  3. 1 0
      Themes/default/languages/Profile.english.php

+ 6 - 0
Sources/Profile-Modify.php

@@ -181,6 +181,12 @@ function loadProfileFields($force_reload = false)
 			'subtext' => $txt['valid_email'],
 			'log_change' => true,
 			'permission' => 'profile_password',
+			'js_submit' => !empty($modSettings['send_validation_onChange']) ? '
+				if (document.forms.creator.email_address.value != "'. $cur_profile['email_address'] .'")
+				{
+					alert("'. $txt['email_change_logout'] .'");
+					return true;
+				}' : '',
 			'input_validate' => create_function('&$value', '
 				global $context, $old_profile, $profile_vars, $sourcedir, $modSettings;
 

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

@@ -1493,7 +1493,7 @@ function template_edit_options()
 	// Any onsubmit javascript?
 	if (!empty($context['profile_onsubmit_javascript']))
 		echo '
-				', $context['profile_javascript'];
+				', $context['profile_onsubmit_javascript'];
 
 	echo '
 			}';

+ 1 - 0
Themes/default/languages/Profile.english.php

@@ -61,6 +61,7 @@ $txt['invalid_registration'] = 'Invalid Date Registered value, valid example:';
 $txt['current_password'] = 'Current Password';
 // Don't use entities in the below string, except the main ones. (lt, gt, quot.)
 $txt['required_security_reasons'] = 'For security reasons, your current password is required to make changes to your account.';
+$txt['email_change_logout'] = 'You decided to change your email. You will be logged out. Please reactivate your account.';
 
 $txt['timeoffset_autodetect'] = 'auto detect';