--- loncom/interface/loncommon.pm 2022/02/14 01:15:24 1.1376 +++ loncom/interface/loncommon.pm 2022/02/16 16:28:49 1.1377 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.1376 2022/02/14 01:15:24 raeburn Exp $ +# $Id: loncommon.pm,v 1.1377 2022/02/16 16:28:49 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -3649,8 +3649,27 @@ sub check_passwd_rules { } sub passwd_validation_js { - my ($currpasswdval,$domain) = @_; - my %passwdconf = &Apache::lonnet::get_passwdconf($domain); + my ($currpasswdval,$domain,$context,$id) = @_; + my (%passwdconf,$alertmsg); + if ($context eq 'linkprot') { + my %domconfig = &Apache::lonnet::get_dom('configuration',['ltisec'],$domain); + if (ref($domconfig{'ltisec'}) eq 'HASH') { + if (ref($domconfig{'ltisec'}{'rules'}) eq 'HASH') { + %passwdconf = %{$domconfig{'ltisec'}{'rules'}}; + } + } + if ($id eq 'add') { + $alertmsg = &mt('Secret for added launcher did not satisfy requirement(s):').'\n\n'; + } elsif ($id =~ /^\d+$/) { + my $pos = $id+1; + $alertmsg = &mt('Secret for launcher [_1] did not satisfy requirement(s):','#'.$pos).'\n\n'; + } else { + $alertmsg = &mt('A secret did not satisfy requirement(s):').'\n\n'; + } + } else { + %passwdconf = &Apache::lonnet::get_passwdconf($domain); + $alertmsg = &mt('Initial password did not satisfy requirement(s):').'\n\n'; + } my ($min,$max,@chars,$numrules,$intargjs,%alert); $numrules = 0; $min = $Apache::lonnet::passwdmin; @@ -3673,7 +3692,6 @@ sub passwd_validation_js { $numrules ++; } if (($min > 0) || ($max ne '') || (@chars > 0)) { - my $alertmsg = &mt('Initial password did not satisfy requirement(s):').'\n\n'; if ($min) { $alert{'min'} = &mt('minimum [quant,_1,character]',$min).'\n'; }