[LON-CAPA-cvs] cvs: loncom /interface loncreateuser.pm

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 23 Nov 2006 00:53:20 -0000


albertel		Wed Nov 22 19:53:20 2006 EDT

  Modified files:              
    /loncom/interface	loncreateuser.pm 
  Log:
  - switch to using new cleaing routines
  
  
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.137 loncom/interface/loncreateuser.pm:1.138
--- loncom/interface/loncreateuser.pm:1.137	Wed Nov 22 19:04:09 2006
+++ loncom/interface/loncreateuser.pm	Wed Nov 22 19:53:19 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.137 2006/11/23 00:04:09 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.138 2006/11/23 00:53:19 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -216,11 +216,8 @@
 # =================================================================== Phase two
 sub print_user_modification_page {
     my $r=shift;
-    my $ccuname=$env{'form.ccuname'};
-    my $ccdomain=$env{'form.ccdomain'};
-
-    $ccuname=~s/\W//g;
-    $ccdomain=~s/\W//g;
+    my $ccuname =&LONCAPA::clean_username($env{'form.ccuname'});
+    my $ccdomain=&LONCAPA::clean_domain($env{'form.ccdomain'});
 
     unless (($ccuname) && ($ccdomain)) {
 	&print_username_entry_form($r);
@@ -238,9 +235,9 @@
                   );
     $loginscript  = &Apache::loncommon::authform_header(%param);
     $authformkrb  = &Apache::loncommon::authform_kerberos(%param);
-
-    $ccuname=~s/\W//g;
-    $ccdomain=~s/\W//g;
+						 
+    $ccuname =&LONCAPA::clean_username($ccuname);
+    $ccdomain=&LONCAPA::clean_domain($ccdomain);
     my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition();
     my $dc_setcourse_code = '';
     my $nondc_setsection_code = '';                                        
@@ -1029,7 +1026,8 @@
 	$r->print($error.&mt('No login name specified').'.'.$end);
 	return;
     }
-    if (  $env{'form.ccuname'}  =~/\W/) {
+    if (  $env{'form.ccuname'} ne 
+	  &LONCAPA::clean_username($env{'form.ccuname'}) ) {
 	$r->print($error.&mt('Invalid login name').'.  '.
 		  &mt('Only letters, numbers, and underscores are valid').'.'.
 		  $end);
@@ -1039,9 +1037,10 @@
 	$r->print($error.&mt('No domain specified').'.'.$end);
 	return;
     }
-    if (  $env{'form.ccdomain'} =~/\W/) {
+    if (  $env{'form.ccdomain'} ne
+	  &LONCAPA::clean_domain($env{'form.ccdomain'}) ) {
 	$r->print($error.&mt ('Invalid domain name').'.  '.
-		  &mt('Only letters, numbers, and underscores are valid').'.'.
+		  &mt('Only letters, numbers, periods, dashes, and underscores are valid').'.'.
 		  $end);
 	return;
     }