Index: moodle/admin/uploaduser.php
--- moodle/admin/uploaduser.php Base (1.108)
+++ moodle/admin/uploaduser.php Locally Modified (Based On 1.108)
@@ -211,23 +211,12 @@
         foreach ($line as $key => $value) {
             if ($value !== '') {
                 $key = $columns[$key];                
-                // password is special field
-                if ($key == 'password') {
-                    if ($value !== '') {
-                        $user->password = hash_internal_user_password($value);
-                        if (!empty($CFG->passwordpolicy) and !check_password_policy($value, $errmsg)) {
-                            $forcechangepassword = true;
-                            $weakpasswords++;
-                        }
-                    }
-                } else {
                     $user->$key = $value;
                     if (in_array($key, $upt->columns)) {
                         $upt->track($key, $value);
                     }
                 }
             }
-        }
 
         // get username, first/last name now - we need them in templates!!
         if ($optype == UU_UPDATE) {
@@ -560,12 +549,25 @@
                 $upt->track('status', $struseradded);
                 $upt->track('id', $user->id, 'normal', false);
                 $usersnew++;
-                if ($createpasswords and empty($user->password)) {
-                    // passwords will be created and sent out on cron
-                    set_user_preference('create_password', 1, $user->id);
-                    set_user_preference('auth_forcepasswordchange', 1, $user->id);
-                    $upt->track('password', get_string('new'));
+                
+                //re-set password if necessary
+                if (empty($user->password)){
+                    $user->password = '';
                 }
+                if (empty($user->auth)){
+                    $user->auth = 'manual';
+                }
+                $authplugin = get_auth_plugin($user->auth);
+                if ($authplugin->prevent_local_passwords()) { // external authentication
+                    $forcechangepassword = false;
+                } else {  // internal authentication
+                    if (!empty($CFG->passwordpolicy) && !check_password_policy($user->password, $errmsg)) {
+                        $forcechangepassword = true;
+                        $weakpasswords++;
+                    }                                                            
+                }
+                update_internal_user_password($user, $user->password);
+                                
                 if ($forcechangepassword) {
                     set_user_preference('auth_forcepasswordchange', 1, $user->id);
                 }
@@ -786,6 +788,23 @@
         }
     }
 
+    //check password column    
+    if (array_key_exists('auth', $rowcols)) {
+        if (!empty($rowcols['auth']) && $rowcols['auth'] != 'manual'  && $rowcols['auth'] != 'email') {
+            if (array_key_exists('password', $rowcols) && !empty($rowcols['password'])) {
+                $errormsg['password'] = get_string('externalauthpassworderror');
+            }
+        } else { 
+            if (array_key_exists('password', $rowcols) && empty($rowcols['password'])) {
+                $errormsg['password'] = get_string('missingpassword');
+            }
+        }
+    }
+    
+    if (empty($optype) ) {
+        $optype = $uploadtype;
+    }
+    
     switch($optype) {
         case UU_ADDNEW:
             if ($usernameexist || $emailexist ) {
Index: moodle/admin/uploaduser_form.php
--- moodle/admin/uploaduser_form.php Base (1.17)
+++ moodle/admin/uploaduser_form.php Locally Modified (Based On 1.17)
@@ -62,7 +62,7 @@
 
         $choices = array(0 => get_string('infilefield', 'auth'), 1 => get_string('createpasswordifneeded', 'auth'));
         $mform->addElement('select', 'uupasswordnew', get_string('uupasswordnew', 'admin'), $choices);
-        $mform->setDefault('uupasswordnew', 0);
+        $mform->setDefault('uupasswordnew', 1);
         $mform->disabledIf('uupasswordnew', 'uutype', 'eq', UU_UPDATE);
 
         $choices = array(0 => get_string('nochanges', 'admin'),
@@ -305,6 +305,10 @@
                     break;
 
                 case UU_ADDNEW:
+                    if (empty($data['uupasswordnew'])) {
+                        $errors['uupasswordnew'] = get_string('missingfield', 'error', 'password');
+                    }
+                    break;
                 case UU_ADDINC:
                     if (empty($data['uupasswordnew'])) {
                         $errors['uupasswordnew'] = get_string('missingfield', 'error', 'password');

Index: moodle/lang/en_utf8/moodle.php
--- moodle/lang/en_utf8/moodle.php Base (1.280)
+++ moodle/lang/en_utf8/moodle.php Locally Modified (Based On 1.280)
@@ -1830,4 +1830,5 @@
 $string['requestedcourses'] = 'Requested courses';
 $string['addcountertousername'] = 'Create user by adding number to username';
 $string['uploadfilecontentsnovaliddata'] = 'The uploaded file contains no valid data.';
+$string['externalauthpassworderror'] = 'Non-empty password for external authentication';
 ?>
