'.
&mt('A LON-CAPA account may not be created with the username you use.').
@@ -995,7 +994,7 @@ sub username_check {
if ($rowcount) {
if ($editable) {
if ($courseid ne '') {
- $msg = ''.&mt('User information').'
';
+ $msg = '
'.&mt('User information').'
';
}
$msg .= &mt('To create one, use the table below to provide information about yourself, then click the [_1]Create LON-CAPA account[_2] button.','','').'
';
} else {
@@ -1016,11 +1015,11 @@ sub username_check {
}
sub username_activation {
- my ($r,$username,$domain,$domdesc,$lonhost,$courseid) = @_;
+ my ($r,$username,$domain,$domdesc,$courseid) = @_;
my $output;
my $error = ''.&mt('Error:').' ';
my $end = '
';
- my $rtnlink = ''.
+ my $rtnlink = ''.
&mt('Return to previous page').''.
&Apache::loncommon::end_page();
my %domdefaults = &Apache::lonnet::get_domain_defaults($domain);
@@ -1059,7 +1058,7 @@ sub username_activation {
# Call modifyuser
my (%rulematch,%inst_results,%curr_rules,%got_rules,%alerts,%info);
&call_rulecheck($username,$domain,\%alerts,\%rulematch,
- \%inst_results,\%curr_rules,%got_rules);
+ \%inst_results,\%curr_rules,\%got_rules);
my @userinfo = ('firstname','middlename','lastname','generation',
'permanentemail','id');
my %canmodify =
@@ -1086,7 +1085,8 @@ sub username_activation {
if ($result eq 'ok') {
my $delete = &Apache::lonnet::tmpdel($env{'form.authtoken'});
$output = &mt('A LON-CAPA account has been created for username: [_1] in domain: [_2].',$username,$domain);
- my %form = &start_session($r,$username,$domain,$lonhost,$courseid);
+ my $uhome=&Apache::lonnet::homeserver($username,$domain,'true');
+ &start_session($r,$username,$domain,$uhome,$courseid);
my $nostart = 1;
return ('ok',$output,$nostart);
} else {
@@ -1102,6 +1102,9 @@ sub username_activation {
sub check_id {
my ($username,$domain,$domdesc) = @_;
# Check ID format
+ # Is $username in an okay format for $domain
+ # (right number of characters, special characters, etc - follow domain rules)?
+ # $domdesc is just used for user error messages
my (%alerts,%rulematch,%inst_results,%curr_rules,%checkhash);
my %checks = ('id' => 1);
%{$checkhash{$username.':'.$domain}} = (
@@ -1132,45 +1135,44 @@ sub invalid_state {
my ($error,$domdesc,$contact_name,$contact_email,$msgtext) = @_;
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.');
+ $msg .= &mt('The e-mail address you provided is already in use as a username in LON-CAPA at this institution.');
} 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;
+ my $href = '/adm/helpdesk';
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).'
';
+ $href .= '?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).'
';
}
return $msg;
}
-sub create_recaptcha {
- my $captcha = Captcha::reCAPTCHA->new;
- return $captcha->get_options_setter({theme => 'white'})."\n".
- $captcha->get_html('PUBLICKEY'); # generate public key for IP
- # from http://recaptcha.net/
-}
-
sub getkeys {
my ($lkey,$ukey) = @_;
my $lextkey=hex($lkey);
@@ -1208,6 +1210,12 @@ ENDSERVERFORM
}
sub process_credentials {
+#
+# Fetches the information from the logtoken via tmpget
+# Token contains the DES-key and the stage of the process (would only be "createaccount")
+# $lonhost in this routine is *not* necessarily the machine that this runs on,
+# but $env{'form.serverid'}, the machine that issued the token.
+#
my ($logtoken,$lonhost) = @_;
my $tmpinfo=Apache::lonnet::reply('tmpget:'.$logtoken,$lonhost);
my ($retrieved,$output,$upass);
@@ -1229,6 +1237,10 @@ sub process_credentials {
} else {
$output = &mt('Unable to retrieve your log-in information - unexpected context');
}
+# $retrieved is 'ok' if retrieved okay
+# $output is screen output for the user
+# $upass is $env{'form.upass'}, decrypted with the DES-key, if stage was 'createaccount'
+
return ($retrieved,$output,$upass);
}
500 Internal Server Error
Internal Server Error
The server encountered an internal error or
misconfiguration and was unable to complete
your request.
Please contact the server administrator at
root@localhost to inform them of the time this error occurred,
and the actions you performed just before this error.
More information about this error may be available
in the server error log.