code to Create a login page for ax clients
Hi,
I would like to share with you how we can create a login page so that everytime a user wants to user the system,he/she must provide use login details and password.
Am going to demonistrate using the ax code below:
Note: The first class which is called during ax startup is Application class and the method in that class is called the Startuppost method.Copy paste this code in the startuppost method:
void startupPost()
{
Dialog d;
DialogField df, df1, df2;
userinfo user;
UserId userid;
boolean ret;
;
d = new Dialog("Secure User Login Details");
d.windowType(FormWindowType::PopUp);
df = d.addField(extendedTypeStr(userid),"UserID");
df1 = d.addField(extendedTypeStr(userid),"UserName");
df2 = d.addField(extendedTypeStr(string30),"Password");
df.value(curuserid());
select user
where user.id == curuserid();
if(user)
{
df1.value(user.name);
}
df1.allowEdit(false);
df1.displayLength(25);
df2.passwordStyle();
while(d.run())
{
if((df2.value()=="" || df2.value() != user.id) )
{
//throw error("wrong password");
Box::info(strFmt("Wrong password.The system will now shutdown!!!!!"));
infolog.shutDown(true);
//df2.doNull();
//continue;
}
else
{
ret = true;
break;
}
}
if(ret == false)
{
infolog.shutDown(true);
}
I would like to share with you how we can create a login page so that everytime a user wants to user the system,he/she must provide use login details and password.
Am going to demonistrate using the ax code below:
Note: The first class which is called during ax startup is Application class and the method in that class is called the Startuppost method.Copy paste this code in the startuppost method:
void startupPost()
{
Dialog d;
DialogField df, df1, df2;
userinfo user;
UserId userid;
boolean ret;
;
d = new Dialog("Secure User Login Details");
d.windowType(FormWindowType::PopUp);
df = d.addField(extendedTypeStr(userid),"UserID");
df1 = d.addField(extendedTypeStr(userid),"UserName");
df2 = d.addField(extendedTypeStr(string30),"Password");
df.value(curuserid());
select user
where user.id == curuserid();
if(user)
{
df1.value(user.name);
}
df1.allowEdit(false);
df1.displayLength(25);
df2.passwordStyle();
while(d.run())
{
if((df2.value()=="" || df2.value() != user.id) )
{
//throw error("wrong password");
Box::info(strFmt("Wrong password.The system will now shutdown!!!!!"));
infolog.shutDown(true);
//df2.doNull();
//continue;
}
else
{
ret = true;
break;
}
}
if(ret == false)
{
infolog.shutDown(true);
}
}
No comments:
Post a Comment