Announcements
Hello all,
i'va have a issue with one user when he want to validate his credentials, with all others it works. Here the method
str userName = System.Environment::get_UserName(), userDomain = System.Environment::get_UserDomainName(); System.DirectoryServices.AccountManagement.PrincipalContext pc; ; dfUser = d.addFieldValue(extendedTypeStr(UserIdStr), strFmt(@"%1\%2", userDomain, userName)); dfPass = d.addFieldValue(extendedTypeStr(password),""); dfUser.enabled(false); dfPass.passwordStyle(true); if (d.run()) { pc = new System.DirectoryServices.AccountManagement.PrincipalContext( System.DirectoryServices.AccountManagement.ContextType::Domain, userDomain ); //Invalid Password if(!pc.ValidateCredentials(userName, dfPass.value())) return checkFailed("@EVE4195"); return true; }
I don't know how to retrieve any exception, only returns false.
I did a Tester with C# with the same code and it work's.
Thanks in advance!
Hi igallegoferreira,
Were you able to verify the last reply from Will? Do you need any assistance or has your question been solved in the meantime?
Hi igallegoferreira,
Please make sure the user is a AX user:
docs.microsoft.com/.../create-new-users-in-microsoft-dynamics-ax
And you could use class xAxaptaUserManager to validate the password:xAxaptaUserManager.validatePassword.
Hi André, thanks for your reply,
The same code works for other users, and the dfUser is the combination of userDomain+ userName, dfPass is the hidden password entered by user.
The problem is with the validation in "pc.ValidateCredentials()", that only returns false. With the tester i did in C#, this user can Login succesfully.
Thanks in advance.
Hi,
Can you explain if the same code works for all other users? When is this coding executed? It seems like you didn't put the full coding above. Or something else is missing. E.g. what is dfUser and dfPass?
Why do you need to validate credentials in AX 2012? When the user logs in on his PC he will have to provide his credentials already.
André Arnaud de Cal...
294,261
Super User 2025 Season 1
Martin Dráb
232,996
Most Valuable Professional
nmaenpaa
101,158
Moderator