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

raeburn raeburn at source.lon-capa.org
Sun May 5 00:00:42 EDT 2019


raeburn		Sun May  5 04:00:42 2019 EDT

  Modified files:              
    /loncom/interface	createaccount.pm lonuserutils.pm 
  Log:
  - Rules for length and/or characters in a LON-CAPA password (internal auth)
    checked client-side when a user self-creates a user account.
  
  
Index: loncom/interface/createaccount.pm
diff -u loncom/interface/createaccount.pm:1.76 loncom/interface/createaccount.pm:1.77
--- loncom/interface/createaccount.pm:1.76	Sun Nov 12 20:42:52 2017
+++ loncom/interface/createaccount.pm	Sun May  5 04:00:42 2019
@@ -4,7 +4,7 @@
 # kerberos, or SSO) or an e-mail address. Requests to use an e-mail address as
 # username may be processed automatically, or may be queued for approval.
 #
-# $Id: createaccount.pm,v 1.76 2017/11/12 20:42:52 raeburn Exp $
+# $Id: createaccount.pm,v 1.77 2019/05/05 04:00:42 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -37,6 +37,7 @@
 use Apache::lonnet;
 use Apache::loncommon;
 use Apache::lonhtmlcommon;
+use Apache::lonuserutils;
 use Apache::lonlocal;
 use Apache::lonauth;
 use Apache::resetpw;
@@ -520,10 +521,12 @@
 }
 
 sub javascript_checkpass {
-    my ($now,$context) = @_;
+    my ($now,$context,$domain) = @_;
     my $nopass = &mt('You must enter a password.');
     my $mismatchpass = &mt('The passwords you entered did not match.')."\n".
                        &mt('Please try again.'); 
+    my ($numrules,$intargjs) =
+        &Apache::lonuserutils::passwd_validation_js('upass',$domain);
     &js_escape(\$nopass);
     &js_escape(\$mismatchpass);
     my $js = <<"ENDSCRIPT";
@@ -540,6 +543,10 @@
                 return false;
             }
             if (upass == upasscheck) {
+                var numrules = $numrules;
+                if (numrules > 0) {
+$intargjs
+                }
                 client.elements.upasscheck$now.value='';
                 if (validate_email(client)) {
                     send(one,two,'$context');
@@ -1096,7 +1103,7 @@
         close($jsh);
         $output = &javascript_setforms($now,$emailusername,$captcha,$usertype,$recaptchaversion,
                                        $usernameset,$condition,$excluded).
-                  "\n".&javascript_checkpass($now,'email');
+                  "\n".&javascript_checkpass($now,'email',$domain);
         my ($lkey,$ukey) = &Apache::loncommon::des_keys();
         my ($lextkey,$uextkey) = &getkeys($lkey,$ukey);
         my $logtoken=Apache::lonnet::reply('tmpput:'.$ukey.$lkey.'&createaccount:createaccount',
Index: loncom/interface/lonuserutils.pm
diff -u loncom/interface/lonuserutils.pm:1.196 loncom/interface/lonuserutils.pm:1.197
--- loncom/interface/lonuserutils.pm:1.196	Sat May  4 19:57:29 2019
+++ loncom/interface/lonuserutils.pm	Sun May  5 04:00:42 2019
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Utility functions for managing LON-CAPA user accounts
 #
-# $Id: lonuserutils.pm,v 1.196 2019/05/04 19:57:29 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.197 2019/05/05 04:00:42 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -773,7 +773,7 @@
             if (rulesmsg != '') {
                 rulesmsg = '$alertmsg'+rulesmsg;
                 alert(rulesmsg);
-                return;
+                return false;
             }
 |;
     }




More information about the LON-CAPA-cvs mailing list