The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Decrease MAX_LENGTH_USERNAME from 16 to 8 - cPanel ver 11.44

Discussion in 'cPanel Developers' started by Eltawoos, Aug 7, 2014.

  1. Eltawoos

    Eltawoos Member

    Joined:
    Apr 19, 2014
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Dears,

    I've searched for how to decrease the max length for username on cPanel ver 11.44.1 from 16 to 8 characters.
    I've changed for /usr/local/cpanel/whostmgr/docroot/templates/createacct.tmpl
    and
    /usr/local/cpanel/whostmgr/docroot/templates/createacmaxlength="8"ct2.tmpl
    for line maxlength="16" to maxlength="8".

    I'm also change the MAX_LENGTH_USERNAME var on this file
    /usr/local/cpanel/whostmgr/docroot/templates/accounts/createacct.min.js
    and
    /usr/local/cpanel/whostmgr/docroot/templates/accounts/createacct.js

    Now, When i try to write username it's actually saved for 8 characters only, But when i'm standing on the domain field and try to click TAP button on key board, it's copy all of domain characters to username field with 16 characters !

    Kindly advise any help me.
     
  2. cPAndrewHodge

    cPAndrewHodge cPanel UI Developer
    Staff Member

    Joined:
    Dec 10, 2012
    Messages:
    52
    Likes Received:
    3
    Trophy Points:
    8
    cPanel Access Level:
    Root Administrator
    First off as a warning I believe cPanel update may overwrite any changes you make, so keep an eye out on that. That said, your browser autofill may be ignoring the maxlength attribute. What browser and version are you using?


    Also it looks like you only need to modify createacct.min.js(it is built automatically and distributed with WHM but we leave the original createacct.js there in case you want to poke around). To test instead of trying to tab autofill type out a domain length and see if it throws validation warnings for being larger than 8 characters.
     
  3. Eltawoos

    Eltawoos Member

    Joined:
    Apr 19, 2014
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    When i try to modify "createacct.min.js" i don't see any affcted on the WHM !!
    Please advice if i need to run any commands after change on "createacct.min.js"
     
  4. michaelbarvixe

    michaelbarvixe Registered

    Joined:
    Oct 10, 2014
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hello Eltawoos,

    I wrote a WHM hook to do just that, as the new length limit was causing problems internally. If you want to take a look at it, it's available here:

    /https://github.com/santium/cPanel/tree/master/UserLength
     

Share This Page