1

I set up a somehow complex project using umbraco 6.2.1 on a Windows Server 2008 R2 Datacenter with SQL Server Express 2008. I extended umbraco using own .Net Code in an assebmly and razor code in the backend's Developer-section. Since some point in development I'm not able to create users in the backend anymore. I do not get any error message but there is just no user created. I did not implement a custom UsersMembershipProvider. As far as I can see I do not interfere the user creation process at all. I can not find any information in the umbraco trace log file nor in the umbracoLog table in the database. How can I further investigate what happens and solve my problem?


Edit

Can you access the "Users" section?

Yes, there is no other problem with the Users section or its subpages.

Can you get to the create screen?

Yes, it looks like it should, as far as I can see.

At what point does the user creation fail?

I can click create, the dialog closes, the tree refreshes but the user I tried to create does not exist. There is no kind of error message.

When you say you have "set up a somehow complex project" - does this mean that it is not your project or it is and you are implying it has just grown complex.

It is my project. I wanted to say reinstalling a clean version of umbraco would be very time consuming and presumably not an option.


Edit 2
I installed Elmah now for better logging but there is no exception thrown. Elmah itself is working, it logs other exceptions as it should.


Edit 3 These two lines are the only ones showing up in my browser console while doing the complete process (open dialog, enter data, accept dialog).

Chrome Console Screenshot

Georg Jung
  • 949
  • 10
  • 27
  • At what point does the user creation fail? Can you access the "Users" section? Can you get to the create screen? When you say you have "set up a somehow complex project" - does this mean that it is not your project or it is and you are implying it has just grown complex. – Digbyswift Aug 14 '14 at 14:08
  • Try to open your console in the browser. Normally you can see what wrong from the console. – Morten OC Aug 15 '14 at 21:06
  • Stumped. I'm wondering if you have at some point upgraded Umbraco in your project? If so, it's possible not all the files have been incorporated into the project. – Digbyswift Aug 20 '14 at 15:53
  • Yes, I updated umbraco from version 6.1.6 to 6.2.0 to 6.2.1. I ran the umbraco installer normally and everything else I can think of seems to work. I'm not sure if this problem occures since the update. I updated already some weeks ago but I tried to create a new user only recently. – Georg Jung Aug 22 '14 at 12:22

1 Answers1

0

I was able to solve the problem myself. I reconfigured the umbracos' UsersMembershipProvider to meet my password strength requirements like this:

<add name="UsersMembershipProvider"
     type="Umbraco.Web.Security.Providers.UsersMembershipProvider, Umbraco"
     passwordStrengthRegularExpression="^.*(?=.{8,20})(?=.*[a-z])(?=.*[A-Z])(?=.*[_\W])(?=.*[\d]).*$"
     minRequiredNonalphanumericCharacters="0"
     minRequiredPasswordLength="4"
     ...
/>

When creating a user using the umbraco backend (webinterface), umbraco.userTasks.Save() is called internally. This uses Umbraco.Core.Security.MembershipProviderExtensions.GetUsersMembershipProvider() to get the MembershipProvider defined in the web.config file. It then generates a random password using the standard .Net method GeneratePassword:

Membership.GeneratePassword(usersMembershipProvider.MinRequiredPasswordLength, usersMembershipProvider.MinRequiredNonAlphanumericCharacters)

Because I did not change the default values of MinRequiredPasswordLength and MinRequiredNonAlphanumericCharacters - the passwordStrengthRegularExpression is enforced independent of those two - the new user could not be created because the password could not be set. Even when changing the parameters to 8 and 1 I can not be sure that a password matching my expression is generated every time, which is why I needed to change my regex to a less secure one:

^.*(?=.{8,20})(?=.*[a-zA-Z])(?=.*[_\W]).*$

Unfortunately I do not see any option to change this because this mechanism to create users is deeply integrated into umbraco. Additionally, I do not understand why there is no exception logged, as the code creating the user seems to log exceptions:

catch (Exception exception)
{
    LogHelper.Error<userTasks>(string.Format("Failed to create the user. Error from provider: {0}", providerError.ToString()), exception);
    return false;
}

Even if I was able to resolve my issue I think the behaviour and achritecture of umbraco is very untransparent in this part of it. I was able to create a new backend user using umbracos own methods all the time because they do not do the password complexity checks as the MembershipProvider does. There should not be different ways to do the same because then it's very hard to debug if you encounter any issues.

Georg Jung
  • 949
  • 10
  • 27
  • Georg, I've tried your solution, but still could not create new users. Can I clarify a few things? In the web.config, did you change the membership defaultProvider to "UsersMembershipProvider" as well? Was the passwordStrengthRegularExpression used ^.*(?=.{8,20})(?=.*[a-zA-Z])(?=.*[_\W]).*$. An example of how your web.config is configured would be very helpful. Thanks in advance. – Aston Haigh Aug 28 '14 at 14:26
  • When using umbraco you typically got two MembershipProviders, one for members (frontend users) which is named `UmbracoMembershipProvider` and one for the users (backend users) named `UsersMembershipProvider`. I use the RegEx above in my production environment. Can you provide more information about your situation or better open a different question (and link it here) if my specific problem does not fit yours? – Georg Jung Aug 28 '14 at 15:37