version 1.302, 2017/07/18 16:03:08
|
version 1.303, 2017/07/26 19:45:45
|
Line 281 sub handler {
|
Line 281 sub handler {
|
{col1 => 'Internal Authentication', |
{col1 => 'Internal Authentication', |
col2 => 'Value'}, |
col2 => 'Value'}, |
{col1 => 'Institutional user types', |
{col1 => 'Institutional user types', |
col2 => 'Assignable to e-mail usernames'}], |
col2 => 'Assignable to non-institutional users'}], |
print => \&print_defaults, |
print => \&print_defaults, |
modify => \&modify_defaults, |
modify => \&modify_defaults, |
}, |
}, |
Line 363 sub handler {
|
Line 363 sub handler {
|
col2 => 'Enabled?'}, |
col2 => 'Enabled?'}, |
{col1 => 'Institutional user type (login/SSO self-creation)', |
{col1 => 'Institutional user type (login/SSO self-creation)', |
col2 => 'Information user can enter'}, |
col2 => 'Information user can enter'}, |
{col1 => 'Self-creation with e-mail as username', |
{col1 => 'Self-creation with e-mail verification', |
col2 => 'Settings'}], |
col2 => 'Settings'}], |
print => \&print_selfcreation, |
print => \&print_selfcreation, |
modify => \&modify_selfcreation, |
modify => \&modify_selfcreation, |
Line 5752 sub print_usercreation {
|
Line 5752 sub print_usercreation {
|
|
|
sub print_selfcreation { |
sub print_selfcreation { |
my ($position,$dom,$settings,$rowtotal) = @_; |
my ($position,$dom,$settings,$rowtotal) = @_; |
my (@selfcreate,$createsettings,$processing,$datatable); |
my (@selfcreate,$createsettings,$processing,$emailverified,$emaildomain,$datatable); |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
if (ref($settings->{'cancreate'}) eq 'HASH') { |
if (ref($settings->{'cancreate'}) eq 'HASH') { |
$createsettings = $settings->{'cancreate'}; |
$createsettings = $settings->{'cancreate'}; |
Line 5769 sub print_selfcreation {
|
Line 5769 sub print_selfcreation {
|
if (ref($createsettings->{'selfcreateprocessing'}) eq 'HASH') { |
if (ref($createsettings->{'selfcreateprocessing'}) eq 'HASH') { |
$processing = $createsettings->{'selfcreateprocessing'}; |
$processing = $createsettings->{'selfcreateprocessing'}; |
} |
} |
|
if (ref($createsettings->{'emailverified'}) eq 'HASH') { |
|
$emailverified = $createsettings->{'emailverified'}; |
|
} |
|
if (ref($createsettings->{'emaildomain'}) eq 'HASH') { |
|
$emaildomain = $createsettings->{'emaildomain'}; |
|
} |
} |
} |
} |
} |
} |
} |
Line 5859 sub print_selfcreation {
|
Line 5865 sub print_selfcreation {
|
} |
} |
} else { |
} else { |
my %choices = &Apache::lonlocal::texthash ( |
my %choices = &Apache::lonlocal::texthash ( |
cancreate_email => 'E-mail address as username', |
cancreate_email => 'Non-institutional username (e-mail verification)', |
); |
); |
my @toggles = sort(keys(%choices)); |
my @toggles = sort(keys(%choices)); |
my %defaultchecked = ( |
my %defaultchecked = ( |
Line 5891 sub print_selfcreation {
|
Line 5897 sub print_selfcreation {
|
$usertypeshash{'default'} = $othertitle; |
$usertypeshash{'default'} = $othertitle; |
$additional .= '<table><tr>'; |
$additional .= '<table><tr>'; |
foreach my $status (@ordered) { |
foreach my $status (@ordered) { |
$additional .= '<th>'.$usertypeshash{$status}.'</th>'; |
$additional .= '<th align="center">'.$usertypeshash{$status}.'</th>'; |
|
} |
|
$additional .= '</tr><tr>'; |
|
foreach my $status (@ordered) { |
|
$additional .= '<td align="left" valign="top">'.&validate_by_email($rowtotal,$processing,$status).'</td>'; |
|
} |
|
$additional .= '</tr></table><br />'. |
|
'<table><tr>'; |
|
foreach my $status (@ordered) { |
|
$additional .= '<th align="center">'.$usertypeshash{$status}.'</th>'; |
} |
} |
$additional .= '</tr><tr>'; |
$additional .= '</tr><tr>'; |
foreach my $status (@ordered) { |
foreach my $status (@ordered) { |
$additional .= '<td>'.&email_as_username($rowtotal,$processing,$status).'</td>'; |
$additional .= '<td align="left" valign="top">'.&email_as_username($rowtotal,$emailverified,$emaildomain,$status).'</td>'; |
} |
} |
$additional .= '</tr></table>'; |
$additional .= '</tr></table>'; |
|
|
} else { |
} else { |
$usertypeshash{'default'} = $othertitle; |
$usertypeshash{'default'} = $othertitle; |
$additional .= &email_as_username($rowtotal,$processing); |
$additional .= &mt('Approval:').' '.&validate_by_email($rowtotal,$processing).'<br />'. |
|
&mt('Username:').' '.&email_as_username($rowtotal,$emailverified,$emaildomain); |
} |
} |
$additional .= '</div>'."\n"; |
$additional .= '</div>'."\n"; |
|
|
Line 5930 sub print_selfcreation {
|
Line 5947 sub print_selfcreation {
|
return $datatable; |
return $datatable; |
} |
} |
|
|
sub email_as_username { |
sub validate_by_email { |
my ($rowtotal,$processing,$type) = @_; |
my ($rowtotal,$processing,$type) = @_; |
my %choices = |
my %choices = |
&Apache::lonlocal::texthash ( |
&Apache::lonlocal::texthash ( |
automatic => 'Automatic approval', |
automatic => 'Automatic approval', |
approval => 'Queued for approval', |
approval => 'Queued for approval', |
|
notinuse => 'Unavailable', |
); |
); |
my $output; |
my $output; |
foreach my $option ('automatic','approval') { |
my @options = ('automatic','approval'); |
|
unless ($type eq '') { |
|
push(@options,'notinuse'); |
|
} |
|
foreach my $option (@options) { |
my $checked; |
my $checked; |
if (ref($processing) eq 'HASH') { |
if (ref($processing) eq 'HASH') { |
if ($type eq '') { |
if ($type eq '') { |
Line 5983 sub email_as_username {
|
Line 6005 sub email_as_username {
|
return $output; |
return $output; |
} |
} |
|
|
|
sub email_as_username { |
|
my ($rowtotal,$emailverified,$emaildomain,$type) = @_; |
|
my %choices = |
|
&Apache::lonlocal::texthash ( |
|
email => 'Username is e-mail', |
|
other => 'Username is chosen', |
|
); |
|
my $name = 'cancreate_emailverified'; |
|
my $condition = 'cancreate_emaildomain'; |
|
if (($type ne '') && ($type ne 'default')) { |
|
$name .= '_'.$type; |
|
$condition .= '_'.$type; |
|
} |
|
my $display = 'none'; |
|
my $onclick = "toggleDisplay(this.form,'$name');"; |
|
|
|
my $output; |
|
foreach my $option ('email','other') { |
|
my ($checked,$domain); |
|
if (ref($emailverified) eq 'HASH') { |
|
if ($type eq '') { |
|
if (!exists($emailverified->{'default'})) { |
|
if ($option eq 'email') { |
|
$checked = ' checked="checked"'; |
|
} |
|
} else { |
|
if ($emailverified->{'default'} eq $option) { |
|
$checked = ' checked="checked"'; |
|
} |
|
} |
|
} else { |
|
if (!exists($emailverified->{$type})) { |
|
if ($option eq 'email') { |
|
$checked = ' checked="checked"'; |
|
} |
|
} else { |
|
if ($emailverified->{$type} eq $option) { |
|
$checked = ' checked="checked"'; |
|
if ($option eq 'other') { |
|
$display = 'inline'; |
|
} |
|
} |
|
} |
|
} |
|
} elsif ($option eq 'email') { |
|
$checked = ' checked="checked"'; |
|
} |
|
$output .= '<span class="LC_nobreak"><label>'. |
|
'<input type="radio" name="'.$name.'"'. |
|
$checked.' value="'.$option.'" onclick="'.$onclick.'" />'. |
|
$choices{$option}.'</label></span>'; |
|
if ($type eq '') { |
|
$output .= ' '; |
|
} else { |
|
$output .= '<br />'; |
|
} |
|
} |
|
my $domain; |
|
if (ref($emaildomain) eq 'HASH') { |
|
if ($type eq '') { |
|
if (exists($emaildomain->{'default'})) { |
|
$domain = $emaildomain->{'default'}; |
|
} |
|
} else { |
|
if (exists($emaildomain->{$type})) { |
|
$domain = $emaildomain->{$type}; |
|
} |
|
} |
|
} |
|
$output .= '<div id="'.$name.'" style="display: '.$display.';">'. |
|
'<span class="LC_domprefs_email">'.&mt('E-mail domain').'</span> '. |
|
'<input type="text" name="'.$condition.'" value="'.$domain.'" size="10" />'. |
|
'</div>'; |
|
$$rowtotal ++; |
|
return $output; |
|
} |
|
|
sub captcha_choice { |
sub captcha_choice { |
my ($context,$settings,$itemcount) = @_; |
my ($context,$settings,$itemcount) = @_; |
my ($keyentry,$currpub,$currpriv,%checked,$rowname,$pubtext,$privtext, |
my ($keyentry,$currpub,$currpriv,%checked,$rowname,$pubtext,$privtext, |
Line 10959 sub modify_usercreation {
|
Line 11058 sub modify_usercreation {
|
if ($key eq 'cancreate') { |
if ($key eq 'cancreate') { |
if (ref($domconfig{'usercreation'}{$key}) eq 'HASH') { |
if (ref($domconfig{'usercreation'}{$key}) eq 'HASH') { |
foreach my $item (keys(%{$domconfig{'usercreation'}{$key}})) { |
foreach my $item (keys(%{$domconfig{'usercreation'}{$key}})) { |
if (($item eq 'selfcreate') || ($item eq 'statustocreate') || |
if (($item eq 'requestcrs') || ($item eq 'course') || ($item eq 'author')) { |
($item eq 'captcha') || ($item eq 'recaptchakeys') || |
|
($item eq 'recaptchaversion')) { |
|
$save_usercreate{$key}{$item} = $domconfig{'usercreation'}{$key}{$item}; |
|
} else { |
|
$curr_usercreation{$key}{$item} = $domconfig{'usercreation'}{$key}{$item}; |
$curr_usercreation{$key}{$item} = $domconfig{'usercreation'}{$key}{$item}; |
|
} else { |
|
$save_usercreate{$key}{$item} = $domconfig{'usercreation'}{$key}{$item}; |
} |
} |
} |
} |
} |
} |
Line 11169 sub modify_usercreation {
|
Line 11266 sub modify_usercreation {
|
sub modify_selfcreation { |
sub modify_selfcreation { |
my ($dom,%domconfig) = @_; |
my ($dom,%domconfig) = @_; |
my ($resulttext,$warningmsg,%curr_usercreation,%curr_usermodify,%changes,%cancreate); |
my ($resulttext,$warningmsg,%curr_usercreation,%curr_usermodify,%changes,%cancreate); |
my (%save_usercreate,%save_usermodify); |
my (%save_usercreate,%save_usermodify,@types,%usertypes); |
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
my ($othertitle,$usertypesref,$typesref) = &Apache::loncommon::sorted_inst_types($dom); |
if (ref($types) eq 'ARRAY') { |
if (ref($typesref) eq 'ARRAY') { |
$usertypes->{'default'} = $othertitle; |
@types = @{$typesref}; |
push(@{$types},'default'); |
} |
|
unless (grep(/^default$/,@types)) { |
|
push(@types,'default'); |
} |
} |
|
if (ref($usertypesref) eq 'HASH') { |
|
%usertypes = %{$usertypesref}; |
|
} |
|
$usertypes{'default'} = $othertitle; |
# |
# |
# Retrieve current domain configuration for self-creation of usernames from $domconfig{'usercreation'}. |
# Retrieve current domain configuration for self-creation of usernames from $domconfig{'usercreation'}. |
# |
# |
Line 11184 sub modify_selfcreation {
|
Line 11287 sub modify_selfcreation {
|
if (ref($domconfig{'usercreation'}{$key}) eq 'HASH') { |
if (ref($domconfig{'usercreation'}{$key}) eq 'HASH') { |
foreach my $item (keys(%{$domconfig{'usercreation'}{$key}})) { |
foreach my $item (keys(%{$domconfig{'usercreation'}{$key}})) { |
if (($item eq 'selfcreate') || ($item eq 'statustocreate') || |
if (($item eq 'selfcreate') || ($item eq 'statustocreate') || |
($item eq 'captcha') || ($item eq 'recaptchakeys') || |
($item eq 'captcha') || ($item eq 'recaptchakeys') || |
($item eq 'recaptchaversion') || |
($item eq 'recaptchaversion') || ($item eq 'notify') || |
($item eq 'emailusername') || ($item eq 'notify') || |
($item eq 'emailusername') || ($item eq 'shibenv') || |
($item eq 'selfcreateprocessing') || ($item eq 'shibenv')) { |
($item eq 'selfcreateprocessing') || ($item eq 'emailverified') || |
|
($item eq 'emaildomain')) { |
$curr_usercreation{$key}{$item} = $domconfig{'usercreation'}{$key}{$item}; |
$curr_usercreation{$key}{$item} = $domconfig{'usercreation'}{$key}{$item}; |
} else { |
} else { |
$save_usercreate{$key}{$item} = $domconfig{'usercreation'}{$key}{$item}; |
$save_usercreate{$key}{$item} = $domconfig{'usercreation'}{$key}{$item}; |
Line 11220 sub modify_selfcreation {
|
Line 11324 sub modify_selfcreation {
|
@{$cancreate{'statustocreate'}} = (); |
@{$cancreate{'statustocreate'}} = (); |
%{$cancreate{'selfcreateprocessing'}} = (); |
%{$cancreate{'selfcreateprocessing'}} = (); |
%{$cancreate{'shibenv'}} = (); |
%{$cancreate{'shibenv'}} = (); |
|
%{$cancreate{'emailverified'}} = (); |
|
%{$cancreate{'emaildomain'}} = (); |
my %selfcreatetypes = ( |
my %selfcreatetypes = ( |
sso => 'users authenticated by institutional single sign on', |
sso => 'users authenticated by institutional single sign on', |
login => 'users authenticated by institutional log-in', |
login => 'users authenticated by institutional log-in', |
email => 'users who provide a valid e-mail address for use as username', |
email => 'users verified by e-mail', |
); |
); |
# |
# |
# Populate $cancreate{'selfcreate'} array reference with types of user, for which self-creation of user accounts |
# Populate $cancreate{'selfcreate'} array reference with types of user, for which self-creation of user accounts |
Line 11242 sub modify_selfcreation {
|
Line 11348 sub modify_selfcreation {
|
if ($item eq 'email') { |
if ($item eq 'email') { |
if ($env{'form.cancreate_email'}) { |
if ($env{'form.cancreate_email'}) { |
push(@{$cancreate{'selfcreate'}},'email'); |
push(@{$cancreate{'selfcreate'}},'email'); |
push(@contexts,'selfcreateprocessing'); |
push(@contexts,('selfcreateprocessing','emailverified','emaildomain')); |
foreach my $type (@statuses) { |
foreach my $type (@statuses) { |
if ($type eq 'default') { |
if ($type eq 'default') { |
$cancreate{'selfcreateprocessing'}{$type} = $env{'form.cancreate_emailprocess'}; |
$cancreate{'selfcreateprocessing'}{$type} = $env{'form.cancreate_emailprocess'}; |
|
unless ($cancreate{'selfcreateprocessing'}{$type} eq 'notinuse') { |
|
$cancreate{'emailverified'}{$type} = $env{'form.cancreate_emailverified'}; |
|
if ($cancreate{'emailverified'}{$type} eq 'other') { |
|
$cancreate{'emaildomain'}{$type} =$env{'form.cancreate_emaildomain'}; |
|
} |
|
} |
} else { |
} else { |
$cancreate{'selfcreateprocessing'}{$type} = $env{'form.cancreate_emailprocess_'.$type}; |
$cancreate{'selfcreateprocessing'}{$type} = $env{'form.cancreate_emailprocess_'.$type}; |
|
$cancreate{'emailverified'}{$type} = $env{'form.cancreate_emailverified_'.$type}; |
|
if ($cancreate{'emailverified'}{$type} eq 'other') { |
|
$cancreate{'emaildomain'}{$type} =$env{'form.cancreate_emaildomain_'.$type}; |
|
} |
} |
} |
} |
} |
} |
} |
Line 11266 sub modify_selfcreation {
|
Line 11382 sub modify_selfcreation {
|
|
|
if ($env{'form.cancreate_email'}) { |
if ($env{'form.cancreate_email'}) { |
push(@contexts,'emailusername'); |
push(@contexts,'emailusername'); |
if (ref($types) eq 'ARRAY') { |
if (@types) { |
foreach my $type (@{$types}) { |
foreach my $type (@types) { |
if (ref($infofields) eq 'ARRAY') { |
if (ref($infofields) eq 'ARRAY') { |
foreach my $field (@{$infofields}) { |
foreach my $field (@{$infofields}) { |
if ($env{'form.canmodify_emailusername_'.$type.'_'.$field} =~ /^(required|optional)$/) { |
if ($env{'form.canmodify_emailusername_'.$type.'_'.$field} =~ /^(required|optional)$/) { |
Line 11279 sub modify_selfcreation {
|
Line 11395 sub modify_selfcreation {
|
} |
} |
# |
# |
# Populate $cancreate{'notify'} hash ref with names of Domain Coordinators who are to be notified of |
# Populate $cancreate{'notify'} hash ref with names of Domain Coordinators who are to be notified of |
# queued requests for self-creation of account using e-mail address as username |
# queued requests for self-creation of account verified by e-mail. |
# |
# |
|
|
my @approvalnotify = &Apache::loncommon::get_env_multiple('form.selfcreationnotifyapproval'); |
my @approvalnotify = &Apache::loncommon::get_env_multiple('form.selfcreationnotifyapproval'); |
Line 11300 sub modify_selfcreation {
|
Line 11416 sub modify_selfcreation {
|
} |
} |
|
|
# |
# |
# Retrieve rules (if any) governing types of e-mail address which may be used as a username |
# Retrieve rules (if any) governing types of e-mail address which may be used to verify a username. |
# |
# |
@email_rule = &Apache::loncommon::get_env_multiple('form.email_rule'); |
@email_rule = &Apache::loncommon::get_env_multiple('form.email_rule'); |
&process_captcha('cancreate',\%changes,\%savecaptcha,$curr_usercreation{'cancreate'}); |
&process_captcha('cancreate',\%changes,\%savecaptcha,$curr_usercreation{'cancreate'}); |
Line 11347 sub modify_selfcreation {
|
Line 11463 sub modify_selfcreation {
|
# which the user may supply, if institutional data is unavailable. |
# which the user may supply, if institutional data is unavailable. |
# |
# |
if (($env{'form.cancreate_login'}) || ($env{'form.cancreate_sso'})) { |
if (($env{'form.cancreate_login'}) || ($env{'form.cancreate_sso'})) { |
if (ref($types) eq 'ARRAY') { |
if (@types) { |
if (@{$types} > 1) { |
if (@types > 1) { |
@{$cancreate{'statustocreate'}} = &Apache::loncommon::get_env_multiple('form.statustocreate'); |
@{$cancreate{'statustocreate'}} = &Apache::loncommon::get_env_multiple('form.statustocreate'); |
push(@contexts,'statustocreate'); |
push(@contexts,'statustocreate'); |
} else { |
} else { |
undef($cancreate{'statustocreate'}); |
undef($cancreate{'statustocreate'}); |
} |
} |
foreach my $type (@{$types}) { |
foreach my $type (@types) { |
my @modifiable = &Apache::loncommon::get_env_multiple('form.canmodify_'.$type); |
my @modifiable = &Apache::loncommon::get_env_multiple('form.canmodify_'.$type); |
foreach my $field (@fields) { |
foreach my $field (@fields) { |
if (grep(/^\Q$field\E$/,@modifiable)) { |
if (grep(/^\Q$field\E$/,@modifiable)) { |
Line 11365 sub modify_selfcreation {
|
Line 11481 sub modify_selfcreation {
|
} |
} |
} |
} |
if (ref($curr_usermodify{'selfcreate'}) eq 'HASH') { |
if (ref($curr_usermodify{'selfcreate'}) eq 'HASH') { |
foreach my $type (@{$types}) { |
foreach my $type (@types) { |
if (ref($curr_usermodify{'selfcreate'}{$type}) eq 'HASH') { |
if (ref($curr_usermodify{'selfcreate'}{$type}) eq 'HASH') { |
foreach my $field (@fields) { |
foreach my $field (@fields) { |
if ($save_usermodify{'selfcreate'}{$type}{$field} ne |
if ($save_usermodify{'selfcreate'}{$type}{$field} ne |
Line 11377 sub modify_selfcreation {
|
Line 11493 sub modify_selfcreation {
|
} |
} |
} |
} |
} else { |
} else { |
foreach my $type (@{$types}) { |
foreach my $type (@types) { |
push(@{$changes{'selfcreate'}},$type); |
push(@{$changes{'selfcreate'}},$type); |
} |
} |
} |
} |
Line 11435 sub modify_selfcreation {
|
Line 11551 sub modify_selfcreation {
|
} |
} |
} |
} |
} |
} |
} elsif ($item eq 'selfcreateprocessing') { |
} elsif (($item eq 'selfcreateprocessing') || ($item eq 'emailverified') || ($item eq 'emaildomain')) { |
if ($cancreate{$item}{$curr} ne $curr_usercreation{'cancreate'}{$item}{$curr}) { |
if ($cancreate{$item}{$curr} ne $curr_usercreation{'cancreate'}{$item}{$curr}) { |
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
push(@{$changes{'cancreate'}},$item); |
push(@{$changes{'cancreate'}},$item); |
Line 11523 sub modify_selfcreation {
|
Line 11639 sub modify_selfcreation {
|
if (ref($cancreate{'selfcreateprocessing'}) eq 'HASH') { |
if (ref($cancreate{'selfcreateprocessing'}) eq 'HASH') { |
$save_usercreate{'cancreate'}{'selfcreateprocessing'} = $cancreate{'selfcreateprocessing'}; |
$save_usercreate{'cancreate'}{'selfcreateprocessing'} = $cancreate{'selfcreateprocessing'}; |
} |
} |
|
if (ref($cancreate{'emailverified'}) eq 'HASH') { |
|
$save_usercreate{'cancreate'}{'emailverified'} = $cancreate{'emailverified'}; |
|
} |
|
if (ref($cancreate{'emaildomain'}) eq 'HASH') { |
|
$save_usercreate{'cancreate'}{'emaildomain'} = $cancreate{'emaildomain'}; |
|
} |
if (ref($cancreate{'statustocreate'}) eq 'ARRAY') { |
if (ref($cancreate{'statustocreate'}) eq 'ARRAY') { |
$save_usercreate{'cancreate'}{'statustocreate'} = $cancreate{'statustocreate'}; |
$save_usercreate{'cancreate'}{'statustocreate'} = $cancreate{'statustocreate'}; |
} |
} |
Line 11547 sub modify_selfcreation {
|
Line 11669 sub modify_selfcreation {
|
if (ref($changes{'cancreate'}) eq 'ARRAY') { |
if (ref($changes{'cancreate'}) eq 'ARRAY') { |
my %lt = &selfcreation_types(); |
my %lt = &selfcreation_types(); |
foreach my $type (@{$changes{'cancreate'}}) { |
foreach my $type (@{$changes{'cancreate'}}) { |
my $chgtext; |
my $chgtext = ''; |
if ($type eq 'selfcreate') { |
if ($type eq 'selfcreate') { |
if (@{$cancreate{$type}} == 0) { |
if (@{$cancreate{$type}} == 0) { |
$chgtext .= &mt('Self creation of a new user account is not permitted.'); |
$chgtext .= &mt('Self creation of a new user account is not permitted.'); |
Line 11562 sub modify_selfcreation {
|
Line 11684 sub modify_selfcreation {
|
if (grep(/^(login|sso)$/,@{$cancreate{$type}})) { |
if (grep(/^(login|sso)$/,@{$cancreate{$type}})) { |
if (ref($cancreate{'statustocreate'}) eq 'ARRAY') { |
if (ref($cancreate{'statustocreate'}) eq 'ARRAY') { |
if (@{$cancreate{'statustocreate'}} == 0) { |
if (@{$cancreate{'statustocreate'}} == 0) { |
$chgtext .= '<br />'. |
$chgtext .= '<span class="LC_warning">'. |
'<span class="LC_warning">'. |
&mt("However, no institutional affiliations (including 'other') are currently permitted to create accounts via log-in or single sign-on."). |
&mt("However, no institutional affiliations (including 'other') are currently permitted to create accounts."). |
'</span><br />'; |
'</span>'; |
} |
|
} |
|
} |
|
if (grep(/^email$/,@{$cancreate{$type}})) { |
|
if (@statuses > 1) { |
|
my $numtypes = 0; |
|
foreach my $type (@statuses) { |
|
unless ($cancreate{'selfcreateprocessing'}{$type} eq 'notinuse') { |
|
$numtypes ++; |
|
} |
|
} |
|
if (!$numtypes) { |
|
$chgtext .= '<span class="LC_warning">'. |
|
&mt("However, e-mail verification is currently set to 'unavailable' for all user types (including 'other'), so self-creation of accounts is not possible for non-institutional log-in."). |
|
'</span><br />'; |
|
|
} |
} |
} |
} |
} |
} |
Line 11573 sub modify_selfcreation {
|
Line 11710 sub modify_selfcreation {
|
} |
} |
} elsif ($type eq 'shibenv') { |
} elsif ($type eq 'shibenv') { |
if (keys(%{$cancreate{$type}}) == 0) { |
if (keys(%{$cancreate{$type}}) == 0) { |
$chgtext .= &mt('Shibboleth-autheticated user does not use environment variables to set user information'); |
$chgtext .= &mt('Shibboleth-autheticated user does not use environment variables to set user information').'<br />'; |
} else { |
} else { |
$chgtext .= &mt('Shibboleth-autheticated user information set from environment variables, as follows:'). |
$chgtext .= &mt('Shibboleth-autheticated user information set from environment variables, as follows:'). |
'<ul>'; |
'<ul>'; |
Line 11586 sub modify_selfcreation {
|
Line 11723 sub modify_selfcreation {
|
} |
} |
} |
} |
$chgtext .= '</ul>'; |
$chgtext .= '</ul>'; |
} |
} |
} elsif ($type eq 'statustocreate') { |
} elsif ($type eq 'statustocreate') { |
if ((ref($cancreate{'selfcreate'}) eq 'ARRAY') && |
if ((ref($cancreate{'selfcreate'}) eq 'ARRAY') && |
(ref($cancreate{'statustocreate'}) eq 'ARRAY')) { |
(ref($cancreate{'statustocreate'}) eq 'ARRAY')) { |
Line 11599 sub modify_selfcreation {
|
Line 11736 sub modify_selfcreation {
|
&mt("However, no institutional affiliations (including 'other') are currently permitted to create accounts."). |
&mt("However, no institutional affiliations (including 'other') are currently permitted to create accounts."). |
'</span>'; |
'</span>'; |
} |
} |
} elsif (ref($usertypes) eq 'HASH') { |
} elsif (keys(%usertypes) > 0) { |
if (grep(/^(login|sso)$/,@{$cancreate{'selfcreate'}})) { |
if (grep(/^(login|sso)$/,@{$cancreate{'selfcreate'}})) { |
$chgtext .= &mt('Creation of a new account for an institutional user is restricted to the following institutional affiliation(s):'); |
$chgtext .= &mt('Creation of a new account for an institutional user is restricted to the following institutional affiliation(s):'); |
} else { |
} else { |
Line 11610 sub modify_selfcreation {
|
Line 11747 sub modify_selfcreation {
|
if ($case eq 'default') { |
if ($case eq 'default') { |
$chgtext .= '<li>'.$othertitle.'</li>'; |
$chgtext .= '<li>'.$othertitle.'</li>'; |
} else { |
} else { |
$chgtext .= '<li>'.$usertypes->{$case}.'</li>'; |
$chgtext .= '<li>'.$usertypes{$case}.'</li>'; |
} |
} |
} |
} |
$chgtext .= '</ul>'; |
$chgtext .= '</ul>'; |
if (!grep(/^(login|sso)$/,@{$cancreate{'selfcreate'}})) { |
if (!grep(/^(login|sso)$/,@{$cancreate{'selfcreate'}})) { |
$chgtext .= '<br /><span class="LC_warning">'. |
$chgtext .= '<span class="LC_warning">'. |
&mt('However, users authenticated by institutional login/single sign on are not currently permitted to create accounts.'). |
&mt('However, users authenticated by institutional login/single sign on are not currently permitted to create accounts.'). |
'</span>'; |
'</span>'; |
} |
} |
Line 11627 sub modify_selfcreation {
|
Line 11764 sub modify_selfcreation {
|
$chgtext .= &mt('Although institutional affiliations permitted to create accounts were changed, self creation of accounts is not currently permitted for any authentication types.'); |
$chgtext .= &mt('Although institutional affiliations permitted to create accounts were changed, self creation of accounts is not currently permitted for any authentication types.'); |
} |
} |
} |
} |
|
$chgtext .= '<br />'; |
} |
} |
} elsif ($type eq 'selfcreateprocessing') { |
} elsif ($type eq 'selfcreateprocessing') { |
my %choices = &Apache::lonlocal::texthash ( |
my %choices = &Apache::lonlocal::texthash ( |
automatic => 'Automatic approval', |
automatic => 'Automatic approval', |
approval => 'Queued for approval', |
approval => 'Queued for approval', |
|
notinuse => 'Unavailable', |
); |
); |
if (@statuses > 1) { |
if (@statuses > 1) { |
$chgtext .= &mt('Processing of requests to create account with e-mail address as username set as follows:'). |
my $numtypes = 0; |
'<ul>'; |
foreach my $type (@statuses) { |
foreach my $type (@statuses) { |
unless ($cancreate{'selfcreateprocessing'}{$type} eq 'notinuse') { |
if ($type eq 'default') { |
$numtypes ++; |
$chgtext .= '<li>'.$othertitle.' -- '.$choices{$cancreate{'selfcreateprocessing'}{$type}}.'</li>'; |
} |
} else { |
} |
$chgtext .= '<li>'.$usertypes->{$type}.' -- '.$choices{$cancreate{'selfcreateprocessing'}{$type}}.'</li>'; |
if ($numtypes) { |
} |
$chgtext .= &mt('Processing of requests to create account with e-mail verification set as follows:'). |
} |
'<ul>'; |
$chgtext .= '</ul>'; |
foreach my $type (@statuses) { |
|
if ($type eq 'default') { |
|
$chgtext .= '<li>'.$othertitle.' -- '.$choices{$cancreate{'selfcreateprocessing'}{$type}}.'</li>'; |
|
} else { |
|
$chgtext .= '<li>'.$usertypes{$type}.' -- '.$choices{$cancreate{'selfcreateprocessing'}{$type}}.'</li>'; |
|
} |
|
} |
|
$chgtext .= '</ul>'; |
|
} |
} else { |
} else { |
$chgtext .= &mt('Processing of requests to create account with e-mail address as username set to: "[_1]"', |
$chgtext .= &mt('Processing of requests to create account with e-mail verification set to: "[_1]"', |
$choices{$cancreate{'selfcreateprocessing'}{'default'}}); |
$choices{$cancreate{'selfcreateprocessing'}{'default'}}); |
|
} |
|
} elsif ($type eq 'emailverified') { |
|
my %options = &Apache::lonlocal::texthash ( |
|
email => 'Username is e-mail', |
|
other => 'Username is chosen', |
|
); |
|
if (@statuses > 1) { |
|
my $numtypes = 0; |
|
foreach my $type (@statuses) { |
|
unless ($cancreate{'selfcreateprocessing'}{$type} eq 'notinuse') { |
|
$numtypes ++; |
|
} |
|
} |
|
if ($numtypes) { |
|
$chgtext .= &mt('For self-created accounts verified by e-mail address, username is set as follows:'). |
|
'<ul>'; |
|
foreach my $type (@statuses) { |
|
next if ($cancreate{'selfcreateprocessing'}{$type} eq 'notinuse'); |
|
if ($type eq 'default') { |
|
$chgtext .= '<li>'.$othertitle.' -- '.$options{$cancreate{'emailverified'}{$type}}.'</li>'; |
|
} else { |
|
$chgtext .= '<li>'.$usertypes{$type}.' -- '.$options{$cancreate{'emailverified'}{$type}}.'</li>'; |
|
} |
|
} |
|
$chgtext .= '</ul>'; |
|
} |
|
} else { |
|
$chgtext .= &mt('For self-created accounts verified by e-mail address: "[_1]"', |
|
$choices{$cancreate{'emailverified'}{'default'}}); |
|
} |
|
} elsif ($type eq 'emaildomain') { |
|
if (@statuses > 1) { |
|
my $numtypes = 0; |
|
foreach my $type (@statuses) { |
|
unless ($cancreate{'selfcreateprocessing'}{$type} eq 'notinuse') { |
|
if ($cancreate{'emailverified'}{$type} eq 'other') { |
|
$numtypes ++; |
|
} |
|
} |
|
} |
|
if ($numtypes) { |
|
$chgtext .= &mt('For self-created accounts verified by e-mail address, with username chosen by user ...'). |
|
'<ul>'; |
|
foreach my $type (@statuses) { |
|
next if (($cancreate{'selfcreateprocessing'}{$type} eq 'notinuse') || |
|
($cancreate{'emailverified'}{$type} eq 'email')); |
|
if ($type eq 'default') { |
|
if ($cancreate{'emaildomain'}{$type} eq '') { |
|
$chgtext .= '<li>'.$othertitle.' -- '.&mt('No restriction on e-mail domain').'</li>'; |
|
} else { |
|
$chgtext .= '<li>'.$othertitle.' -- '.&mt("User's e-mail domain needs to be: [_1]", |
|
$cancreate{'emaildomain'}{$type}).'</li>'; |
|
} |
|
} else { |
|
if ($cancreate{'emaildomain'}{$type} eq '') { |
|
$chgtext .= '<li>'.$usertypes{$type}.' -- '.&mt('No restriction on e-mail domain').'</li>'; |
|
} else { |
|
$chgtext .= '<li>'.$usertypes{$type}.' -- '.&mt("User's e-mail domain needs to be: [_1]", |
|
$cancreate{'emaildomain'}{$type}).'</li>'; |
|
} |
|
} |
|
} |
|
$chgtext .= '</ul>'; |
|
} |
|
} else { |
|
if ($cancreate{'emailverified'}{'default'} eq 'other') { |
|
if ($cancreate{'emaildomain'}{'default'} eq '') { |
|
$chgtext .= &mt('No restriction on e-mail domain for self-created accounts verified by e-mail address, where username is chosen by user.'); |
|
} else { |
|
$chgtext .= &mt('For self-created accounts verified by e-mail address, where username is chosen by user, e-mail domain needs to be: [_1], |
|
$cancreate{'selfcreateprocessing'}{'default'}); |
|
} |
|
} |
} |
} |
} elsif ($type eq 'captcha') { |
} elsif ($type eq 'captcha') { |
if ($savecaptcha{$type} eq 'notused') { |
if ($savecaptcha{$type} eq 'notused') { |
Line 11683 sub modify_selfcreation {
|
Line 11903 sub modify_selfcreation {
|
} |
} |
} elsif ($type eq 'emailusername') { |
} elsif ($type eq 'emailusername') { |
if (ref($cancreate{'emailusername'}) eq 'HASH') { |
if (ref($cancreate{'emailusername'}) eq 'HASH') { |
if (ref($types) eq 'ARRAY') { |
if (@types) { |
foreach my $type (@{$types}) { |
foreach my $type (@types) { |
if (ref($cancreate{'emailusername'}{$type}) eq 'HASH') { |
if (ref($cancreate{'emailusername'}{$type}) eq 'HASH') { |
if (keys(%{$cancreate{'emailusername'}{$type}}) > 0) { |
if (keys(%{$cancreate{'emailusername'}{$type}}) > 0) { |
$chgtext .= &mt('When self-creating account with e-mail as username, the following information will be provided by [_1]:',"'$usertypes->{$type}'"). |
$chgtext .= &mt('When self-creating account with e-mail verification, the following information will be provided by [_1]:',"'$usertypes{$type}'"). |
'<ul>'; |
'<ul>'; |
foreach my $field (@{$infofields}) { |
foreach my $field (@{$infofields}) { |
if ($cancreate{'emailusername'}{$type}{$field}) { |
if ($cancreate{'emailusername'}{$type}{$field}) { |
Line 11696 sub modify_selfcreation {
|
Line 11916 sub modify_selfcreation {
|
} |
} |
$chgtext .= '</ul>'; |
$chgtext .= '</ul>'; |
} else { |
} else { |
$chgtext .= &mt('When self creating account with e-mail as username, no information besides e-mail address will be provided by [_1].',"'$usertypes->{$type}'").'<br />'; |
$chgtext .= &mt('When self creating account with e-mail verification, no information besides e-mail address will be provided by [_1].',"'$usertypes{$type}'").'<br />'; |
} |
} |
} else { |
} else { |
$chgtext .= &mt('When self creating account with e-mail as username, no information besides e-mail address will be provided by [_1].',"'$usertypes->{$type}'").'<br />'; |
$chgtext .= &mt('When self creating account with e-mail verification, no information besides e-mail address will be provided by [_1].',"'$usertypes{$type}'").'<br />'; |
} |
} |
} |
} |
} |
} |
} |
} |
} elsif ($type eq 'notify') { |
} elsif ($type eq 'notify') { |
$chgtext = &mt('No Domain Coordinators will receive notification of username requests requiring approval.'); |
my $numapprove = 0; |
if (ref($changes{'cancreate'}) eq 'ARRAY') { |
if (ref($changes{'cancreate'}) eq 'ARRAY') { |
if ((grep(/^notify$/,@{$changes{'cancreate'}})) && (ref($cancreate{'notify'}) eq 'HASH')) { |
if ((grep(/^notify$/,@{$changes{'cancreate'}})) && (ref($cancreate{'notify'}) eq 'HASH')) { |
if ($cancreate{'notify'}{'approval'}) { |
if ($cancreate{'notify'}{'approval'}) { |
$chgtext = &mt('Notification of username requests requiring approval will be sent to: ').$cancreate{'notify'}{'approval'}; |
$chgtext .= &mt('Notification of username requests requiring approval will be sent to: ').$cancreate{'notify'}{'approval'}; |
|
$numapprove ++; |
} |
} |
} |
} |
} |
} |
|
unless ($numapprove) { |
|
$chgtext .= &mt('No Domain Coordinators will receive notification of username requests requiring approval.'); |
|
} |
} |
} |
if ($chgtext) { |
if ($chgtext) { |
$resulttext .= '<li>'.$chgtext.'</li>'; |
$resulttext .= '<li>'.$chgtext.'</li>'; |
Line 11731 sub modify_selfcreation {
|
Line 11955 sub modify_selfcreation {
|
$chgtext .= '</ul>'; |
$chgtext .= '</ul>'; |
if (@email_rule > 0) { |
if (@email_rule > 0) { |
$resulttext .= '<li>'. |
$resulttext .= '<li>'. |
&mt('Accounts may not be created by users self-enrolling with e-mail addresses of the following types: '). |
&mt('Accounts may not be created by users verified by e-mail, for e-mail addresses of the following types: '). |
$chgtext. |
$chgtext. |
'</li>'; |
'</li>'; |
} else { |
} else { |
$resulttext .= '<li>'. |
$resulttext .= '<li>'. |
&mt('There are now no restrictions on e-mail addresses which may be used as a username when self-enrolling.'). |
&mt('There are now no restrictions on e-mail addresses which may be used for verification when self-enrolling.'). |
'</li>'; |
'</li>'; |
} |
} |
} |
} |
Line 11745 sub modify_selfcreation {
|
Line 11969 sub modify_selfcreation {
|
my %fieldtitles = &Apache::loncommon::personal_data_fieldtitles(); |
my %fieldtitles = &Apache::loncommon::personal_data_fieldtitles(); |
foreach my $type (@{$changes{'selfcreate'}}) { |
foreach my $type (@{$changes{'selfcreate'}}) { |
my $typename = $type; |
my $typename = $type; |
if (ref($usertypes) eq 'HASH') { |
if (keys(%usertypes) > 0) { |
if ($usertypes->{$type} ne '') { |
if ($usertypes{$type} ne '') { |
$typename = $usertypes->{$type}; |
$typename = $usertypes{$type}; |
} |
} |
} |
} |
my @modifiable; |
my @modifiable; |
Line 15248 function toggleDisplay(domForm,caller) {
|
Line 15472 function toggleDisplay(domForm,caller) {
|
var optionsElement = domForm.coursecredits; |
var optionsElement = domForm.coursecredits; |
var checkval = 1; |
var checkval = 1; |
var dispval = 'block'; |
var dispval = 'block'; |
|
var selfcreateRegExp = /^cancreate_emailverified/; |
if (caller == 'emailoptions') { |
if (caller == 'emailoptions') { |
optionsElement = domForm.cancreate_email; |
optionsElement = domForm.cancreate_email; |
} |
} |
Line 15258 function toggleDisplay(domForm,caller) {
|
Line 15483 function toggleDisplay(domForm,caller) {
|
optionsElement = domForm.canclone; |
optionsElement = domForm.canclone; |
checkval = 'instcode'; |
checkval = 'instcode'; |
} |
} |
|
if (selfcreateRegExp.test(caller)) { |
|
optionsElement = domForm.elements[caller]; |
|
checkval = 'other'; |
|
dispval = 'inline' |
|
} |
if (optionsElement.length) { |
if (optionsElement.length) { |
var currval; |
var currval; |
for (var i=0; i<optionsElement.length; i++) { |
for (var i=0; i<optionsElement.length; i++) { |