[freeside-commits] freeside/httemplate/edit svc_acct.cgi, 1.53, 1.54

Mark Wells mark at wavetail.420.am
Thu Nov 12 13:45:09 PST 2009


Update of /home/cvs/cvsroot/freeside/httemplate/edit
In directory wavetail.420.am:/tmp/cvs-serv3856/httemplate/edit

Modified Files:
	svc_acct.cgi 
Log Message:
Add default password encoding option

Index: svc_acct.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/svc_acct.cgi,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- svc_acct.cgi	23 Mar 2009 22:45:42 -0000	1.53
+++ svc_acct.cgi	12 Nov 2009 21:45:07 -0000	1.54
@@ -9,6 +9,18 @@
   <BR>
 % } 
 
+<SCRIPT TYPE="text/javascript">
+function randomPass() {
+  var i=0;
+  var pw_set='<% join('', 'a'..'z', 'A'..'Z', '0'..'9', '.', '/') %>';
+  var pass='';
+  while(i < 8) {
+    i++;
+    pass += pw_set.charAt(Math.floor(Math.random() * pw_set.length));
+  }
+  document.OneTrueForm.clear_password.value = pass;
+}
+</SCRIPT>
 
 <FORM NAME="OneTrueForm" ACTION="<% $p1 %>process/svc_acct.cgi" METHOD=POST>
 <INPUT TYPE="hidden" NAME="svcnum" VALUE="<% $svcnum %>">
@@ -35,13 +47,14 @@
 <TR>
   <TD ALIGN="right">Password</TD>
   <TD>
-    <INPUT TYPE="text" NAME="_password" VALUE="<% $password %>" SIZE=<% $pmax2 %> MAXLENGTH=<% $pmax %>>
-    (blank to generate)
+    <INPUT TYPE="text" NAME="clear_password" VALUE="<% $password %>" SIZE=<% $pmax2 %> MAXLENGTH=<% $pmax %>>
+    <INPUT TYPE="button" VALUE="Randomize" onclick="randomPass();">
   </TD>
 </TR>
 %}else{
-    <INPUT TYPE="hidden" NAME="_password" VALUE="<% $password %>">
+    <INPUT TYPE="hidden" NAME="clear_password" VALUE="<% $password %>">
 %}
+<INPUT TYPE="hidden" NAME="_password_encoding" VALUE="<% $password_encoding %>">
 %
 %my $sec_phrase = $svc_acct->sec_phrase;
 %if ( $conf->exists('security_phrase') 
@@ -428,14 +441,21 @@
 
 my $username = $svc_acct->username;
 my $password;
-if ( $svc_acct->_password ) {
-  if ( $conf->exists('showpasswords') || ! $svcnum ) {
-    $password = $svc_acct->_password;
-  } else {
-    $password = "*HIDDEN*";
+my $password_encryption = $svc_acct->_password_encryption;
+my $password_encoding = $svc_acct->_password_encoding;
+
+if($svcnum) {
+  if($password = $svc_acct->get_cleartext_password) {
+    if (! $conf->exists('showpasswords')) {
+        $password = '*HIDDEN*';
+    }
+  }
+  elsif($svc_acct->_password and $password_encryption ne 'plain') {
+    $password = "(".uc($password_encryption)." encrypted)";
+  }
+  else {
+    $password = '';
   }
-} else {
-  $password = '';
 }
 
 my $ulen = 
@@ -444,9 +464,13 @@
   : dbdef->table('svc_acct')->column('username')->length;
 my $ulen2 = $ulen+2;
 
-my $pmax = $conf->config('passwordmax') || 8;
+my $pmax = max($conf->config('passwordmax') || 13);
 my $pmax2 = $pmax+2;
 
 my $p1 = popurl(1);
 
+sub max {
+  (sort(@_))[-1]
+}
+
 </%init>



More information about the freeside-commits mailing list