--- loncom/interface/loncreateuser.pm 2017/07/26 19:45:45 1.442
+++ loncom/interface/loncreateuser.pm 2017/08/03 16:22:09 1.443
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.442 2017/07/26 19:45:45 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.443 2017/08/03 16:22:09 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2352,7 +2352,7 @@ sub modify_login_block {
sub personal_data_display {
my ($ccuname,$ccdomain,$newuser,$context,$inst_results,$rolesarray,
- $now,$captchaform,$emailusername,$usertype,$usernameset,$condition) = @_;
+ $now,$captchaform,$emailusername,$usertype,$usernameset,$condition,$excluded) = @_;
my ($output,%userenv,%canmodify,%canmodify_status);
my @userinfo = ('firstname','middlename','lastname','generation',
'permanentemail','id');
@@ -2428,16 +2428,38 @@ sub personal_data_display {
$output = '
'.$lt{'pd'}.'
'.
&Apache::lonhtmlcommon::start_pick_box();
if (($context eq 'selfcreate') && ($newuser eq 'email')) {
+ my $size = 25;
if ($condition) {
- if ($condition =~ /[-\w]+\.[-\w]+$/) {
- $condition = '@'.$condition;
+ if ($condition =~ /^\@[^\@]+$/) {
+ $size = 10;
} else {
undef($condition);
}
+ }
+ if ($excluded) {
+ unless ($excluded =~ /^\@[^\@]+$/) {
+ undef($condition);
+ }
}
$output .= &Apache::lonhtmlcommon::row_title($lt{'email'}.'*',undef,
'LC_oddrow_value')."\n".
- '';
+ '';
+ if ($condition) {
+ $output .= $condition;
+ } elsif ($excluded) {
+ $output .= '
'.&mt('You must use an e-mail address that does not end with [_1]',
+ $excluded).'';
+ }
+ if ($usernameset eq 'first') {
+ $output .= '
';
+ if ($condition) {
+ $output .= &mt('Your username in LON-CAPA will be the part of your e-mail address before [_1]',
+ $condition);
+ } else {
+ $output .= &mt('Your username in LON-CAPA will be the part of your e-mail address before the @');
+ }
+ $output .= '';
+ }
$rowcount ++;
$output .= &Apache::lonhtmlcommon::row_closure(1);
my $upassone = '';
@@ -2452,8 +2474,8 @@ sub personal_data_display {
'LC_oddrow_value')."\n".
$upasstwo.
&Apache::lonhtmlcommon::row_closure()."\n";
- if ($usernameset) {
- my $onclick = "toggleDisplay(this,'selfcreateusername');";
+ if ($usernameset eq 'free') {
+ my $onclick = "toggleUsernameDisp(this,'selfcreateusername');";
$output .= &Apache::lonhtmlcommon::row_title($lt{'username'},undef,'LC_oddrow_value')."\n".
&mt('Use e-mail address: ').
''."\n".
@@ -4943,13 +4965,17 @@ sub handler {
my ($showstatus,$showemail,$pickstart);
my $numextras = 0;
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
- if (ref($usertypes) eq 'HASH') {
- if ($usertypes->{$usertype}) {
- $showstatus = $usertypes->{$usertype};
- } else {
- $showstatus = $othertitle;
+ if ((ref($types) eq 'ARRAY') && (@{$types} > 0)) {
+ if (ref($usertypes) eq 'HASH') {
+ if ($usertypes->{$usertype}) {
+ $showstatus = $usertypes->{$usertype};
+ } else {
+ $showstatus = $othertitle;
+ }
+ if ($showstatus) {
+ $numextras ++;
+ }
}
- $numextras ++;
}
if (($info{$uname}{'email'} ne '') && ($info{$uname}{'email'} ne $uname)) {
$showemail = $info{$uname}{'email'};