--- loncom/interface/createaccount.pm 2010/11/29 14:57:20 1.37.2.2
+++ loncom/interface/createaccount.pm 2010/12/06 02:39:59 1.37.2.7
@@ -3,7 +3,7 @@
# institutional log-in ID (institutional authentication required - localauth
# or kerberos) or an e-mail address.
#
-# $Id: createaccount.pm,v 1.37.2.2 2010/11/29 14:57:20 raeburn Exp $
+# $Id: createaccount.pm,v 1.37.2.7 2010/12/06 02:39:59 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -140,6 +140,7 @@ sub handler {
&Apache::loncommon::start_page($title,$js,
{'no_inline_link' => 1,});
+ my $inventory = uc($domain);
my %domconfig =
&Apache::lonnet::get_dom('configuration',['usercreation'],$domain);
my ($cancreate,$statustocreate) = &get_creation_controls($domain,$domconfig{'usercreation'});
@@ -147,7 +148,7 @@ sub handler {
&print_header($r,$start_page,$courseid);
my $output = '
'.&mt('Account creation unavailable').'
'.
''.
- &mt('Creation of a new user account using an e-mail address or an institutional log-in ID as username is not permitted for the GCI WebCenter.').'
';
+ &mt('Creation of a new user account using an e-mail address or an institutional log-in ID as username is not permitted for the [_1] WebCenter.',$inventory).'
';
$r->print($output);
&print_footer($r);
return OK;
@@ -179,7 +180,7 @@ sub handler {
if ($token) {
($output,$nostart,$noend) =
&process_mailtoken($r,$token,$contact_name,$contact_email,$domain,
- $domdesc,$lonhost,$include,$start_page);
+ $domdesc,$lonhost,$include,$start_page,$inventory);
if ($nostart) {
if ($noend) {
return OK;
@@ -226,7 +227,7 @@ sub handler {
$output = &process_email_request($env{'form.useremail'},$domain,$domdesc,
$contact_name,$contact_email,$cancreate,
$lonhost,$domconfig{'usercreation'},
- $courseid);
+ $courseid,$inventory);
} elsif (!$token) {
&print_header($r,$start_page,$courseid);
my $now=time;
@@ -504,7 +505,7 @@ sub login_box {
sub process_email_request {
my ($useremail,$domain,$domdesc,$contact_name,$contact_email,$cancreate,
- $server,$settings,$courseid) = @_;
+ $server,$settings,$courseid,$inventory) = @_;
$useremail = lc($env{'form.useremail'});
my $output;
if (ref($cancreate) eq 'ARRAY') {
@@ -520,7 +521,7 @@ sub process_email_request {
my $uhome = &Apache::lonnet::homeserver($useremail,$domain);
if ($uhome ne 'no_host') {
$output = &invalid_state('existinguser',$domdesc,
- $contact_name,$contact_email);
+ $contact_name,$contact_email,'',$useremail);
return $output;
} else {
my $captcha = Captcha::reCAPTCHA->new;
@@ -563,7 +564,7 @@ sub process_email_request {
}
}
$output = &send_token($domain,$useremail,$server,$domdesc,$contact_name,
- $contact_email,$courseid);
+ $contact_email,$courseid,$inventory);
}
return $output;
}
@@ -583,7 +584,8 @@ sub call_rulecheck {
}
sub send_token {
- my ($domain,$email,$server,$domdesc,$contact_name,$contact_email,$courseid) = @_;
+ my ($domain,$email,$server,$domdesc,$contact_name,$contact_email,$courseid,
+ $inventory) = @_;
my $msg = ''.&mt('Account creation status').'
'.
&mt('Thank you for your request to create a new LON-CAPA account.').
'
';
@@ -597,9 +599,9 @@ sub send_token {
if ($token !~ /^error/ && $token ne 'no_such_host') {
my $esc_token = &escape($token);
my $showtime = localtime(time);
- my $mailmsg = &mt('A request was submitted on [_1] for creation of a GCI WebCenter account.',$showtime).' '.
+ my $mailmsg = &mt('A request was submitted on [_1] for creation of a [_2] WebCenter account.',$showtime,$inventory)." \n".
&mt('To complete this process please open a web browser and enter the following URL in the address/location box: [_1]',
- &Apache::lonnet::absolute_url().'/adm/createaccount?token='.$esc_token);
+ "\n\n".&Apache::lonnet::absolute_url().'/adm/createaccount?token='.$esc_token);
my $result = &Apache::resetpw::send_mail($domdesc,$email,$mailmsg,$contact_name,
$contact_email);
if ($result eq 'ok') {
@@ -619,7 +621,7 @@ sub send_token {
sub process_mailtoken {
my ($r,$token,$contact_name,$contact_email,$domain,$domdesc,$lonhost,
- $include,$start_page) = @_;
+ $include,$start_page,$inventory) = @_;
my ($msg,$nostart,$noend);
my %data = &Apache::lonnet::tmpget($token);
my $now = time;
@@ -639,7 +641,7 @@ sub process_mailtoken {
if ($result eq 'ok') {
$msg = $output;
my $shownow = &Apache::lonlocal::locallocaltime($now);
- my $mailmsg = &mt('A GCI WebCenter account has been created [_1] from IP address: [_2]. If you did not perform this action or authorize it, please contact the [_3] ([_4]).',$shownow,$ENV{'REMOTE_ADDR'},$contact_name,$contact_email)."\n";
+ my $mailmsg = &mt('A [_1] WebCenter account has been created [_2] from IP address: [_3]. If you did not perform this action or authorize it, please contact the [_4] ([_5]).',$inventory,$shownow,$ENV{'REMOTE_ADDR'},$contact_name,$contact_email)."\n";
my $mailresult = &Apache::resetpw::send_mail($domdesc,$data{'email'},
$mailmsg,$contact_name,
$contact_email);
@@ -1129,35 +1131,44 @@ sub check_id {
}
sub invalid_state {
- my ($error,$domdesc,$contact_name,$contact_email,$msgtext) = @_;
+ my ($error,$domdesc,$contact_name,$contact_email,$msgtext,$useremail) = @_;
my $msg = ''.&mt('Account creation unavailable').'
';
if ($error eq 'baduseremail') {
- $msg = &mt('The e-mail address you provided does not appear to be a valid address.');
+ $msg .= &mt('The e-mail address you provided does not appear to be a valid address.');
} elsif ($error eq 'existinguser') {
- $msg = &mt('The e-mail address you provided is already in use as a username in LON-CAPA at this institution.');
+ my $uname = &HTML::Entities::encode($useremail);
+ $msg .= &mt('The e-mail address you provided is already in use as a username in LON-CAPA at this institution.').'
'.&mt('You can either:').''.
+ '- '.&mt('Return to the [_1]log-in page[_2] and enter your password.','','').'
'.
+ '- '.&mt('or, if you do not remember your password, visit the "[_1]Forgot your password?[_2]" page.','','').
+ '
';
} elsif ($error eq 'userrules') {
- $msg = &mt('Username rules at this institution do not allow the e-mail address you provided to be used as a username.');
+ $msg .= &mt('Username rules at this institution do not allow the e-mail address you provided to be used as a username.');
} elsif ($error eq 'userformat') {
- $msg = &mt('The e-mail address you provided may not be used as a username at this LON-CAPA institution.');
+ $msg .= &mt('The e-mail address you provided may not be used as a username at this LON-CAPA institution.');
} elsif ($error eq 'captcha') {
- $msg = &mt('Validation of the code your entered failed.');
+ $msg .= &mt('Validation of the code you entered failed.');
} elsif ($error eq 'noemails') {
- $msg = &mt('Creation of a new user account using an e-mail address as username is not permitted at this LON-CAPA institution.');
+ $msg .= &mt('Creation of a new user account using an e-mail address as username is not permitted at this LON-CAPA institution.');
}
$msg .= '';
if ($msgtext) {
$msg .= '
'.$msgtext;
}
- $msg .= &linkto_email_help($contact_email,$domdesc);
+ $msg .= &linkto_email_help($contact_email,$domdesc,$error);
return $msg;
}
sub linkto_email_help {
- my ($contact_email,$domdesc) = @_;
+ my ($contact_email,$domdesc,$error) = @_;
my $msg;
if ($contact_email ne '') {
my $escuri = &HTML::Entities::encode('/adm/createaccount','&<>"');
- $msg .= '
'.&mt('You may wish to contact the [_1]LON-CAPA helpdesk[_2] for [_3].','','',$domdesc).'
';
+ my $href = '/adm/helpdesk?origurl='.$escuri;
+ if ($error eq 'existinguser') {
+ my $escemail = &HTML::Entities::encode($env{'form.useremail'});
+ $href .= '&useremail='.$escemail.'&useraccount='.$escemail;
+ }
+ $msg .= '
'.&mt('You may wish to contact the [_1]LON-CAPA helpdesk[_2] for [_3].','','',$domdesc).'
';
} else {
$msg .= '
'.&mt('You may wish to send an e-mail to the server administrator: [_1] for [_2].',$Apache::lonnet::perlvar{'AdminEmail'},$domdesc).'
';
}