version 1.98, 2007/04/13 13:39:32
|
version 1.99, 2007/04/17 18:28:44
|
Line 884 sub jscript_send {
|
Line 884 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 906 sub client_form {
|
Line 915 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 967 sub verify_and_change_password {
|
Line 976 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 987 sub verify_and_change_password {
|
Line 996 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 1004 sub verify_and_change_password {
|
Line 1014 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 1017 sub verify_and_change_password {
|
Line 1028 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 1036 ENDERROR
|
Line 1047 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 1064 ENDERROR
|
Line 1075 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 1082 ENDERROR
|
Line 1093 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; |