version 1.199, 2019/05/06 19:28:17
|
version 1.200, 2019/05/11 21:34:01
|
Line 750 sub passwd_validation_js {
|
Line 750 sub passwd_validation_js {
|
} |
} |
if ($rules{'spec'}) { |
if ($rules{'spec'}) { |
$intargjs .= q| |
$intargjs .= q| |
var specRegExp = /[!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{\|}~]/; |
var specRegExp = /[!"#$%&'()*+,\-.\/:;<=>?@[\\^\]_`{\|}~]/; |
if (!specRegExp.test(currpwval)) { |
if (!specRegExp.test(currpwval)) { |
brokerules.push('spec'); |
brokerules.push('spec'); |
} |
} |
Line 4377 sub upfile_drop_add {
|
Line 4377 sub upfile_drop_add {
|
} |
} |
my $amode = ''; |
my $amode = ''; |
my $genpwd = ''; |
my $genpwd = ''; |
|
my @genpwdfail; |
if ($env{'form.login'} eq 'krb') { |
if ($env{'form.login'} eq 'krb') { |
$amode='krb'; |
$amode='krb'; |
$amode.=$env{'form.krbver'}; |
$amode.=$env{'form.krbver'}; |
Line 4385 sub upfile_drop_add {
|
Line 4386 sub upfile_drop_add {
|
$amode='internal'; |
$amode='internal'; |
if ((defined($env{'form.intarg'})) && ($env{'form.intarg'})) { |
if ((defined($env{'form.intarg'})) && ($env{'form.intarg'})) { |
$genpwd=$env{'form.intarg'}; |
$genpwd=$env{'form.intarg'}; |
|
@genpwdfail = |
|
&Apache::loncommon::check_passwd_rules($domain,$genpwd); |
} |
} |
} elsif ($env{'form.login'} eq 'loc') { |
} elsif ($env{'form.login'} eq 'loc') { |
$amode='localauth'; |
$amode='localauth'; |
Line 4465 sub upfile_drop_add {
|
Line 4468 sub upfile_drop_add {
|
\@statuses,\@poss_roles); |
\@statuses,\@poss_roles); |
&gather_userinfo($context,'view',\%userlist,$indexhash,\%info, |
&gather_userinfo($context,'view',\%userlist,$indexhash,\%info, |
\%cstr_roles,$permission); |
\%cstr_roles,$permission); |
|
|
} |
} |
} |
} |
} |
} |
Line 4543 sub upfile_drop_add {
|
Line 4545 sub upfile_drop_add {
|
my $newuserdom = $env{'request.role.domain'}; |
my $newuserdom = $env{'request.role.domain'}; |
map { $cancreate{$_} = &can_create_user($newuserdom,$context,$_); } keys(%longtypes); |
map { $cancreate{$_} = &can_create_user($newuserdom,$context,$_); } keys(%longtypes); |
# Get new users list |
# Get new users list |
my (%existinguser,%userinfo,%disallow,%rulematch,%inst_results,%alerts,%checkuname); |
my (%existinguser,%userinfo,%disallow,%rulematch,%inst_results,%alerts,%checkuname, |
|
%showpasswdrules,$haspasswdmap); |
my $counter = -1; |
my $counter = -1; |
my (%willtrust,%trustchecked); |
my (%willtrust,%trustchecked); |
foreach my $line (@userdata) { |
foreach my $line (@userdata) { |
Line 4694 sub upfile_drop_add {
|
Line 4697 sub upfile_drop_add {
|
} |
} |
} |
} |
# determine user password |
# determine user password |
my $password = $genpwd; |
my $password; |
|
my $passwdfromfile; |
if (defined($fields{'ipwd'})) { |
if (defined($fields{'ipwd'})) { |
if ($entries{$fields{'ipwd'}}) { |
if ($entries{$fields{'ipwd'}}) { |
$password=$entries{$fields{'ipwd'}}; |
$password=$entries{$fields{'ipwd'}}; |
|
$passwdfromfile = 1; |
|
if ($env{'form.login'} eq 'int') { |
|
my $uhome=&Apache::lonnet::homeserver($username,$userdomain); |
|
if (($uhome eq 'no_host') || ($changeauth)) { |
|
my @brokepwdrules = |
|
&Apache::loncommon::check_passwd_rules($domain,$password); |
|
if (@brokepwdrules) { |
|
$disallow{$counter} = &mt('[_1]: Password included in file for this user did not meet requirements.', |
|
'<b>'.$username.'</b>'); |
|
map { $showpasswdrules{$_} = 1; } @brokepwdrules; |
|
next; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
unless ($passwdfromfile) { |
|
if ($env{'form.login'} eq 'int') { |
|
if (@genpwdfail) { |
|
my $uhome=&Apache::lonnet::homeserver($username,$userdomain); |
|
if (($uhome eq 'no_host') || ($changeauth)) { |
|
$disallow{$counter} = &mt('[_1]: No specific password in file for this user; default password did not meet requirements', |
|
'<b>'.$username.'</b>'); |
|
unless ($haspasswdmap) { |
|
map { $showpasswdrules{$_} = 1; } @genpwdfail; |
|
$haspasswdmap = 1; |
|
} |
|
} |
|
next; |
|
} |
} |
} |
|
$password = $genpwd; |
} |
} |
# determine user role |
# determine user role |
my $role = ''; |
my $role = ''; |
Line 5061 sub upfile_drop_add {
|
Line 5096 sub upfile_drop_add {
|
$counts{'auth'})."</p>\n"); |
$counts{'auth'})."</p>\n"); |
} |
} |
$r->print(&print_namespacing_alerts($domain,\%alerts,\%curr_rules)); |
$r->print(&print_namespacing_alerts($domain,\%alerts,\%curr_rules)); |
|
$r->print(&passwdrule_alerts($domain,\%showpasswdrules)); |
##################################### |
##################################### |
# Display list of students to drop # |
# Display list of students to drop # |
##################################### |
##################################### |
Line 5130 sub print_namespacing_alerts {
|
Line 5166 sub print_namespacing_alerts {
|
} |
} |
} |
} |
|
|
|
sub passwdrule_alerts { |
|
my ($domain,$passwdrules) = @_; |
|
my $warning; |
|
if (ref($passwdrules) eq 'HASH') { |
|
my %showrules = %{$passwdrules}; |
|
if (keys(%showrules)) { |
|
my %passwdconf = &Apache::lonnet::get_passwdconf($domain); |
|
$warning = '<b>'.&mt('Password requirement(s) unmet for one or more users:').'</b><ul>'; |
|
if ($showrules{'min'}) { |
|
$warning .= '<li>'.&mt('minimum [quant,_1,character]',$passwdconf{'min'}).'</li>'; |
|
} |
|
if ($showrules{'max'}) { |
|
$warning .= '<li>'.&mt('maximum [quant,_1,character]',$passwdconf{'max'}).'</li>'; |
|
} |
|
if ($showrules{'uc'}) { |
|
$warning .= '<li>'.&mt('contain at least one upper case letter').'</li>'; |
|
} |
|
if ($showrules{'lc'}) { |
|
$warning .= '<li>'.&mt('contain at least one lower case letter').'</li>'; |
|
} |
|
if ($showrules{'num'}) { |
|
$warning .= '<li>'.&mt('contain at least one number').'</li>'; |
|
} |
|
if ($showrules{'spec'}) { |
|
$warning .= '<li>'.&mt('contain at least one non-alphanumeric').'</li>'; |
|
} |
|
$warning .= '</ul>'; |
|
} |
|
} |
|
return $warning; |
|
} |
|
|
sub user_change_result { |
sub user_change_result { |
my ($r,$userresult,$authresult,$roleresult,$idresult,$counts,$flushc, |
my ($r,$userresult,$authresult,$roleresult,$idresult,$counts,$flushc, |
$username,$userdomain,$userchg) = @_; |
$username,$userdomain,$userchg) = @_; |