UmbracoIdentity icon indicating copy to clipboard operation
UmbracoIdentity copied to clipboard

Value cannot be null or whitespace - Parameter name: dbPassword

Open markroffey opened this issue 5 years ago • 3 comments

When using an email/password combination for a user that has signed up with the social login (but has not set a local password)

The following error occurs

Value cannot be null or whitespace.
Parameter name: dbPassword

Line 56:             return CheckPassword(password, hashedPassword);

src\UmbracoIdentity\IdentityEnabledMembersMembershipProvider.cs    Line: 56

I've fixed this by amending this method in IdentityEnabledMembersMembershipProvider

        public new bool VerifyPassword(string password, string hashedPassword)
        {
            //member exits but registered with social login.
            if (hashedPassword == null)
                return true;

            return CheckPassword(password, hashedPassword);
        }

and amending this in HandleLogin action in UmbracoIdentityAccountController.cs

            if (user != null)
            {
                //member exits but registered with social login.
                if (user.PasswordHash == null)
                {
                    ModelState.AddModelError("loginModel", "Social Account registered");
                    return CurrentUmbracoPage();
                }

                await SignInAsync(user, true);
                return RedirectToCurrentUmbracoPage();
            }

Shall I create a PR for this or can you think of a better way?

markroffey avatar Jan 29 '20 15:01 markroffey

Hi! A PR would be a great start :)

Shazwazza avatar Feb 03 '20 03:02 Shazwazza

Thanks @markroffey , this it really helped me. I could not see this in the master branch so I've created a pull request for this.

sinkypars1885 avatar May 21 '20 07:05 sinkypars1885

PR is here https://github.com/Shazwazza/UmbracoIdentity/pull/114

Shazwazza avatar Jun 11 '20 23:06 Shazwazza