File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
lib/WebworkBridge/Importer Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ use WeBWorK::Utils qw(runtime_use readFile cryptPassword);
1212
1313use WebworkBridge::Importer::Error;
1414
15+ use App::Genpass;
1516use Text::CSV;
1617
1718# Constructor
@@ -97,6 +98,7 @@ sub createClassList
9798 # write students
9899 # profid may be a comma separated list of ids, to support multiple profs
99100 my @profid = split (/ ,/ , $course {profid });
101+ my $genpass = App::Genpass-> new(length => 16);
100102 foreach my $i (@students )
101103 {
102104 my $id = $i -> {' loginid' };
@@ -115,7 +117,7 @@ sub createClassList
115117 print FILE " $id ," ; # login id
116118 $i -> {password } ?
117119 print FILE cryptPassword($i -> {password })." ," :
118- print FILE " ," ; # password
120+ print FILE $genpass -> generate, " ," ; # password
119121 print FILE " $i ->{'permission'}\n " ; # permission
120122 }
121123
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ use warnings;
66
77use Time::HiRes qw/ gettimeofday/ ;
88use Date::Format;
9+ use App::Genpass;
910
1011use WeBWorK::CourseEnvironment;
1112use WeBWorK::DB;
@@ -255,8 +256,9 @@ sub addUser
255256 $cryptedpassword = cryptPassword($new_user_info -> {' password' });
256257 }
257258 else
258- {
259- $cryptedpassword = cryptPassword($new_user -> student_id());
259+ { # no password given, so default to random password
260+ my $genpass = App::Genpass-> new(length => 16);
261+ $cryptedpassword = cryptPassword($genpass -> generate);
260262 }
261263 my $password = $db -> newPassword(user_id => $id );
262264 $password -> password($cryptedpassword );
You can’t perform that action at this time.
0 commit comments