Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

Using email addresses as agent user names


When upgrading to 1.9.15 a while ago I imported all of our existing users from our original 1.6 installation. These all had their email addresses as their usernames. However, when adding new users or editing existing ones, email addresses are no longer allowed as usernames. I could alter the code but, without doing so, is there a way that we can?




  • This does not appear to be a suggestion or feedback. Moving to Troubleshooting and Problems.

    I honestly don't know what you mean.  When i import users I dont set a username (note: I'm using the LDAP/AD plugin), but when i click create new users I don't even have a username field.  People can use their email address (or you can edit the user after the fact and add a username which they could then also use to log in).  It sounds to me like you are making things more difficult than they need to be.
  • My apologies if my initial post was not clear.

    In version 1.6 all agents' user names were their email addresses: the validation process had no issues with that.

    When I upgraded from 1.6 to 1.9.15 (via 1.7.5) these user names were imported into the MySQL database table:


    However, in 1.9.15, when I come to edit one of these agent accounts the edit fails because the validation of the username fails: it fails the check in the Validator::is_username() function.

    I was assuming that this should not be so - i.e. that email addresses are valid user names) - and was hoping that there would be a configuration setting that would allow email addresses to be used for agents' user names. I have fixed the problem by modifying the Validator::is_username() function (in class.validator.php) to check for a valid email address before checking for invalid characters.

    if (filter_var($username, FILTER_VALIDATE_EMAIL)) {
      // Do nothing
    } elseif (!preg_match('/^[\p{L}\d._-]+$/u', $username)) {
       $error = __('Username is an invalid email address or it contains invalid characters');

    however, I thought that I shouldn't have to do this.

  • Hello,

    As stated in my last post, all agents (not customer users) in our osTicket system system (.../osticket/scp/) had usernames in 1.6ST that were their email addresses. These were all imported into the database during the upgrade. However, if I try to edit one of these agent accounts the update of the record fails because it won't accept emaill addresses as agent usernames. Can I assume that I have to make the validation change I have in order to edit agent accounts?

  • edited January 4

    First off, love your name lol

    Secondly, unfortunately you cannot have an email address as the username. Pretty much version 1.7.x and up's code is completely different than v1.6's code and we simply do not allow that. You'll have to change the username to an actual username, for example "kevin123" or just "kevin". I hope this helps! Cheers.

    P.S. You can most certainly change the validation but there's no telling what kind of issues you might run into. Just a heads up.
  • Kevin,

    Many thanks. It does not appear to be a problem for agents but I need to do some more testing to ensure all is OK.

Sign In or Register to comment.