Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

500: allow longer usernames in frontend #7

Open
wants to merge 1 commit into
base: pu
Choose a base branch
from

Conversation

johnpink
Copy link

Fixes issue #500

@johnpink
Copy link
Author

When trying to add a new member with username length greater than 14, the GUI won't let you because of a hard-coded values.

For more context, you can already allow a longer username in the back-end by simply altering the name column to set it to varchar(64) instead of varchar(16) and then bumping up the sql_max_username_length value in the variable table. This allows you to insert longer usernames, but only through SQL. The changes here are to allow longer usernames through the front-end / GUI.

@kienanstewart
Copy link

I don't think sql_max_username_length is the appropriate variable to use here. There's a very specific reason the default of 14 was chosen, so that it would be 2 less than sql_max_username_length. This allows databases to be created with uses in the following pattern:

  • username
  • username_[a-z0-9]

Since the limit has a purpose is distinct from sql_max_username_length, I would like to propose the following changes:

  1. Use a max_login_length variable, defaulting at 14 as it is now.
  2. Remove the input maxlength attribute for the login from bureau/admin/adm_add.php: the UX of http input's maxlength is quite bad and results in the longer strings being silently truncated by the client
  3. In bureau/m_admin.php::add_mem, validate that the length of the login is >= 1 and <= variable_get('max_login_length', 14, "The maximum length of login names")
  4. Implement hook_variable_set in bureau/m_admin.php to ensure that the new setting is sane. For max_login_length, the bounds might be something like:
  • >= 1
  • <= variable_get("sql_max_username_length") - 2
  • <= 128 (the size of the login column)

If the new setting is outside those bounds, I would expect the old value to be saved back and an warning or error shown to the user.

There could be further considerations for the login length, such as:

  • the maximum length of user names for ftp accounts (64, by default and limited by the ftpusers name column) - 2, in the same way that sql usernames affects the length limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants