[rt-users] Help with local custom login x javascript

Luciano Ernesto da Silva luciano at cpd.ufrgs.br
Tue May 15 15:37:16 EDT 2012


Hello,

An early time ago, I made motifications on ExternalAUTH LDAP to be possible autenticate using numeric uids users. For example, the numeric uid 001236456 can authenticate from a LDAP server. In the RT side it has a real id user with A00123456. The mofication makes a 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 00123456, and would be nice for them put only "123456" without the zeros. We adjusted a javascript function for that.

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


In Login elemnt 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;
        }
   };


But I'm not getting that, the javascript function is not called when "submit" is called, is there another way to call the javascript function formatUIDnumber before it sends $user and $pass? Can you give some direction, the right way, please?



More information about the rt-users mailing list