Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
What is the equivalent of this for Umbraco V9?
Membership.ValidateUser(username, password)
I just want to check that the username and password is valid, not to actually log them in.
Hi Gordon,
You can use MemberManager to check the password for current logged in member.
MemberManager
MemberIdentityUser memberIdentityUser = await _memberManager.GetCurrentMemberAsync(); bool isPasswordValid = await _memberManager.CheckPasswordAsync(memberIdentityUser, Password);
Thanks
Hi Arul,
Just follow up this question. May I ask why I always get null from the memberManager.GetCurrentMemberAsync() ? And callmemberManager.ValidateCredentialsAsync always return false.
Any advice please?
Hi Kun,
GetCurrentMemberAsync() will return null if the user isnt logged in, the docs are here on this https://docs.umbraco.com/umbraco-cms/reference/querying/imembermanager#getcurrentmemberasync
GetCurrentMemberAsync()
ValidateCredentialsAsync() validates the login credentials without actually logging the user in, so if this is returning false then the credentials youre passing in will be incorrect, docs on this one are here https://docs.umbraco.com/umbraco-cms/reference/querying/imembermanager#validatecredentialsasync-string-username-string-password
ValidateCredentialsAsync()
Lewis
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
How to Validate a member username and password
What is the equivalent of this for Umbraco V9?
I just want to check that the username and password is valid, not to actually log them in.
Hi Gordon,
You can use
MemberManager
to check the password for current logged in member.Thanks
Hi Arul,
Just follow up this question. May I ask why I always get null from the memberManager.GetCurrentMemberAsync() ? And callmemberManager.ValidateCredentialsAsync always return false.
Any advice please?
Hi Kun,
GetCurrentMemberAsync()
will return null if the user isnt logged in, the docs are here on this https://docs.umbraco.com/umbraco-cms/reference/querying/imembermanager#getcurrentmemberasyncValidateCredentialsAsync()
validates the login credentials without actually logging the user in, so if this is returning false then the credentials youre passing in will be incorrect, docs on this one are here https://docs.umbraco.com/umbraco-cms/reference/querying/imembermanager#validatecredentialsasync-string-username-string-passwordLewis
is working on a reply...