[LON-CAPA-cvs] cvs: loncom /interface lonblockingmenu.pm lonblockingstatus.pm loncommon.pm lonpreferences.pm resetpw.pm /misc releaseslist.xml
raeburn
raeburn at source.lon-capa.org
Tue Jan 26 19:24:21 EST 2016
raeburn Wed Jan 27 00:24:21 2016 EDT
Modified files:
/loncom/interface lonblockingmenu.pm lonblockingstatus.pm
loncommon.pm lonpreferences.pm resetpw.pm
/loncom/misc releaseslist.xml
Log:
- Blocking of user actions during an exam can include changing a password
via user preferences or using "Forgot password?" (internal auth).
-------------- next part --------------
Index: loncom/interface/lonblockingmenu.pm
diff -u loncom/interface/lonblockingmenu.pm:1.15 loncom/interface/lonblockingmenu.pm:1.16
--- loncom/interface/lonblockingmenu.pm:1.15 Sun Sep 13 21:48:05 2015
+++ loncom/interface/lonblockingmenu.pm Wed Jan 27 00:24:09 2016
@@ -2,7 +2,7 @@
# Routines for configuring blocking of access to collaborative functions,
# and specific resources during an exam
#
-# $Id: lonblockingmenu.pm,v 1.15 2015/09/13 21:48:05 raeburn Exp $
+# $Id: lonblockingmenu.pm,v 1.16 2016/01/27 00:24:09 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -561,6 +561,7 @@
'<li>'.&mt('accessing content in LON-CAPA portfolios or blogs').'</li>'."\n".
'<li>'.&mt("generating printouts of $lctype content").'</li>'.
'<li>'.&mt("accessing $lctype content in specified folders or resources").'</li>'.
+ '<li>'.&mt("changing user's own password").'</li>'.
'</ul>'.
'<p class="LC_warning">'.$lt{'blca'}.'<br />'.$lt{'pobl'}.'</p>'
);
@@ -1501,8 +1502,9 @@
'blogs' => 'Blogs',
'docs' => 'Content',
'printout' => 'Printouts',
+ 'passwd' => 'Password',
);
- my $typeorder = ['com','chat','boards','port','groups','blogs','printout','docs'];
+ my $typeorder = ['com','chat','boards','port','groups','blogs','printout','docs','passwd'];
return ($typeorder,\%types);
}
Index: loncom/interface/lonblockingstatus.pm
diff -u loncom/interface/lonblockingstatus.pm:1.12 loncom/interface/lonblockingstatus.pm:1.13
--- loncom/interface/lonblockingstatus.pm:1.12 Tue Jan 15 18:24:15 2013
+++ loncom/interface/lonblockingstatus.pm Wed Jan 27 00:24:09 2016
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# displays the blocking status table
#
-# $Id: lonblockingstatus.pm,v 1.12 2013/01/15 18:24:15 raeburn Exp $
+# $Id: lonblockingstatus.pm,v 1.13 2016/01/27 00:24:09 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -44,7 +44,7 @@
return OK if $r->header_only;
my (%activities,$activity,$origurl);
- map { $activities{$_} = 1; } ('boards','chat','msgdisplay','blogs','groups','port','printout','docs');
+ map { $activities{$_} = 1; } ('boards','chat','msgdisplay','blogs','groups','port','printout','docs','passwd');
# determine what kind of blocking we want details for
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['activity','url']);
@@ -78,16 +78,24 @@
# we're trying to look at. This information is passed via query string.
my ($uname, $udom);
- if ($activity eq 'port') {
+ if (($activity eq 'port') ||
+ (($activity eq 'passwd') && ($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public'))) {
&Apache::loncommon::get_unprocessed_cgi(
$ENV{'QUERY_STRING'}, ['udom', 'uname'] );
($uname, $udom) = ($env{'form.uname'}, $env{'form.udom'});
if (($uname !~ /^$match_username$/) || ($udom !~ /^$match_domain$/)) {
- return '<span class="LC_error">'.
- &mt('Information about the owner of the portfolio files you were trying to view was missing or invalid.').
- '</span><br />'.
- &mt('Without valid owner information, the reason why access is blocked can not be determined');
+ if ($activity eq 'port') {
+ return '<span class="LC_error">'.
+ &mt('Information about the owner of the portfolio files you were trying to view was missing or invalid.').
+ '</span><br />'.
+ &mt('Without valid owner information, the reason why access is blocked can not be determined');
+ } else {
+ return '<span class="LC_error">'.
+ &mt('Information about the username and/or domain for which you were trying to reset a password was missing or invalid.').
+ '</span><br />'.
+ &mt('Without valid information, the reason why access is blocked can not be determined');
+ }
}
}
@@ -110,6 +118,7 @@
groups => 'Groups in this course',
printout => 'Printout generation',
docs => 'Course Content',
+ passwd => 'Changing of passwords',
);
if ($activity eq 'groups' || $activity eq 'boards') {
@@ -140,7 +149,7 @@
. ' view will be unavailable between [_1] and [_2] because'
. ' access to selected '.$description.' is being blocked.'
,$showstart, $showend);
- } elsif ($activity eq 'printout') {
+ } elsif (($activity eq 'printout') || ($activity eq 'passwd')) {
$output = mt( $description
. ' will be unavailable between [_1] and [_2] because'
. ' this functionality is being blocked.'
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1231 loncom/interface/loncommon.pm:1.1232
--- loncom/interface/loncommon.pm:1.1231 Fri Jan 22 22:42:47 2016
+++ loncom/interface/loncommon.pm Wed Jan 27 00:24:09 2016
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.1231 2016/01/22 22:42:47 damieng Exp $
+# $Id: loncommon.pm,v 1.1232 2016/01/27 00:24:09 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -4959,9 +4959,9 @@
# build a link to a popup window containing the details
my $querystring = "?activity=$activity";
# $uname and $udom decide whose portfolio the user is trying to look at
- if ($activity eq 'port') {
- $querystring .= "&udom=$udom" if $udom;
- $querystring .= "&uname=$uname" if $uname;
+ if (($activity eq 'port') || ($activity eq 'passwd')) {
+ $querystring .= "&udom=$udom" if ($udom =~ /^$match_domain$/);
+ $querystring .= "&uname=$uname" if ($uname =~ /^$match_username$/);
} elsif ($activity eq 'docs') {
$querystring .= '&url='.&HTML::Entities::encode($url,'&"');
}
@@ -4986,6 +4986,8 @@
$class = '';
} elsif ($activity eq 'printout') {
$text = &mt('Printing Blocked');
+ } elsif ($activity eq 'passwd') {
+ $text = &mt('Password Changing Blocked');
}
$output .= <<"END_BLOCK";
<div class='$class'>
Index: loncom/interface/lonpreferences.pm
diff -u loncom/interface/lonpreferences.pm:1.216 loncom/interface/lonpreferences.pm:1.217
--- loncom/interface/lonpreferences.pm:1.216 Mon Feb 23 12:36:27 2015
+++ loncom/interface/lonpreferences.pm Wed Jan 27 00:24:09 2016
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Preferences
#
-# $Id: lonpreferences.pm,v 1.216 2015/02/23 12:36:27 droeschl Exp $
+# $Id: lonpreferences.pm,v 1.217 2016/01/27 00:24:09 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1262,6 +1262,12 @@
$r->print(Apache::loncommon::start_page('Personal Data'));
$r->print(Apache::lonhtmlcommon::breadcrumbs('Change Password'));
}
+ my ($blocked,$blocktext) =
+ &Apache::loncommon::blocking_status('passwd');
+ if ($blocked) {
+ $r->print('<p class="LC_warning">'.$blocktext.'</p>');
+ return;
+ }
if ((!defined($caller)) || ($caller eq 'preferences')) {
$user = $env{'user.name'};
$domain = $env{'user.domain'};
@@ -1490,6 +1496,12 @@
sub verify_and_change_password {
my ($r,$caller,$mailtoken) = @_;
my ($user,$domain,$homeserver);
+ my ($blocked,$blocktext) =
+ &Apache::loncommon::blocking_status('passwd');
+ if ($blocked) {
+ $r->print('<p class="LC_warning">'.$blocktext.'</p>');
+ return;
+ }
if ($caller eq 'reset_by_email') {
$user = $env{'form.uname'};
$domain = $env{'form.udom'};
Index: loncom/interface/resetpw.pm
diff -u loncom/interface/resetpw.pm:1.36 loncom/interface/resetpw.pm:1.37
--- loncom/interface/resetpw.pm:1.36 Sat Aug 17 00:34:29 2013
+++ loncom/interface/resetpw.pm Wed Jan 27 00:24:09 2016
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Allow access to password changing via a token sent to user's e-mail.
#
-# $Id: resetpw.pm,v 1.36 2013/08/17 00:34:29 raeburn Exp $
+# $Id: resetpw.pm,v 1.37 2016/01/27 00:24:09 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -116,9 +116,14 @@
my $authtype = &Apache::lonnet::queryauthenticate($uname,$udom);
if ($authtype =~ /^internal/) {
my $useremail = $env{'form.useremail'};
- if ($useremail !~ /^[^\@]+\@[^\@]+\.[^\@\.]+$/) {
- $output = &invalid_state('baduseremail',$domdesc,
- $contact_name,$contact_email);
+ my ($blocked,$blocktext) =
+ &Apache::loncommon::blocking_status('passwd',$uname,$udom);
+ if ($blocked) {
+ $output = '<p class="LC_warning">'.$blocktext.'</p>'
+ .&display_actions($contact_email,$domdesc);
+ } elsif ($useremail !~ /^[^\@]+\@[^\@]+\.[^\@\.]+$/) {
+ $output = &invalid_state('baduseremail',$domdesc,
+ $contact_name,$contact_email);
} else {
my %userinfo =
&Apache::lonnet::get('environment',\@emailtypes,
@@ -310,7 +315,12 @@
($data{'email'} =~ /^[^\@]+\@[^\@]+\.[^\@\.]+$/) &&
($data{'temppasswd'} =~/^\w+$/)) {
my $reqtime = &Apache::lonlocal::locallocaltime($data{'time'});
- if ($now - $data{'time'} < 7200) {
+ my ($blocked,$blocktext) =
+ &Apache::loncommon::blocking_status('passwd',$data{'username'},$data{'domain'});
+ if ($blocked) {
+ $msg = '<p class="LC_warning">'.$blocktext.'</p>';
+ return $msg;
+ } elsif ($now - $data{'time'} < 7200) {
if ($env{'form.action'} eq 'verify_and_change_pass') {
unless (($env{'form.uname'} eq $data{'username'}) && ($env{'form.udom'} eq $data{'domain'}) && ($env{'form.email'} eq $data{'email'})) {
$msg = &generic_failure_msg($contact_name,$contact_email);
Index: loncom/misc/releaseslist.xml
diff -u loncom/misc/releaseslist.xml:1.12 loncom/misc/releaseslist.xml:1.13
--- loncom/misc/releaseslist.xml:1.12 Sun Sep 13 21:48:18 2015
+++ loncom/misc/releaseslist.xml Wed Jan 27 00:24:20 2016
@@ -2,6 +2,7 @@
<course name="commblock" value="timer">2.11</course>
<course name="commblock" value="docs">2.11</course>
<course name="commblock" value="printout">2.11</course>
+<course name="commblock" value="passwd">2.12</course>
<parameter name="type" value="anonsurvey">2.10</parameter>
<parameter name="type" value="anonsurveycred">2.10</parameter>
<parameter name="type" value="surveycred">2.10</parameter>
More information about the LON-CAPA-cvs
mailing list