Skip to content

Commit

Permalink
Merge pull request #107 from jdarwood007/login-ignore-convter-passwords
Browse files Browse the repository at this point in the history
Login should ignore converter passwords by default
  • Loading branch information
emanuele45 committed Aug 1, 2012
2 parents 0ff0d79 + 01e099f commit 7687ab0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Sources/LogInOut.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ function Login2()
$other_passwords = array();

// None of the below cases will be used most of the time (because the salt is normally set.)
if ($user_settings['password_salt'] == '')
if (!empty($modSettings['enable_password_conversion']) && $user_settings['password_salt'] == '')
{
// YaBB SE, Discus, MD5 (used a lot), SHA-1 (used some), SMF 1.0.x, IkonBoard, and none at all.
$other_passwords[] = crypt($_POST['passwrd'], substr($_POST['passwrd'], 0, 2));
Expand All @@ -323,7 +323,7 @@ function Login2()
$other_passwords[] = md5(crypt($_POST['passwrd'], 'CRYPT_MD5'));
}
// The hash should be 40 if it's SHA-1, so we're safe with more here too.
elseif (strlen($user_settings['passwd']) == 32)
elseif (!empty($modSettings['enable_password_conversion']) && strlen($user_settings['passwd']) == 32)
{
// vBulletin 3 style hashing? Let's welcome them with open arms \o/.
$other_passwords[] = md5(md5($_POST['passwrd']) . stripslashes($user_settings['password_salt']));
Expand All @@ -341,7 +341,8 @@ function Login2()
$other_passwords[] = sha1(strtolower($user_settings['member_name']) . un_htmlspecialchars($_POST['passwrd']));

// BurningBoard3 style of hashing.
$other_passwords[] = sha1($user_settings['password_salt'] . sha1($user_settings['password_salt'] . sha1($_POST['passwrd'])));
if (!empty($modSettings['enable_password_conversion']))
$other_passwords[] = sha1($user_settings['password_salt'] . sha1($user_settings['password_salt'] . sha1($_POST['passwrd'])));

// Perhaps we converted to UTF-8 and have a valid password being hashed differently.
if ($context['character_set'] == 'utf8' && !empty($modSettings['previousCharacterSet']) && $modSettings['previousCharacterSet'] != 'utf8')
Expand Down
1 change: 1 addition & 0 deletions Sources/ManageSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@ function ModifyGeneralSecuritySettings($return_config = false)
'',
// Password strength.
array('select', 'password_strength', array($txt['setting_password_strength_low'], $txt['setting_password_strength_medium'], $txt['setting_password_strength_high'])),
array('check', 'enable_password_conversion'),
'',
// Reporting of personal messages?
array('check', 'enableReportPM'),
Expand Down
1 change: 1 addition & 0 deletions Themes/default/languages/Help.english.php
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@
<li><strong>Medium:</strong> The password must be at least eight characters long, and can not be part of a users name or email address.</li>
<li><strong>High:</strong> As for medium, except the password must also contain a mixture of upper and lower case letters, and at least one number.</li>
</ul>';
$helptxt['enable_password_conversion'] = 'By enabling this setting, SMF will attempt to detect passwords stored in other formats and convert them to the format SMF uses. Typically this is used for forums converted to SMF, but may have other uses as well. Disabling this prevents a user from logging in using their password after a conversion and would need to reset their password.';

$helptxt['coppaAge'] = 'The value specified in this box will determine the minimum age that new members must be to be granted immediate access to the forums.
On registration they will be prompted to confirm whether they are over this age, and if not will either have their application rejected or suspended awaiting parental approval - dependant on the type of restriction chosen.
Expand Down
1 change: 1 addition & 0 deletions Themes/default/languages/ManageSettings.english.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
$txt['setting_password_strength_low'] = 'Low - 4 character minimum';
$txt['setting_password_strength_medium'] = 'Medium - cannot contain username';
$txt['setting_password_strength_high'] = 'High - mixture of different characters';
$txt['setting_enable_password_conversion'] = 'Allow password hash conversion';

$txt['antispam_Settings'] = 'Anti-Spam Verification';
$txt['antispam_Settings_desc'] = 'This section allows you to setup verification checks to ensure the user is a human (and not a bot), and tweak how and where these apply.';
Expand Down

0 comments on commit 7687ab0

Please sign in to comment.