[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm
raeburn
raeburn at source.lon-capa.org
Wed Feb 16 11:28:49 EST 2022
raeburn Wed Feb 16 16:28:49 2022 EDT
Modified files:
/loncom/interface loncommon.pm
Log:
- Bug 6907
- Min and max length and character requirements can be set for secrets used
for LTI-based link protection for deep-links.
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1376 loncom/interface/loncommon.pm:1.1377
--- loncom/interface/loncommon.pm:1.1376 Mon Feb 14 01:15:24 2022
+++ loncom/interface/loncommon.pm Wed Feb 16 16:28:49 2022
@@ -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 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, at chars,$numrules,$intargjs,%alert);
$numrules = 0;
$min = $Apache::lonnet::passwdmin;
@@ -3673,7 +3692,6 @@
$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';
}
More information about the LON-CAPA-cvs
mailing list