--- loncom/interface/createaccount.pm 2010/11/29 15:13:08 1.37.2.3
+++ loncom/interface/createaccount.pm 2012/05/01 12:39:32 1.40.2.5.2.14
@@ -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.3 2010/11/29 15:13:08 raeburn Exp $
+# $Id: createaccount.pm,v 1.40.2.5.2.14 2012/05/01 12:39:32 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -57,6 +57,8 @@ sub handler {
my $sso_username = $r->subprocess_env->get('REDIRECT_SSOUserUnknown');
my $sso_domain = $r->subprocess_env->get('REDIRECT_SSOUserDomain');
+ my $privkey = $r->dir_config('reCAPTCHA_PRIVATE');
+ my $pubkey = $r->dir_config('reCAPTCHA_PUBLIC');
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['token','courseid']);
&Apache::lonacc::get_posted_cgi($r);
@@ -100,6 +102,10 @@ sub handler {
my ($js,$courseid,$title);
if (defined($env{'form.courseid'})) {
$courseid = &validate_course($env{'form.courseid'});
+ if (($courseid eq 'relate_3H121116c19344ff3relatel1') ||
+ ($courseid eq 'relate_3e100973b27484f2drelatel1') {
+ $courseid = 'relate_2764113e81b9e4f0crelatel1';
+ }
}
if ($courseid ne '') {
$js = &catreturn_js();
@@ -139,7 +145,6 @@ sub handler {
$start_page =
&Apache::loncommon::start_page($title,$js,
{'no_inline_link' => 1,});
-
my %domconfig =
&Apache::lonnet::get_dom('configuration',['usercreation'],$domain);
my ($cancreate,$statustocreate) = &get_creation_controls($domain,$domconfig{'usercreation'});
@@ -147,7 +152,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 [_1].',$domdesc).'
';
$r->print($output);
&print_footer($r);
return OK;
@@ -226,7 +231,7 @@ sub handler {
$output = &process_email_request($env{'form.useremail'},$domain,$domdesc,
$contact_name,$contact_email,$cancreate,
$lonhost,$domconfig{'usercreation'},
- $courseid);
+ $courseid,$privkey);
} elsif (!$token) {
&print_header($r,$start_page,$courseid);
my $now=time;
@@ -239,13 +244,22 @@ sub handler {
$r->print(&javascript_validmail());
}
$output = &print_username_form($domain,$domdesc,$cancreate,$now,$lonhost,
- $courseid);
+ $courseid,$pubkey);
}
$r->print($output);
&print_footer($r);
return OK;
}
+sub get_custom_name {
+ my ($domain) = @_;
+ if ($domain eq 'relate') {
+ return 'Mechanics Online';
+ } else {
+ return lc($domain);
+ }
+}
+
sub print_header {
my ($r,$start_page,$courseid) = @_;
$r->print($start_page);
@@ -286,7 +300,7 @@ sub selfenroll_crumbs {
}
my $last_crumb;
if ($desc ne '') {
- $last_crumb = &mt('Self-enroll in [_1]',''.$desc.'');
+ $last_crumb = &mt('Self-enroll in [_1]',"$desc");
} else {
$last_crumb = &mt('Self-enroll');
}
@@ -379,7 +393,7 @@ function validate_email() {
var lcemail = emailaddr.toLowerCase();
if (emailaddr != lcemail) {
field.value = lcemail;
- alert("WebCenter usernames are all lower case.\\nAccordingly your username will be "+lcemail+" once activated.");
+ alert("Mechanics Online usernames are all lower case.\\nAccordingly your username will be "+lcemail+" once activated.");
}
}
return true;
@@ -390,36 +404,51 @@ ENDSCRIPT
}
sub print_username_form {
- my ($domain,$domdesc,$cancreate,$now,$lonhost,$courseid) = @_;
- my %lt = &Apache::lonlocal::texthash(
- unam => 'username',
- udom => 'domain',
- uemail => 'E-mail address in LON-CAPA',
- proc => 'Proceed');
+ my ($domain,$domdesc,$cancreate,$now,$lonhost,$courseid,$pubkey) = @_;
+ my %lt = &Apache::lonlocal::texthash (
+ unam => 'username',
+ udom => 'domain',
+ uemail => 'E-mail address in LON-CAPA',
+ proc => 'Proceed',
+ crea => 'Create account with a username provided by this institution',
+ crlc => 'Create LON-CAPA account',
+ type => 'Type in your log-in ID and password to find out.',
+ plse => 'Please enter a valid e-mail address below.',
+ inst => 'Instructions on how to activate your account will be sent to the e-mail address you provide.',
+ aftr => 'After completing the activation process you will have access to a "self test" that will help you assess your readiness for the course.',
+ thes => 'The same account will be used for access to the Mechanics Online course, once it becomes available on March 1, 2012.',
+ );
my $output;
if (ref($cancreate) eq 'ARRAY') {
if (grep(/^login$/,@{$cancreate})) {
my %domdefaults = &Apache::lonnet::get_domain_defaults($domain);
if ((($domdefaults{'auth_def'} =~/^krb/) && ($domdefaults{'auth_arg_def'} ne '')) || ($domdefaults{'auth_def'} eq 'localauth')) {
- $output = '
'.&mt('Create account with a username provided by this institution').'
';
- my $submit_text = &mt('Create LON-CAPA account');
- $output .= &mt('If you already have a log-in ID at this institution,[_1] you may be able to use it for LON-CAPA.',' ').'
'.&mt('Type in your log-in ID and password to find out.').'
';
+ $output = '
'.$lt{'crea'}.'
';
+ my $submit_text = $lt{'crlc'};
+ $output .= &mt('If you already have a log-in ID at this institution,[_1] you may be able to use it for LON-CAPA.',' ').
+ '
';
}
}
if (grep(/^email$/,@{$cancreate})) {
- $output .= '
'.&mt('Create account with an e-mail address as your username').'
';
- my $captchaform = &create_recaptcha();
+ $output .= '
'.&mt('Create account with an e-mail address as your username').'
'.
+ '
'.
+ &mt('You are about to sign-up for the [_1]Mechanics Online[_2] course.','','').' '.
+ $lt{'plse'}.'
'.
+ '
'.$lt{'inst'}.'
'.
+ '
'.$lt{'aftr'}.'
'.
+ '
'.$lt{'thes'}.'
';
+ my $captchaform = &create_recaptcha($pubkey);
if ($captchaform) {
- my $submit_text = &mt('Request LON-CAPA account');
+ my $submit_text = &mt('Sign-up');
my $emailform = '';
if (grep(/^login$/,@{$cancreate})) {
- $output .= &mt('Provide your e-mail address to request a LON-CAPA account,[_1] if you do not have a log-in ID at your institution.',' ').'
';
+ $output .= &mt('Provide your e-mail address to sign up for a Mechanics Online account [_1]if you do not have a log-in ID at your institution.',' ').'