• Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
  • Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

FOG Login with spaces in username

Scheduled Pinned Locked Moved
General Problems
5
24
3.0k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q
    Quazz Moderator @Tom Elliott
    last edited by Quazz Oct 23, 2019, 8:11 AM Oct 23, 2019, 2:10 PM

    @Tom-Elliott I agree that it’s not a bug (everything is working as designed).

    I don’t have a lot of experience with AD; I was unsure what is and isn’t allowed. It seems that spaces in AD names are bad practice and cause more problems than they’re worth. (though it doesn’t seem impossible, just breaks half your stuff)

    T 1 Reply Last reply Oct 23, 2019, 3:50 PM Reply Quote 0
    • T
      Tom Elliott @Quazz
      last edited by Oct 23, 2019, 3:50 PM

      @Quazz The usernames, themselves, cannot have spaces. But from the overview of this, he’s using a field of the AD/LDAP that doesn’t care about spaces. For example, displayName over sAMAccountName

      Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

      Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

      Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

      K 1 Reply Last reply Oct 24, 2019, 11:39 AM Reply Quote 1
      • K
        kek @Tom Elliott
        last edited by Oct 24, 2019, 11:39 AM

        @Tom-Elliott Thank you for providing a solution for this. I will test it tomorrow. I think if i found the right file before, i could have fixed it myself :). Thanks to all for the great support. I will reply tomorrow containing the results.

        1 Reply Last reply Reply Quote 0
        • K
          kek
          last edited by Jan 27, 2020, 1:50 PM

          I’m sorry I haven’t answered for so long, but I’ve been busy a lot and haven’t been able to address this issue until now.

          First i only got the login of the FOG local users to work with the solution provided by @Tom-Elliott.
          I could login with usernames the contain spaces with the following changes:

          user.class.php:
          Line 214:
          Change the relevant regex from:

          (?=^.{3,40}$)^[\w][\w0-9]*[._-]?[\w0-9]*[._-]?[\w0-9]+$
          

          to:

          (?=^.{3,40}$)^[\w][\w0-9]*[ ._-]?[\w0-9]*[ ._-]?[\w0-9]+$
          

          fog.user.js
          Comment out:

          //regex: /^[\w][\w0-9]*[._-]?[\w0-9]*[.]?[\w0-9]+$/
          

          When i tried to login with a domain user that contains spaces (users without spaces worked already) i got the same problem, no error but no login.

          Then i figured out that the LDAP plugin uses the same check and regex so i had to edit this too:

          ldap.class.php
          Comment out:

                  /**
                   * Test the username for funky characters and return
                   * immediately if found.
                   */
          //        $test = preg_match(
          //            '/(?=^.{3,40}$)^[\w][\w0-9]*[._-]?[\w0-9]*[.]?[\w0-9]+$/i',
          //            $user
          //        );
          //        if (!$test) {
          //            return false;
          //        }
          

          Now it works like a charm. 😃

          Thanks to all people that were involved in this.

          This can be marked as solved.

          1 Reply Last reply Reply Quote 0
          • 1
          • 2
          • 2 / 2
          • First post
            Last post

          208

          Online

          12.0k

          Users

          17.3k

          Topics

          155.2k

          Posts
          Copyright © 2012-2024 FOG Project