--- loncom/lti/ltiauth.pm 2018/03/23 01:01:47 1.6 +++ loncom/lti/ltiauth.pm 2018/03/23 18:08:45 1.7 @@ -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 @@ sub handler { } 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 @@ sub invalid_request { 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;