From 5f5dc41a42404b6dc556ddbab14954ce9da0c33d Mon Sep 17 00:00:00 2001 From: CaMer0n Date: Fri, 6 Mar 2009 20:09:08 +0000 Subject: [PATCH] Added clearer Login options and labels (LANS). username/password, email/password and username or email/password. --- e107_admin/prefs.php | 99 ++++++++++--------- e107_handlers/login.php | 18 ++-- e107_languages/English/admin/lan_prefs.php | 19 ++-- e107_languages/English/lan_login.php | 9 +- e107_plugins/login_menu/languages/English.php | 8 +- .../login_menu/login_menu_shortcodes.php | 29 +++++- .../login_menu/login_menu_template.php | 10 +- e107_themes/templates/login_template.php | 6 +- login.php | 9 +- 9 files changed, 126 insertions(+), 81 deletions(-) diff --git a/e107_admin/prefs.php b/e107_admin/prefs.php index 1ab6825a0..fa2aea8d1 100644 --- a/e107_admin/prefs.php +++ b/e107_admin/prefs.php @@ -9,9 +9,9 @@ * Administration - Site Preferences * * $Source: /cvs_backup/e107_0.8/e107_admin/prefs.php,v $ - * $Revision: 1.28 $ - * $Date: 2009-03-02 21:55:27 $ - * $Author: e107steved $ + * $Revision: 1.29 $ + * $Date: 2009-03-06 20:09:08 $ + * $Author: e107coders $ * */ require_once ("../class2.php"); @@ -63,12 +63,14 @@ if(isset($_POST['updateprefs'])) $_POST['siteurl'] = trim($_POST['siteurl']) ? trim($_POST['siteurl']) : SITEURL; $_POST['siteurl'] = substr($_POST['siteurl'], - 1) == "/" ? $_POST['siteurl'] : $_POST['siteurl']."/"; - // If email verification, email address is required! - if($_POST['user_reg_veri'] == 1) + // If email verification or Email/Password Login Method - email address is required! + if($_POST['user_reg_veri'] == 1 && $_POST['allowEmailLogin'] == 1) + { $_POST['disable_emailcheck'] = 0; + } // Table of range checking values - min and max for numerics. Only do the important ones - $pref_limits = array('loginname_maxlength' => array('min' => 10, 'max' => 100, 'default' => 30), + $pref_limits = array('loginname_maxlength' => array('min' => 10, 'max' => 100, 'default' => 30), 'displayname_maxlength' => array('min' => 5, 'max' => 30, 'default' => 15), 'antiflood_timeout' => array('min' => 3, 'max' => 300, 'default' => 10), 'signup_pass_len' => array('min' => 2, 'max' => 100, 'default' => 4) @@ -469,33 +471,42 @@ $text .= "
".PRFLAN_30."
- - ".PRFLAN_141." - - ".$frm->radio_switch('xup_enabled', $pref['xup_enabled'])." - - + + ".PRFLAN_154." ".$frm->select_open('user_reg_veri'); + $veri_list = array(PRFLAN_152,PRFLAN_31,PRFLAN_153); -$veri_list[0] = PRFLAN_152; -$veri_list[1] = PRFLAN_31; -$veri_list[2] = PRFLAN_153; + foreach($veri_list as $v => $v_title) + { + $text .= $frm->option($v_title, $v, ($pref['user_reg_veri'] == $v)); + } -foreach($veri_list as $v => $v_title) -{ - $text .= " - ".$frm->option($v_title, $v, ($pref['user_reg_veri'] == $v))." - "; -} - -$text .= " + $text .= "
".PRFLAN_154a."
+ + ".PRFLAN_184." + ".$frm->select_open('allowEmailLogin'); + $login_list = array(PRFLAN_201,PRFLAN_202,PRFLAN_203); + foreach($login_list as $l => $l_title) + { + $text .= $frm->option($l_title, $l, ($pref['allowEmailLogin'] == $l)); + } + + $text .= " + + + + ".PRFLAN_141." + + ".$frm->radio_switch('xup_enabled', $pref['xup_enabled'])." + + ".PRFLAN_160." @@ -508,13 +519,7 @@ $text .= " ".$frm->radio_switch('disable_emailcheck', $pref['disable_emailcheck'])." - - ".PRFLAN_32." - - ".$frm->radio_switch('anon_post', $pref['anon_post'])." -
".PRFLAN_33."
- - + ".PRFLAN_45." @@ -529,6 +534,14 @@ $text .= "
".PRFLAN_59."
+ + ".PRFLAN_197.": + + ".$frm->radio_switch('autologinpostsignup', $pref['autologinpostsignup'])." +
".PRFLAN_198."
+ + + ".CUSTSIG_16." @@ -711,6 +724,7 @@ $text .= "
".PRFLAN_110."
+ ".PRFLAN_116.": @@ -854,13 +868,7 @@ $text .= " ".$frm->radio_switch('user_reg_secureveri', $pref['user_reg_secureveri'])." - - ".PRFLAN_197.": - - ".$frm->radio_switch('autologinpostsignup', $pref['autologinpostsignup'])." -
".PRFLAN_198."
- - + ".PRFLAN_129.": @@ -868,13 +876,7 @@ $text .= "
".PRFLAN_130."
- - ".PRFLAN_184.": - - ".$frm->radio_switch('allowEmailLogin', $pref['allowEmailLogin'], LAN_YES, LAN_NO)." -
".PRFLAN_185."
- - + ".PRFLAN_48.": @@ -917,6 +919,7 @@ $text .= "
".PRFLAN_41."
+ ".PRFLAN_42.": @@ -989,6 +992,13 @@ $text .= " + + ".PRFLAN_32." + + ".$frm->radio_switch('anon_post', $pref['anon_post'], LAN_YES, LAN_NO)." +
".PRFLAN_33."
+ + ".PRFLAN_89.": @@ -1019,6 +1029,7 @@ $text .= " ".$frm->radio_switch('comments_emoticons', $pref['comments_emoticons'], LAN_YES, LAN_NO)." + ".pref_submit('comments')." diff --git a/e107_handlers/login.php b/e107_handlers/login.php index c52a2f4d9..b189ed18d 100644 --- a/e107_handlers/login.php +++ b/e107_handlers/login.php @@ -12,9 +12,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_handlers/login.php,v $ -| $Revision: 1.21 $ -| $Date: 2009-01-17 21:42:54 $ -| $Author: e107steved $ +| $Revision: 1.22 $ +| $Date: 2009-03-06 20:09:08 $ +| $Author: e107coders $ +----------------------------------------------------------------------------+ */ @@ -117,9 +117,15 @@ class userlogin return $this->invalidLogin($username,LOGIN_BAD_USERNAME,$fip); } - $lookemail = !$forceLogin && varset($pref['allowEmailLogin'],0) && (strpos($username,'@') !== FALSE); // See if we look up against email or user name - // Look up user in DB - even if email addresses allowed, still look up by user name as well - user could have specified email address for their login name - if ($sql->db_Select('user', '*', "`user_loginname`= '".$tp -> toDB($username)."'".($lookemail ? " OR `user_email` = '".$tp -> toDB($username)."'" : '') ) !== 1) // Handle duplicate emails as well + + $qry[0] = "`user_loginname`= '".$tp -> toDB($username)."'"; // username only (default) + $qry[1] = "`user_email` = '".$tp -> toDB($username)."'"; // email only + $qry[2] = (strpos($username,'@') !== FALSE ) ? "`user_loginname`= '".$tp -> toDB($username)."' OR `user_email` = '".$tp -> toDB($username)."'" : $qry[0]; //username or email + // Look up user in DB - even if email addresses allowed, still look up by user name as well - user could have specified email address for their login name + + $query = (!$forceLogin && varset($pref['allowEmailLogin'],0)) ? $qry[$pref['allowEmailLogin']] : $qry[0]; + + if ($sql->db_Select('user', '*', $query) !== 1) // Handle duplicate emails as well { // Invalid user return $this->invalidLogin($username,LOGIN_BAD_USER,$fip); } diff --git a/e107_languages/English/admin/lan_prefs.php b/e107_languages/English/admin/lan_prefs.php index 245d66073..27fdd69e5 100644 --- a/e107_languages/English/admin/lan_prefs.php +++ b/e107_languages/English/admin/lan_prefs.php @@ -12,9 +12,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_prefs.php,v $ -| $Revision: 1.17 $ -| $Date: 2009-01-09 17:25:50 $ -| $Author: secretr $ +| $Revision: 1.18 $ +| $Date: 2009-03-06 20:09:08 $ +| $Author: e107coders $ +----------------------------------------------------------------------------+ */ @@ -36,14 +36,14 @@ define("PRFLAN_15", "Display render time?"); define("PRFLAN_16", "Display sql queries?"); define("PRFLAN_17", "Compress Site Output Using gzip"); define("PRFLAN_19", "Signup Page Options"); -define("PRFLAN_21", "Date display options"); +define("PRFLAN_21", "Date Display options"); define("PRFLAN_22", "Short date format"); define("PRFLAN_23", "Long date format"); define("PRFLAN_24", "Forum date format"); define("PRFLAN_25", "For more information on date formats see the"); define("PRFLAN_26", "Time offset"); define("PRFLAN_27", "Example, if you set this to +2, all times on your site will have two hours added to them"); -define("PRFLAN_28", "User registration/posting"); +define("PRFLAN_28", "User Registration/Login"); define("PRFLAN_29", "Activate user registration system?"); define("PRFLAN_30", "allow users to register as members on your site"); //define("PRFLAN_31", "Use email verification for signups?"); @@ -78,7 +78,7 @@ define("PRFLAN_78", "Leave blank to disable"); define("PRFLAN_80", "Click here to view"); define("PRFLAN_81", "Enable Image-code verification during login"); define("PRFLAN_83", "example"); -define("PRFLAN_87", "Comments"); +define("PRFLAN_87", "Comments/Posting"); define("PRFLAN_88", "Turn on nested comments"); define("PRFLAN_89", "Display new comment icon"); define("PRFLAN_90", "Allow posters to edit their comments"); @@ -109,7 +109,7 @@ define("PRFLAN_95", "Display plugins info:"); define("PRFLAN_96", "Will display info on all admin pages for each plugin supporting this type of feature"); define("PRFLAN_97", "Unique 'Plugins info' menu:"); define("PRFLAN_98", "If disabled, each plugin will display its own info in an individual menu. If enabled all info will be displayed in one menu."); -define("PRFLAN_101", "Text rendering"); +define("PRFLAN_101", "Text Rendering"); define("PRFLAN_102", "Replace clickable URLs"); define("PRFLAN_103", "If ticked, and 'Make Clickable' (above) is also ticked, posted URLs are displayed as a hyperlink using text from the textbox below. This keeps very long URLs from breaking layout."); define("PRFLAN_104", "URL replacement text"); @@ -192,7 +192,7 @@ define('PRFLAN_180', 'Plaintext'); define('PRFLAN_181', 'CHAP, plaintext fallback'); define('PRFLAN_182', 'CHAP only'); define('PRFLAN_183', ' CHAP requires JS enabled in user\'s browser'); -define('PRFLAN_184', 'Allow login by email address'); +define('PRFLAN_184', 'User login method'); define('PRFLAN_185', '(as well as login name)'); define('PRFLAN_186', 'Yes'); define('PRFLAN_187', 'No'); @@ -215,4 +215,7 @@ define('PRFLAN_196a', 'Log directory:'); define("PRFLAN_199", "Show Admin Sub-links"); define("PRFLAN_200", "If enabled, Admin slide down navigation menu (if supported by the current theme) will render sub-links when needed (e.g. News - Create news item)."); +define("PRFLAN_201", "Username and Password"); +define("PRFLAN_202", "Email and Password"); +define("PRFLAN_203", "Username/Email and Password"); ?> \ No newline at end of file diff --git a/e107_languages/English/lan_login.php b/e107_languages/English/lan_login.php index d7afedf37..9149dd7f4 100644 --- a/e107_languages/English/lan_login.php +++ b/e107_languages/English/lan_login.php @@ -4,9 +4,9 @@ | e107 website system - Language File. | | $Source: /cvs_backup/e107_0.8/e107_languages/English/lan_login.php,v $ -| $Revision: 1.3 $ -| $Date: 2008-06-13 20:20:22 $ -| $Author: e107steved $ +| $Revision: 1.4 $ +| $Date: 2009-03-06 20:09:08 $ +| $Author: e107coders $ +----------------------------------------------------------------------------+ */ define("LAN_LOGIN_1", "User name"); @@ -36,5 +36,6 @@ define("LAN_LOGIN_24", "That username/password combination is already in use."); define("LAN_LOGIN_25", "Banned user attempted to login"); define("LAN_LOGIN_26", "Login fail - reason unknown"); define('LAN_LOGIN_27', 'User attempted to log in before responding to confirmation email'); - +define('LAN_LOGIN_28', 'Email'); +define('LAN_LOGIN_29', 'Username or Email'); ?> \ No newline at end of file diff --git a/e107_plugins/login_menu/languages/English.php b/e107_plugins/login_menu/languages/English.php index ed0c156d3..a5f67a484 100644 --- a/e107_plugins/login_menu/languages/English.php +++ b/e107_plugins/login_menu/languages/English.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/login_menu/languages/English.php,v $ -| $Revision: 1.4 $ -| $Date: 2008-02-06 00:23:28 $ -| $Author: secretr $ +| $Revision: 1.5 $ +| $Date: 2009-03-06 20:09:08 $ +| $Author: e107coders $ +----------------------------------------------------------------------------+ */ @@ -75,5 +75,7 @@ define('LOGIN_MENU_L45b', 'plugin'); //post define('LOGIN_MENU_L46', 'recent items -'); define('LOGIN_MENU_L47', 'Login menu - Recent plugin additions'); define('LOGIN_MENU_L48', 'Menu Config'); +define('LOGIN_MENU_L49', 'Email: '); +define('LOGIN_MENU_L50', 'Username or Email: '); ?> \ No newline at end of file diff --git a/e107_plugins/login_menu/login_menu_shortcodes.php b/e107_plugins/login_menu/login_menu_shortcodes.php index bf9f8159a..90fafb498 100755 --- a/e107_plugins/login_menu/login_menu_shortcodes.php +++ b/e107_plugins/login_menu/login_menu_shortcodes.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/login_menu/login_menu_shortcodes.php,v $ -| $Revision: 1.6 $ -| $Date: 2008-06-13 20:20:22 $ -| $Author: e107steved $ +| $Revision: 1.7 $ +| $Date: 2009-03-06 20:09:08 $ +| $Author: e107coders $ +----------------------------------------------------------------------------+ */ if (!defined('e107_INIT')) { exit; } @@ -21,10 +21,24 @@ global $tp; $login_menu_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__); /* SC_BEGIN LM_USERNAME_INPUT -global $pref; -return "\n"; + global $pref; + return "\n"; SC_END +SC_BEGIN LM_USERNAME_LABEL + if($pref['allowEmailLogin']==1) + { + return LOGIN_MENU_L49; + } + + if($pref['allowEmailLogin']==2) + { + return LOGIN_MENU_L50; + } + return LOGIN_MENU_L1; +SC_END + + SC_BEGIN LM_PASSWORD_INPUT global $pref; $t_password = "\n"; @@ -32,6 +46,11 @@ if (!USER && isset($_SESSION['challenge']) && varset($pref['password_CHAP'],0)) return $t_password; SC_END +SC_BEGIN LM_PASSWORD_LABEL +return LOGIN_MENU_L2; +SC_END + + SC_BEGIN LM_IMAGECODE global $use_imagecode, $sec_img; //DEPRECATED - use LM_IMAGECODE_NUMBER, LM_IMAGECODE_BOX instead diff --git a/e107_plugins/login_menu/login_menu_template.php b/e107_plugins/login_menu/login_menu_template.php index ea4bb2b63..726b7a684 100644 --- a/e107_plugins/login_menu/login_menu_template.php +++ b/e107_plugins/login_menu/login_menu_template.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_plugins/login_menu/login_menu_template.php,v $ -| $Revision: 1.6 $ -| $Date: 2008-12-10 16:37:17 $ -| $Author: mcfly_e107 $ +| $Revision: 1.7 $ +| $Date: 2009-03-06 20:09:08 $ +| $Author: e107coders $ +----------------------------------------------------------------------------+ */ @@ -72,9 +72,9 @@ if (!isset($LOGIN_MENU_FORM)){ } $LOGIN_MENU_FORM .= " - ".LOGIN_MENU_L1."
+ {LM_USERNAME_LABEL}
{LM_USERNAME_INPUT}
- ".LOGIN_MENU_L2."
+ {LM_PASSWORD_LABEL}
{LM_PASSWORD_INPUT}
{LM_IMAGECODE_NUMBER}{LM_IMAGECODE_BOX} {LM_LOGINBUTTON} diff --git a/e107_themes/templates/login_template.php b/e107_themes/templates/login_template.php index 54b5a7f55..f62cc2e33 100644 --- a/e107_themes/templates/login_template.php +++ b/e107_themes/templates/login_template.php @@ -1,5 +1,5 @@ \n + "\n \n \n \n \n - \n + \n \n \n\n \n\n
".LAN_LOGIN_4."
".LAN_LOGIN_1."{LOGIN_USERNAME_LABEL}{LOGIN_TABLE_USERNAME}".(file_exists(THEME."images/password.png") ? "\n" : "\n" )."
".LAN_LOGIN_2."{LOGIN_TABLE_PASSWORD} diff --git a/login.php b/login.php index 1e50b1794..6df5cfe36 100644 --- a/login.php +++ b/login.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/login.php,v $ -| $Revision: 1.5 $ -| $Date: 2008-06-16 19:37:44 $ -| $Author: e107steved $ +| $Revision: 1.6 $ +| $Date: 2009-03-06 20:09:08 $ +| $Author: e107coders $ +----------------------------------------------------------------------------+ */ @@ -33,7 +33,10 @@ if (!USER) require_once(e_HANDLER."form_handler.php"); $rs = new form; $text = ""; + $allowEmailLogin = varset($pref['allowEmailLogin'],0); + $ulabel = array(LAN_LOGIN_1,LAN_LOGIN_28,LAN_LOGIN_29); + $LOGIN_USERNAME_LABEL = $ulabel[$allowEmailLogin]; $LOGIN_TABLE_LOGINMESSAGE = LOGINMESSAGE; $LOGIN_TABLE_USERNAME = ""; $LOGIN_TABLE_PASSWORD = "";