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

www www at source.lon-capa.org
Thu May 17 14:05:42 EDT 2012


www		Thu May 17 18:05:42 2012 EDT

  Modified files:              
    /loncom/interface	createaccount.pm 
  Log:
  Documentation
  
  
Index: loncom/interface/createaccount.pm
diff -u loncom/interface/createaccount.pm:1.49 loncom/interface/createaccount.pm:1.50
--- loncom/interface/createaccount.pm:1.49	Thu May 17 17:41:48 2012
+++ loncom/interface/createaccount.pm	Thu May 17 18:05:42 2012
@@ -3,7 +3,7 @@
 # institutional log-in ID (institutional authentication required - localauth
 #  or kerberos) or an e-mail address.
 #
-# $Id: createaccount.pm,v 1.49 2012/05/17 17:41:48 www Exp $
+# $Id: createaccount.pm,v 1.50 2012/05/17 18:05:42 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -683,7 +683,11 @@
     return;
 }
 
-
+#
+# The screen that the user gets to create his or her account
+# Desired username, desired password, etc
+# Stores token to store DES-key and stage during creation session
+#
 sub print_dataentry_form {
     my ($r,$domain,$lonhost,$include,$mailtoken,$now,$username,$start_page) = @_;
     my ($error,$output);
@@ -763,6 +767,10 @@
     return $output;
 }
 
+#
+# Retrieve rules for generating accounts from domain configuration
+# Can the user make a new account or just self-enroll?
+
 sub get_creation_controls {
     my ($domain,$usercreation) = @_;
     my (@cancreate, at statustocreate);
@@ -802,8 +810,12 @@
 
 sub create_account {
     my ($r,$domain,$lonhost,$username,$domdesc) = @_;
+# Get the token info
     my ($retrieved,$output,$upass) = &process_credentials($env{'form.logtoken'},
                                                           $env{'form.serverid'}); 
+# $retrieved is 'ok' if things worked
+# $output is user error output
+# $upass is the decrypted password
     # Error messages
     my $error     = '<span class="LC_error">'.&mt('Error:').' ';
     my $end       = '</span><br /><br />';
@@ -812,6 +824,7 @@
                     &Apache::loncommon::end_page();
     if ($retrieved eq 'ok') {
         if ($env{'form.courseid'} ne '') {
+# See if we are allowed to use this username per domain rules (number of characters, etc)
             my ($result,$userchkmsg) = &check_id($username,$domain,$domdesc);
             if ($result eq 'fail') {
                 $output = $error.&mt('Invalid ID format').$end.
@@ -822,13 +835,17 @@
     } else {
         return ('fail',$error.$output.$end.$rtnlink);
     }
-    # Call modifyuser
+    # Yes! We can do this. Valid token, valid username format
+    # Create an internally authenticated account with password $upass 
+    # if the account does not exist yet
+    # Assign student/staff number $env{'form.cid'}, first name, last name, etc
     my $result = 
         &Apache::lonnet::modifyuser($domain,$username,$env{'form.cid'},
                                     'internal',$upass,$env{'form.cfirstname'},
                                     $env{'form.cmiddlename'},$env{'form.clastname'},
                                     $env{'form.cgeneration'},undef,undef,$username);
     $output = &mt('Generating user: [_1]',$result);
+    # Now that the user exists, we can have a homeserver
     my $uhome = &Apache::lonnet::homeserver($username,$domain);
     $output .= '<br />'.&mt('Home server: [_1]',$uhome).' '.
               &Apache::lonnet::hostname($uhome).'<br /><br />';
@@ -1098,6 +1115,9 @@
 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}} = (




More information about the LON-CAPA-cvs mailing list