Can't change password for usernames with!

I'll likely code a fix, but just letting you know that it allowed me to create a username with a ! in it but then won't let me change the password for that user!

Hi @Chad,

How did you create the user? From the register page or via the Add user button in the Users page?

add user button in the Users page

Is it something you'll be able to fix?

I don't see an easy way for me to code a fix?

Thank you

We have to investigate it first.

Will know more once we investigate.

You can probably delete this user and create a new one.

Here is what I get when I tried to add a new user with the same user name:

I used a .NET 8 application with WebAssembly rendering mode.

my app is server rendering.

I created a bunch of users with a ! (I was matching users from our existing system that we will be replacing)

our users will be using both systems for a while so would like to have the ! allowed.

can you please make a change so they can change their passwords?

I am afraid I don't know how this could be done. You can check AccountController - it is what changes the passwords and uses the built-in ASP.NET Core Identity API only.

So I guess I'll code validation for letters and numbers only on create?

Just tested with .NET 7 and .NET 8 Blazor server apps and got the same result:

I have no idea how you managed to create such a user to begin. There seems to validation which prevents such user names.

please try multi-tenant.

i create a new application and went to add a user with zero code changes and was able to add a user with a !

That explains it. You can try adding this code in the ChangePassword method of AccountController:

userManager.UserValidators.Clear();

This code is being used when creating the user to allow users with the same user name but in different tenant.

1 Like

that fixed it, thank you

can you put it in the code base?

right now, if it rerun security it will override the change, plus it would be good to have in there for others that use multi tenant.

Will do so with the next release.

1 Like