[rt-users] Login page + Javascript function

Luciano Ernesto da Silva luciano at cpd.ufrgs.br
Mon May 14 13:01:35 EDT 2012


A time ago, I made motifications on ExternalAUTH LDAP to be posible autenticate numeric users. For example, the numeric uid 123645678 can authenticate from a LDAP server. In the RT side it has a real id user with A12345678. The mofication concat a word in front uid and its ok for RT and LDAP. 

Now I'm trying remove the need of the user put all numeric numbers on login. This a local motification, or callback. I have many users in format 00001234, and would be nice for them put only "1234" without the zeros. We have a javascript function for that.

I made a copy of Elements/Login for local customizations.


In Login i modified this around line 105(RT 4.0.2.):

<div class="button-row">
    <span class="input"><input type="submit" onSubmit=formatUIDnumber(this.user,8); class="button" value="<&|/l&>Login</&>" /> </span>
</div>


My javascript function(inside Login), that checks if the numeric matchs 8 length. If not, put more 0 to complete:


function formatUIDnumber(UID,sizeOK){
          if IsNumeric(UID.value){
          newUID = UID.value;
        zeros = '';
          var i = newUID.length;
          if(newUID.length==sizeOK) return;
           else {
                 for(i; i<sizeOK; i++){
                       zeros = zeros + "0";
                }
                newUID = zeros + newUID;
          }
           UID.value = newUID;
           return;
        }
   };


My intention is check if it has 8 numbers, if not put zeros ahead. Not getting that, the javascript function is not called when "submit" is called, is there another way to do that? Can you give some direction, the right way?

Att.

Luciano




More information about the rt-users mailing list