Description

When using Moin with LDAP authentication, you are faced with the following problem:

Case-sensitiveness is not the problem here, but the fact that if you log against LDAP with firstname.lastname or FirstName.LastName, you are logged with the same account (you're the same person!) but Moin creates two internal accounts, that's disturbing and complicates management (example ACL management).

Steps to reproduce

  1. configure moin to use LDAP authentication
  2. choose a LDAP account and log into Moin with its login name in upper case (like this LOGINNAME)

  3. creates a page, for example your homepage by clicking on your LOGINNAME in the upper left

  4. log out
  5. log in with the same account and password but this time with the login name in lower case (like this loginname)

  6. see that your homepage isn't created

Example

Component selection

Details

Workaround

One workaround is to explain to every LDAP user to always spell their login name the same way. Murphy disagrees with this. -k-method

Another solution is to patch the login.py userform such that the user is forced to enter a lowercase username. This workaround is only suitable for new installations or installations where all existing usernames are lowercase (or have been converted to lowercase in advance). If there are already accounts which contain usernames with uppercase chars then it will not be possible to login to those accounts. -k-method

Here is the patch:

   1 --- a/moin-1.9.8/MoinMoin/userform/login.py     Fri Oct 17 20:45:32 2014
   2 +++ b/moin-1.9.8/MoinMoin/userform/login.py     Fri May 22 12:38:38 2015
   3 @@ -39,7 +39,7 @@
   4              hint = authm.login_hint(request)
   5              if hint:
   6                  hints.append(hint)
   7 -        self._form = html.FORM(action=action, name="loginform", id="loginform")
   8 +        self._form = html.FORM(action=action, name="loginform", id="loginform", onsubmit="return checkForm(this);")
   9          self._table = html.TABLE(border="0")
  10  
  11          # Use the user interface language and direction
  12 @@ -54,7 +54,7 @@
  13  
  14          cfg = request.cfg
  15          if 'username' in cfg.auth_login_inputs:
  16 -            self.make_row(_('Name'), [
  17 +            self.make_row(_('Windows Username'), [
  18                  html.INPUT(
  19                      type="text", size="32", name="name",
  20                  ),
  21 @@ -66,6 +66,18 @@
  22                      type="password", size="32", name="password",
  23                  ),
  24              ])
  25 +
  26 +        self._form.append("""<script type="text/javascript">
  27 +        function checkForm(form) {
  28 +            if(form.name.value.match(/[A-Z]/)) {
  29 +                alert("Your username must not contain upper case characters."); 
  30 +                form.name.focus();
  31 +                return false;
  32 +            }
  33 +            return true;
  34 +        }
  35 +        </script>
  36 +        """)
  37  
  38          # Restrict type of input available for OpenID input
  39          # based on wiki configuration.

Please note: this patch changes the prompt from "Name" to "Windows Username" on the login form. I assume that it's only windows installations where this is a problem. I'm not aware of any other popular operating systems that have case insensitive usernames. -k-method

Please also note: this is clearly not a permanent solution to this very real problem. It's a temporary work-around that works very well for the MoinMoin installation at the company I work for. -k-method

Discussion

I'm not sure this bug is really a bug, because account case-sensitiviness is a feature1. But it could be interesting to:

(!) We won't make moin case-insensitive. That is just bad style, slower and only makes trouble all over the place (as you see with ldap, windows, ...).

What maybe could be done is reading back the username from ldap to see how it really is. Patches are welcome.

Plan


CategoryMoinMoinNoBug

  1. isn't it? :) (1)

MoinMoin: MoinMoinBugs/LdapAuthenticationIsCaseInsensitiveButMoinAccountsAreNot (last edited 2015-05-22 11:55:29 by gateway)