[LON-CAPA-cvs] cvs: loncom /lti ltiauth.pm
raeburn
raeburn at source.lon-capa.org
Fri Mar 23 14:08:45 EDT 2018
raeburn Fri Mar 23 18:08:45 2018 EDT
Modified files:
/loncom/lti ltiauth.pm
Log:
- Bug 6754 LON-CAPA as LTI Provider
- Assign randomly generated password to user in LON-CAPA if configuration
for LTI Consumer permits both LTI auth and LON-CAPA log-in (internal) for
a new user.
Index: loncom/lti/ltiauth.pm
diff -u loncom/lti/ltiauth.pm:1.6 loncom/lti/ltiauth.pm:1.7
--- loncom/lti/ltiauth.pm:1.6 Fri Mar 23 01:01:47 2018
+++ loncom/lti/ltiauth.pm Fri Mar 23 18:08:45 2018
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Basic LTI Authentication Module
#
-# $Id: ltiauth.pm,v 1.6 2018/03/23 01:01:47 raeburn Exp $
+# $Id: ltiauth.pm,v 1.7 2018/03/23 18:08:45 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -484,7 +484,11 @@
}
if ($lcauth eq '') {
$lcauth = $lti{$itemid}{'lcauth'};
- $lcauthparm = $lti{$itemid}{'lcauthparm'};
+ if ($lcauth eq 'internal') {
+ $lcauthparm = &create_passwd();
+ } else {
+ $lcauthparm = $lti{$itemid}{'lcauthparm'};
+ }
}
} else {
&invalid_request($r,12);
@@ -940,4 +944,24 @@
return;
}
+sub create_passwd {
+ my $passwd = '';
+ my @letts = ("a".."z");
+ for (my $i=0; $i<8; $i++) {
+ my $lettnum = int(rand(2));
+ my $item = '';
+ if ($lettnum) {
+ $item = $letts[int(rand(26))];
+ my $uppercase = int(rand(2));
+ if ($uppercase) {
+ $item =~ tr/a-z/A-Z/;
+ }
+ } else {
+ $item = int(rand(10));
+ }
+ $passwd .= $item;
+ }
+ return ($passwd);
+}
+
1;
More information about the LON-CAPA-cvs
mailing list