[LON-CAPA-cvs] cvs: loncom /interface lonpreferences.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Wed, 15 Mar 2006 21:19:11 -0000
albertel Wed Mar 15 16:19:11 2006 EDT
Modified files:
/loncom/interface lonpreferences.pm
Log:
- was outputting invalid html (mutliple <head>s)
- when the password change screen has an error don't show the preferences
menu
Index: loncom/interface/lonpreferences.pm
diff -u loncom/interface/lonpreferences.pm:1.74 loncom/interface/lonpreferences.pm:1.75
--- loncom/interface/lonpreferences.pm:1.74 Fri Jan 6 16:04:34 2006
+++ loncom/interface/lonpreferences.pm Wed Mar 15 16:19:10 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Preferences
#
-# $Id: lonpreferences.pm,v 1.74 2006/01/06 21:04:34 albertel Exp $
+# $Id: lonpreferences.pm,v 1.75 2006/03/15 21:19:10 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -659,8 +659,6 @@
$lkey_npass2= hex($lkey_npass2);
# Output javascript to deal with passwords
# Output DES javascript
- my $html=&Apache::lonxml::xmlbegin();
- $r->print($html."<head>");
{
my $include = $r->dir_config('lonIncludes');
my $jsh=Apache::File->new($include."/londes.js");
@@ -741,14 +739,6 @@
# Check for authentication types that allow changing of the password.
return if ($currentauth !~ /^(unix|internal):/);
#
- my $html=&Apache::lonxml::xmlbegin();
- $r->print(<<ENDHEADER);
-$html
-<head>
-<title>LON-CAPA Preferences: Change password for $user</title>
-</head>
-ENDHEADER
- #
my $currentpass = $env{'form.currentpass'};
my $newpass1 = $env{'form.newpass_1'};
my $newpass2 = $env{'form.newpass_2'};
@@ -773,7 +763,7 @@
</p>
ENDERROR
# Probably should log an error here
- return;
+ return 1;
}
my ($ckey,$n1key,$n2key)=split(/&/,$tmpinfo);
#
@@ -786,14 +776,14 @@
'<font color="#ff0000">ERROR:</font>'.
'The new passwords you entered do not match. '.
'Please try again.');
- return;
+ return 1;
}
if (length($newpass1) < 7) {
&passwordchanger($r,
'<font color="#ff0000">ERROR:</font>'.
'Passwords must be a minimum of 7 characters long. '.
'Please try again.');
- return;
+ return 1;
}
#
# Check for bad characters
@@ -828,6 +818,7 @@
<h2><font color="#ff0000">The password for $user was not changed</font></h2>
Please make sure your old password was entered correctly.
ENDERROR
+ return 1;
}
return;
}
@@ -1096,7 +1087,7 @@
breadcrumb =>
{ href =>'/adm/preferences?action=changepass',
text => 'Change Password'},
- printmenu => 'yes',
+ printmenu => 'not_on_error',
}));
}
push (@Options,({ action => 'changescreenname',
@@ -1282,10 +1273,13 @@
$r->print(&Apache::loncommon::bodytag('Change Preferences'));
$r->print(&Apache::lonhtmlcommon::breadcrumbs
(undef,'Change Preferences',$help));
+ my $error;
if (defined($call)) {
- $call->($r);
+ $error = $call->($r);
}
- if (($printmenu eq 'yes') && (!$env{'form.returnurl'})) {
+ if ( ( ($printmenu eq 'yes')
+ || ($printmenu eq 'not_on_error' && !$error) )
+ && (!$env{'form.returnurl'})) {
my $optionlist = '<table cellpadding="5">';
if ($env{'user.name'} =~
/^(albertel|kortemey|fox|foxr|korte|hallmat3|turtle|raeburn)$/