Tuesday, 24 December 2013

Password style Dialog s and validate the password in Active Directory [Dynamics AX, X++]

Note: AxaptaUserManager class is used to validate the password.This class is also helpful to generate passwords, validate domain etc.

Below is how the dialog looks with password style dialog fields.

static void PasswordDialogs_validateADUser(Args _args)
{
Dialog d = new Dialog(“Password style dialogs and validate password in Active directory”);
DialogField dfPass1, dfPass2;
UserInfo userInfo;
AxaptaUserManager axUserManager;
;
dfPass1 = d.addField(typeid(password), “Enter password”, “Enter password.”);
dfPass2 = d.addField(typeid(password),”Re-enter password”, “Re-enter your password to validate”);
dfPass1.passwordStyle(true);
dfPass2.passwordStyle(true);
if (d.run())
{
userInfo = xUserInfo::find(false, curuserId());
axUserManager = new AxaptaUserManager();
if (strcmp(dfPass1.value(), dfPass2.value()))
throw error(“@SYP1505″);
if (axUserManager.validatePassword(userInfo.networkAlias , userInfo.NetworkDomain, dfPass1.value()))
{
info(“Password matches with the Active directory password :)”);
}
else
{
warning (“Password doesn’t match with the Active directory password :(“);
}
}
}

No comments:

Post a Comment

SQL/SSRS Interview questions I thought of blogging some SQL/SSRS interview questions.

Below are some. I will add more, when I complete the compilation 1. What is OLTP(Online Transaction Processing)? OLTP stands ...