]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14679 towards authlib conversion
authorskodak <skodak>
Fri, 30 May 2008 20:54:19 +0000 (20:54 +0000)
committerskodak <skodak>
Fri, 30 May 2008 20:54:19 +0000 (20:54 +0000)
auth/db/auth.php
auth/ldap/auth.php
lib/moodlelib.php

index d30db00ef70dcea777f8ceb462b1b6f1dbbf9eff..6797126fc4c01c7349097f440f01e572c262f5f1 100644 (file)
@@ -38,18 +38,17 @@ class auth_plugin_db extends auth_plugin_base {
      * 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();
 
@@ -70,7 +69,7 @@ class auth_plugin_db extends auth_plugin_base {
                 $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 {
index 17655eccd4c4df2bbc9d96c5bb11a70f9cf8f2a4..247c1bb691f1a0c6c853d0775f68289ff83dc6a1 100644 (file)
@@ -86,8 +86,8 @@ class auth_plugin_ldap extends auth_plugin_base {
         }
 
         $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
index 78a11ca358919417668f67d4e03aeaff778c5389..60a4cf97418579c19b7a4156567eb94a40aebc18 100644 (file)
@@ -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) {