Skip to content

Commit

Permalink
MDL-14679 towards authlib conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed May 30, 2008
1 parent bdd3e83 commit 576c063
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
13 changes: 6 additions & 7 deletions auth/db/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,17 @@ function auth_plugin_db() {
* Returns true if the username and password work and false if they are
* wrong or don't exist.
*
* @param string $username The username (with system magic quotes)
* @param string $password The password (with system magic quotes)
* @param string $username The username
* @param string $password The password
*
* @return bool Authentication success or failure.
*/
function user_login($username, $password) {

global $CFG;
global $CFG, $DB;

$textlib = textlib_get_instance();
$extusername = $textlib->convert(stripslashes($username), 'utf-8', $this->config->extencoding);
$extpassword = $textlib->convert(stripslashes($password), 'utf-8', $this->config->extencoding);
$extusername = $textlib->convert($username, 'utf-8', $this->config->extencoding);
$extpassword = $textlib->convert($password, 'utf-8', $this->config->extencoding);

$authdb = $this->db_init();

Expand All @@ -70,7 +69,7 @@ function user_login($username, $password) {
$authdb->Close();
// user exists exterally
// check username/password internally
if ($user = get_record('user', 'username', $username, 'mnethostid', $CFG->mnet_localhost_id)) {
if ($user = $DB->get_record('user', array('username'=>$username, 'mnethostid'=>$CFG->mnet_localhost_id))) {
return validate_internal_user_password($user, $password);
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions auth/ldap/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ function user_login($username, $password) {
}

$textlib = textlib_get_instance();
$extusername = $textlib->convert(stripslashes($username), 'utf-8', $this->config->ldapencoding);
$extpassword = $textlib->convert(stripslashes($password), 'utf-8', $this->config->ldapencoding);
$extusername = $textlib->convert($username, 'utf-8', $this->config->ldapencoding);
$extpassword = $textlib->convert($password, 'utf-8', $this->config->ldapencoding);

//
// Before we connect to LDAP, check if this is an AD SSO login
Expand Down
4 changes: 2 additions & 2 deletions lib/moodlelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -3012,8 +3012,8 @@ function guest_user() {
* the session up.
*
* @uses $CFG
* @param string $username User's username (with system magic quotes)
* @param string $password User's password (with system magic quotes)
* @param string $username User's username
* @param string $password User's password
* @return user|flase A {@link $USER} object or false if error
*/
function authenticate_user_login($username, $password) {
Expand Down

0 comments on commit 576c063

Please sign in to comment.