'
.&mt('Username and/or password could not be authenticated.')
@@ -714,8 +746,10 @@ sub username_validation {
}
sub username_check {
- my ($username,$domain,$domdesc,$courseid,$lonhost,$contact_email) = @_;
- my (%rulematch,%inst_results,$newuser,%alerts,%curr_rules,%got_rules);
+ my ($username,$domain,$domdesc,$courseid,$lonhost,$contact_email,$contact_name,
+ $sso_logout) = @_;
+ my (%rulematch,%inst_results,$newuser,$checkfail,$rowcount,$editable,$output,$msg,
+ %alerts,%curr_rules,%got_rules);
$newuser = 1;
my $checkhash;
my $checks = { 'username' => 1 };
@@ -725,47 +759,75 @@ sub username_check {
if (ref($alerts{'username'}) eq 'HASH') {
if (ref($alerts{'username'}{$domain}) eq 'HASH') {
if ($alerts{'username'}{$domain}{$username}) {
- my ($userchkmsg,$checkfail);
if (ref($curr_rules{$domain}) eq 'HASH') {
- $userchkmsg =
- &Apache::loncommon::instrule_disallow_msg('username',$domdesc,1).
+ $output =
+ &Apache::loncommon::instrule_disallow_msg('username',$domdesc,1,
+ 'selfcreate').
&Apache::loncommon::user_rule_formats($domain,$domdesc,
$curr_rules{$domain}{'username'},'username');
- if ($userchkmsg) {
- $checkfail = 'username';
- }
}
- return ($userchkmsg,$checkfail);
+ $checkfail = 'username';
}
}
}
- my $submit_text = &mt('Create LON-CAPA account');
- my $output = '
';
- return ($output,'');
+ if (!$checkfail) {
+ $output = '
';
+ if ($rowcount) {
+ if ($editable) {
+ $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 {
+ $msg = &mt('A user account will be created with information displayed in the table below, when you click the [_1]Create LON-CAPA account[_2] button.','
','').'
';
+ }
+ } else {
+ $msg = '
'.&mt('Confirm that you wish to create an account.');
+ }
+ $msg .= $output;
+ }
+ return $msg;
}
sub username_activation {
@@ -864,20 +926,21 @@ sub check_id {
sub invalid_state {
my ($error,$domdesc,$contact_name,$contact_email,$msgtext) = @_;
- my $msg;
+ 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.');
} elsif ($error eq 'existinguser') {
- $msg = &mt('The e-mail address you provided is already in use as a username in this LON-CAPA domain.');
+ $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 for this LON-CAPA domain do not allow the e-mail address you provided to be used as a username.');
+ $msg = &mt('Username rules for this LON-CAPA 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 in this LON-CAPA domain.');
+ $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.');
} elsif ($error eq 'noemails') {
- $msg = &mt('Creation of a new user account using an e-mail address as username is not permitted in this LON-CAPA domain.');
+ $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;
}
@@ -890,9 +953,9 @@ sub linkto_email_help {
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 the [_3] domain.','
','',$domdesc);
+ $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 the [_2] domain.',$Apache::lonnet::perlvar{'AdminEmail'},$domdesc);
+ $msg .= '
'.&mt('You may wish to send an e-mail to the server administrator: [_1] for [_2].',$Apache::lonnet::perlvar{'AdminEmail'},$domdesc).'
';
}
return $msg;
}
@@ -914,9 +977,9 @@ sub create_captcha {
sub captcha_settings {
my %captcha_params = (
- output_dir => $Apache::lonnet::perlvar{'lonDocRoot'}.'/captcha',
- www_output_dir => "/captcha",
- db_dir => "/home/www/captchadb",
+ output_dir => $Apache::lonnet::perlvar{'lonCaptchaDir'},
+ www_output_dir => "/captchaspool",
+ db_dir => $Apache::lonnet::perlvar{'lonCaptchaDb'},
numchars => '5',
);
return %captcha_params;
@@ -1006,4 +1069,25 @@ sub guest_format_check {
return $format_msg;
}
+sub sso_logout_frag {
+ my ($r,$domain) = @_;
+ my $endsessionmsg;
+ if (defined($r->dir_config('lonSSOUserLogoutMessageFile_'.$domain))) {
+ my $msgfile = $r->dir_config('lonSSOUserLogoutMessageFile_'.$domain);
+ if (-e $msgfile) {
+ open(my $fh,"<$msgfile");
+ $endsessionmsg = join('',<$fh>);
+ close($fh);
+ }
+ } elsif (defined($r->dir_config('lonSSOUserLogoutMessageFile'))) {
+ my $msgfile = $r->dir_config('lonSSOUserLogoutMessageFile');
+ if (-e $msgfile) {
+ open(my $fh,"<$msgfile");
+ $endsessionmsg = join('',<$fh>);
+ close($fh);
+ }
+ }
+ return $endsessionmsg;
+}
+
1;