Commit 0c75d7a7 authored by Christopher Tombleson's avatar Christopher Tombleson
Browse files

Fixing login issue (Bug #1030826)



If possible use mb_strtolower rather than strtolower as it
might not convert UTF-8 characters properly.

Change-Id: I91a78e74b9154362d1c631db24a6d5e5ddeccb14
Signed-off-by: default avatarChristopher Tombleson <christopher@catalyst.net.nz>
parent bd45e121
......@@ -1215,7 +1215,13 @@ class LiveUser extends User {
{usr}
WHERE
LOWER(username) = ?';
$user = get_record_sql($sql, array(strtolower($username)));
if (function_exists('mb_strtolower')) {
$user = get_record_sql($sql, array(mb_strtolower($username, 'UTF-8')));
}
else {
$user = get_record_sql($sql, array(strtolower($username)));
}
if ($user == false) {
throw new AuthUnknownUserException("\"$username\" is not known");
......
......@@ -72,6 +72,7 @@ $string['dbnotutf8'] = 'You are not using a UTF-8 database. Mahara stores all da
$string['dbversioncheckfailed'] = 'Your database server version is not new enough to successfully run Mahara. Your server is %s %s, but Mahara requires at least version %s.';
$string['plpgsqlnotavailable'] = 'The PL/pgSQL language is not enabled in your Postgres installation, and Mahara cannot enable it. Please install PL/pgSQL in your database manually. For instructions on how to do this, see https://wiki.mahara.org/index.php/System_Administrator\'s_Guide/Enabling_Plpgsql';
$string['mysqlnotriggerprivilege'] = 'Mahara requires permission to create database triggers, but is unable to do so. Please ensure that the trigger privilege has been granted to the appropriate user in your MySQL installation. For instructions on how to do this, see https://wiki.mahara.org/index.php/System_Administrator\'s_Guide/Granting_Trigger_Privilege';
$string['mbstringneeded'] = 'Please install the mbstring extension for php. This is needed if you have UTF-8 characters in usernames, otherwise users might not be able to login.';
// general exception error messages
$string['blocktypenametaken'] = "Block type %s is already taken by another plugin (%s)";
......
......@@ -1295,5 +1295,9 @@ function site_warnings() {
$warnings[] = get_string('passwordsaltweak', 'error');
}
if (!extension_loaded('mbstring')) {
$warnings[] = get_string('mbstringneeded', 'error');
}
return $warnings;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment