Force change at next login fixes

https://sourceforge.net/tracker/?func=detail&aid=3415467&group_id=17457&atid=367457
This commit is contained in:
Jamie Cameron
2011-09-30 13:10:29 -07:00
parent 88ee8788af
commit 67044202e9
4 changed files with 34 additions and 6 deletions

View File

@ -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

View File

@ -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));

View File

@ -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();
}

View File

@ -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 {