Force change at next login fixes
authorJamie Cameron <jcameron@webmin.com>
Fri, 30 Sep 2011 20:10:29 +0000 (13:10 -0700)
committerJamie Cameron <jcameron@webmin.com>
Fri, 30 Sep 2011 20:10:29 +0000 (13:10 -0700)
https://sourceforge.net/tracker/?func=detail&aid=3415467&group_id=17457&atid=367457

ldap-useradmin/batch_exec.cgi
ldap-useradmin/batch_form.cgi
ldap-useradmin/edit_user.cgi
ldap-useradmin/save_user.cgi

index 03bacac..c3c9606 100755 (executable)
@@ -61,8 +61,14 @@ LINE: foreach $line (split(/[\r\n]+/, $data)) {
                        $user{'warn'} = $line[10];
                        $user{'inactive'} = $line[11];
                        $user{'expire'} = $line[12];
-                       $user{'change'} = $line[2] eq '' ? '' :
+                       &webmin_debug_log('ldap-batch',"going to set shadow last change");
+                       if ($in{'forcechange'} == 1){
+                           $user{'change'} = 0;
+                       } else {
+                           $user{'change'} = $line[2] eq '' ? '' :
                                                int(time() / (60*60*24));
+                       }
+                       &webmin_debug_log('ldap-batch',"finished to set change");
                        @attrs = @line[13 .. $#line];
                        }
                else {
@@ -422,8 +428,11 @@ LINE: foreach $line (split(/[\r\n]+/, $data)) {
                        $user{'inactive'}=$line[12]
                                if ($line[12] ne '');
                        $user{'expire'}=$line[13] if ($line[13] ne '');
-                       $user{'change'}=int(time() / (60*60*24))
-                               if ($line[3] ne '');
+                       if ($in{'forcechange'} == 1){
+                           $user{'change'} = 0;
+                       } elsif ($line[3] ne ''){
+                           $user{'change'}= int(time() / (60*60*24));
+                           }
                        }
 
                # Work out Samba properties
index 8a46cf5..de01fa8 100755 (executable)
@@ -70,6 +70,10 @@ print &ui_table_row($text{'batch_delhome'},
 print &ui_table_row($text{'batch_crypt'},
         &ui_yesno_radio("crypt", 0));
 
+#Force change password at next login
+print &ui_table_row($text{'uedit_forcechange'},
+        &ui_yesno_radio("forcechange", 0));
+
 # Create Samba account
 print &ui_table_row($text{'batch_samba'},
        &ui_yesno_radio("samba", $config{'samba_def'} ? 1 : 0));
index b73d001..8d4825d 100755 (executable)
@@ -259,6 +259,12 @@ if (&in_schema($schema, "shadowLastChange")) {
                 &ui_textbox("inactive", $in{'new'} ?$mconfig{'default_inactive'}
                                                   : $inactive, 5));
 
+       # Force password change at next login
+       print &ui_table_row(
+               $text{'uedit_forcechange'},
+                       &ui_yesno_radio("forcechange", 0));
+
+
        print &ui_table_end();
        }
 
index 1010839..4ec39b4 100755 (executable)
@@ -863,11 +863,20 @@ if (&in_schema($schema, "shadowLastChange")) {
        else {
                push(@rprops, "shadowInactive");
                }
-       if ($in{'passmode'} == 3 ||
-           $in{'passmode'} == 2 && $pass ne $oldpass) {
+       if ($in{'forcechange'} == 1){
+           if ($in{'passmode'} != 1) {
+               push(@props, "shadowLastChange", 0);
+           }
+       } else {
+           if ($in{'passmode'} == 3 ||
+               $in{'passmode'} == 2 && $pass ne $oldpass) {
+       
                $daynow = int(time() / (60*60*24));
                push(@props, "shadowLastChange", $daynow);
-               }
+           }
+
+        }
+       
        return 1;
        }
 else {