version 1.97, 2007/03/07 16:24:08
|
version 1.100, 2007/04/28 23:13:56
|
Line 516 ENDVCSCREEN
|
Line 516 ENDVCSCREEN
|
} |
} |
|
|
################################################################ |
################################################################ |
|
# Icon Subroutines # |
|
################################################################ |
|
sub iconchanger { |
|
my $r = shift; |
|
my $user = $env{'user.name'}; |
|
my $domain = $env{'user.domain'}; |
|
my %userenv = &Apache::lonnet::get |
|
('environment',['icons']); |
|
my $iconic='checked="checked"'; |
|
my $classic=''; |
|
my $onlyicon=''; |
|
if ($userenv{'icons'} eq 'classic') { |
|
$classic='checked="checked"'; |
|
$iconic=''; |
|
} |
|
if ($userenv{'icons'} eq 'iconsonly') { |
|
$onlyicon='checked="checked"'; |
|
$iconic=''; |
|
} |
|
my $useicons=&mt('Use icons and text'); |
|
my $usebuttons=&mt('Use buttons and text'); |
|
my $useicononly=&mt('Use icons only'); |
|
my $change=&mt('Change'); |
|
$r->print(<<ENDSCREEN); |
|
<form name="prefs" action="/adm/preferences" method="post"> |
|
<input type="hidden" name="action" value="verify_and_change_icons" /> |
|
<label><input type="radio" name="menumode" value="iconic" $iconic /> $useicons</label><br /> |
|
<label><input type="radio" name="menumode" value="classic" $classic /> $usebuttons</label><br /> |
|
<label><input type="radio" name="menumode" value="iconsonly" $onlyicon /> $useicononly</label><br /> |
|
<input type="submit" value="$change" /> |
|
</form> |
|
ENDSCREEN |
|
} |
|
|
|
sub verify_and_change_icons { |
|
my $r = shift; |
|
my $user = $env{'user.name'}; |
|
my $domain = $env{'user.domain'}; |
|
my $newicons = $env{'form.menumode'}; |
|
|
|
&Apache::lonnet::put('environment',{'icons' => $newicons}); |
|
&Apache::lonnet::appenv('environment.icons' => $newicons); |
|
$r->print(&mt('Set menu mode to [_1].',$newicons)); |
|
} |
|
|
|
################################################################ |
# Message Forward # |
# Message Forward # |
################################################################ |
################################################################ |
|
|
Line 845 sub jscript_send {
|
Line 891 sub jscript_send {
|
|
|
sub client_form { |
sub client_form { |
my ($caller,$hexkey,$currentpass,$defdom) = @_; |
my ($caller,$hexkey,$currentpass,$defdom) = @_; |
|
my %lt=&Apache::lonlocal::texthash( |
|
'email' => 'EMail Address', |
|
'username' => 'Username', |
|
'domain' => 'Domain', |
|
'currentpass' => 'Current Password', |
|
'newpass' => 'New Password', |
|
'confirmpass' => 'Confirm Password', |
|
'changepass' => 'Change Password'); |
|
|
my $output = qq| |
my $output = qq| |
<form name="client" > |
<form name="client" > |
<table> |
<table> |
|; |
|; |
if ($caller eq 'reset_by_email') { |
if ($caller eq 'reset_by_email') { |
$output .= qq| |
$output .= qq| |
<tr><td align="right"> E-mail address: </td> |
<tr><td class="LC_preferences_labeltext"><label for="email">$lt{'email'}</label>:</td> |
<td><input type="text" name="email" size="30" /> </td></tr> |
<td><input type="text" name="email" size="30" /> </td></tr> |
<tr><td align="right"> Username: </td> |
<tr><td class="LC_preferences_labeltext"><label for="uname">$lt{'username'}</label>:</td> |
<td> |
<td> |
<input type="text" name="uname" size="15" /> |
<input type="text" name="uname" size="15" /> |
<input type="hidden" name="currentpass" value="$currentpass" /> |
<input type="hidden" name="currentpass" value="$currentpass" /> |
</td></tr> |
</td></tr> |
<tr><td align="right"> Domain: </td> |
<tr><td class="LC_preferences_labeltext"><label for="udom">$lt{'udom'}</label>:</td> |
<td> |
<td> |
|; |
|; |
$output .= &Apache::loncommon::select_dom_form($defdom,'udom').' |
$output .= &Apache::loncommon::select_dom_form($defdom,'udom').' |
Line 867 sub client_form {
|
Line 922 sub client_form {
|
'; |
'; |
} else { |
} else { |
$output .= qq| |
$output .= qq| |
<tr><td align="right"> Current password: </td> |
<tr><td class="LC_preferences_labeltext"><label for="currentpass">$lt{'currentpass'}</label></td> |
<td><input type="password" name="currentpass" size="10"/> </td></tr> |
<td><input type="password" name="currentpass" size="10"/> </td></tr> |
|; |
|; |
} |
} |
$output .= <<"ENDFORM"; |
$output .= <<"ENDFORM"; |
<tr><td align="right"> New password: </td> |
<tr><td class="LC_preferences_labeltext"><label for="newpass_1">$lt{'newpass'}</label></td> |
<td><input type="password" name="newpass_1" size="10" /> </td></tr> |
<td><input type="password" name="newpass_1" size="10" /> </td></tr> |
<tr><td align="right"> Confirm password: </td> |
<tr><td class="LC_preferences_labeltext"><label for="newpass_2">$lt{'confirmpass'}</label></td> |
<td><input type="password" name="newpass_2" size="10" /> </td></tr> |
<td><input type="password" name="newpass_2" size="10" /> </td></tr> |
<tr><td colspan="2" align="center"> |
<tr><td colspan="2" align="center"> |
<input type="button" value="Change Password" onClick="send();"> |
<input type="button" value="$lt{'changepass'}" onClick="send();"> |
</table> |
</table> |
<input type="hidden" name="ukey_cpass" value="$hexkey->{'ukey_cpass'}" /> |
<input type="hidden" name="ukey_cpass" value="$hexkey->{'ukey_cpass'}" /> |
<input type="hidden" name="lkey_cpass" value="$hexkey->{'lkey_cpass'}" /> |
<input type="hidden" name="lkey_cpass" value="$hexkey->{'lkey_cpass'}" /> |
Line 928 sub verify_and_change_password {
|
Line 983 sub verify_and_change_password {
|
if ($user ne '' && $domain ne '') { |
if ($user ne '' && $domain ne '') { |
$homeserver = &Apache::lonnet::homeserver($user,$domain); |
$homeserver = &Apache::lonnet::homeserver($user,$domain); |
if ($homeserver eq 'no_host') { |
if ($homeserver eq 'no_host') { |
&passwordchanger($r,"<p>\n<font color='#ff0000'>ERROR</font>". |
&passwordchanger($r,"<p>\n<span class='LC_error'>". |
"Invalid username and/or domain .\n</p>", |
&mt("Invalid username and/or domain")."</span>\n</p>", |
$caller,$mailtoken); |
$caller,$mailtoken); |
return 1; |
return 1; |
} |
} |
} else { |
} else { |
&passwordchanger($r,"<p>\n<font color='#ff0000'>ERROR</font>". |
&passwordchanger($r,"<p>\n<span class='LC_error'>". |
"Username and Domain were blank.\n</p>", |
&mt("Username and domain were blank")."</span>\n</p>", |
$caller,$mailtoken); |
$caller,$mailtoken); |
return 1; |
return 1; |
} |
} |
Line 948 sub verify_and_change_password {
|
Line 1003 sub verify_and_change_password {
|
# Check for authentication types that allow changing of the password. |
# Check for authentication types that allow changing of the password. |
if ($currentauth !~ /^(unix|internal):/) { |
if ($currentauth !~ /^(unix|internal):/) { |
if ($caller eq 'reset_by_email') { |
if ($caller eq 'reset_by_email') { |
&passwordchanger($r,"<p>\n<font color='#ff0000'>ERROR</font>". |
&passwordchanger($r,"<p>\n<span class='LC_error'>". |
"Authentication type for this user can not be changed by this mechanism..\n</p>", |
&mt("Authentication type for this user can not be changed by this mechanism"). |
|
"</span>\n</p>", |
$caller,$mailtoken); |
$caller,$mailtoken); |
return 1; |
return 1; |
} else { |
} else { |
Line 965 sub verify_and_change_password {
|
Line 1021 sub verify_and_change_password {
|
unless (defined($currentpass) && |
unless (defined($currentpass) && |
defined($newpass1) && |
defined($newpass1) && |
defined($newpass2) ){ |
defined($newpass2) ){ |
&passwordchanger($r,"<p>\n<font color='#ff0000'>ERROR</font>". |
&passwordchanger($r,"<p>\n<span class='LC_error'>". |
"One or more password fields were blank.\n</p>",$caller,$mailtoken); |
&mt("One or more password fields were blank"). |
|
"</span>\n</p>",$caller,$mailtoken); |
return; |
return; |
} |
} |
# Get the keys |
# Get the keys |
Line 978 sub verify_and_change_password {
|
Line 1035 sub verify_and_change_password {
|
if ($caller eq 'reset_by_email') { |
if ($caller eq 'reset_by_email') { |
$tryagain_text = &mt('Please try again later.'); |
$tryagain_text = &mt('Please try again later.'); |
} |
} |
|
my $unable=&mt("Unable to retrieve stored token for password decryption"); |
$r->print(<<ENDERROR); |
$r->print(<<ENDERROR); |
<p> |
<p> |
<font color="#ff0000">ERROR:</font> Unable to retrieve stored token for |
<span class="LC_error">$unable. $tryagain_text</span> |
password decryption. $tryagain_text |
|
</p> |
</p> |
ENDERROR |
ENDERROR |
# Probably should log an error here |
# Probably should log an error here |
Line 997 ENDERROR
|
Line 1054 ENDERROR
|
my %data = &Apache::lonnet::tmpget($mailtoken); |
my %data = &Apache::lonnet::tmpget($mailtoken); |
if ($currentpass ne $data{'temppasswd'}) { |
if ($currentpass ne $data{'temppasswd'}) { |
&passwordchanger($r, |
&passwordchanger($r, |
'<font color="#ff0000">ERROR:</font>'. |
'<span class="LC_error">'. |
'Could not verify current authentication. '. |
&mt('Could not verify current authentication').'. '. |
'Please try again.',$caller,$mailtoken); |
&mt('Please try again').'.</span>',$caller,$mailtoken); |
return 1; |
return 1; |
} |
} |
} |
} |
if ($newpass1 ne $newpass2) { |
if ($newpass1 ne $newpass2) { |
&passwordchanger($r, |
&passwordchanger($r, |
'<font color="#ff0000">ERROR:</font>'. |
'<span class="LC_error">'. |
'The new passwords you entered do not match. '. |
&mt('The new passwords you entered do not match').'. '. |
'Please try again.',$caller,$mailtoken); |
&mt('Please try again').'.</span>',$caller,$mailtoken); |
return 1; |
return 1; |
} |
} |
if (length($newpass1) < 7) { |
if (length($newpass1) < 7) { |
&passwordchanger($r, |
&passwordchanger($r, |
'<font color="#ff0000">ERROR:</font>'. |
'<span class="LC_error">'. |
'Passwords must be a minimum of 7 characters long. '. |
&mt('Passwords must be a minimum of 7 characters long').'. '. |
'Please try again.',$caller,$mailtoken); |
&mt('Please try again').'</span>.',$caller,$mailtoken); |
return 1; |
return 1; |
} |
} |
# |
# |
Line 1025 ENDERROR
|
Line 1082 ENDERROR
|
} |
} |
if ($badpassword) { |
if ($badpassword) { |
# I can't figure out how to enter bad characters on my browser. |
# I can't figure out how to enter bad characters on my browser. |
my $errormessage = <<"ENDERROR"; |
my $errormessage ='<span class="LC_error">'. |
<font color="#ff0000">ERROR:</font> |
&mt('The password you entered contained illegal characters').'.<br />'. |
The password you entered contained illegal characters.<br /> |
&mt('Valid characters are').(<<"ENDERROR"); |
Valid characters are: space and <br /> |
: space and <br /> |
<pre> |
<pre> |
!"\#$%&\'()*+,-./0123456789:;<=>?\@ |
!"\#$%&\'()*+,-./0123456789:;<=>?\@ |
ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_\`abcdefghijklmnopqrstuvwxyz{|}~ |
ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_\`abcdefghijklmnopqrstuvwxyz{|}~ |
</pre> |
</pre></span> |
ENDERROR |
ENDERROR |
&passwordchanger($r,$errormessage,$caller,$mailtoken); |
&passwordchanger($r,$errormessage,$caller,$mailtoken); |
return 1; |
return 1; |
Line 1043 ENDERROR
|
Line 1100 ENDERROR
|
($user,$domain,$currentpass,$newpass1,$homeserver,$caller); |
($user,$domain,$currentpass,$newpass1,$homeserver,$caller); |
# Inform the user the password has (not?) been changed |
# Inform the user the password has (not?) been changed |
if ($result =~ /^ok$/) { |
if ($result =~ /^ok$/) { |
$r->print(<<"ENDTEXT"); |
$r->print("<h3>".&mt('The password for [_1] was successfully changed',$user)."</h3>"); |
<h3>The password for $user was successfully changed</h3> |
|
ENDTEXT |
|
} else { |
} else { |
# error error: run in circles, scream and shout |
# error error: run in circles, scream and shout |
$r->print(<<ENDERROR); |
$r->print("<h3><span class='LC_error'>".&mt("The password for [_1] was not changed",$user)."</span></h3>". |
<h3><font color="#ff0000">The password for $user was not changed</font></h3> |
&mt('Please make sure your old password was entered correctly').'.'); |
Please make sure your old password was entered correctly. |
|
ENDERROR |
|
return 1; |
return 1; |
} |
} |
return; |
return; |
Line 1470 sub handler {
|
Line 1523 sub handler {
|
})); |
})); |
} |
} |
|
|
|
push (@Options,({ action => 'changeicons', |
|
linktext => 'Change How Menus are Displayed', |
|
href => '/adm/preferences', |
|
subroutine => \&iconchanger, |
|
breadcrumb => |
|
{ href => '/adm/preferences?action=changeicons', |
|
text => 'Change Main Menu'}, |
|
}, |
|
{ action => 'verify_and_change_icons', |
|
subroutine => \&verify_and_change_icons, |
|
breadcrumb => |
|
{ href => '/adm/preferences?action=changeicons', |
|
text => 'Change Main Menu'}, |
|
printmenu => 'yes', |
|
})); |
|
|
if (&Apache::lonnet::allowed('whn',$env{'request.course.id'}) |
if (&Apache::lonnet::allowed('whn',$env{'request.course.id'}) |
|| &Apache::lonnet::allowed('whn',$env{'request.course.id'}.'/' |
|| &Apache::lonnet::allowed('whn',$env{'request.course.id'}.'/' |
.$env{'request.course.sec'})) { |
.$env{'request.course.sec'})) { |