Command line login
Posted: Fri Mar 13, 2020 11:00 am
I am attempting to write a program that opens the Perio Chart form automatically. My program is very short:
My problem is that the login screen is still appearing even though I'm passing in the UserName and OdPassword as command line arguments. This seems inconsistent but I'm guessing I am missing something in my configuration?
I have found in the source code where the ShowLogOn() dialog is being called but I'm not familiar with the configuration terms that are
being evaluated. Does anyone have know why the logon screen is still showing or have any suggestions as to what configuration will prevent it? Source code examples included below.
Thank you,
Ed.
________________________________________________________________________________________________
From the source code, I see that there are two different places where the program checks to see if there is a user logged in. One check returns false, the other one true. Both these checks are in the FormOpenDental.ProcessCommandLine() method:
RETURNS TRUE:
RETURNS FALSE:
Code: Select all
class Program
{
[STAThread]
static void Main(string[] args)
{
var odArgs = new string[] { "UserName=admin", "OdPassword=od123", "PatNum=11" };
var start = new FormOpenDental(odArgs);
start.Show();
var perio = new FormPerio(new Patient() { PatNum = 11 }, null);
perio.ShowDialog(start);
}
}I have found in the source code where the ShowLogOn() dialog is being called but I'm not familiar with the configuration terms that are
being evaluated. Does anyone have know why the logon screen is still showing or have any suggestions as to what configuration will prevent it? Source code examples included below.
Thank you,
Ed.
________________________________________________________________________________________________
From the source code, I see that there are two different places where the program checks to see if there is a user logged in. One check returns false, the other one true. Both these checks are in the FormOpenDental.ProcessCommandLine() method:
RETURNS TRUE:
Code: Select all
if(user==null) {
//if(Programs.UsingEcwTight() && userName!="") {
if(Programs.UsingEcwTightOrFullMode() && userName!="") {
user=new Userod();
user.UserName=userName;
user.LoginDetails=Authentication.GenerateLoginDetailsMD5(passHash,true);
//This can fail if duplicate username because of capitalization differences.
Userods.Insert(user,new List<long> { PIn.Long(ProgramProperties.GetPropVal(ProgramName.eClinicalWorks,"DefaultUserGroup")) });
DataValid.SetInvalid(InvalidType.Security);
}
else {//not using eCW in tight integration mode
//So present logon screen
ShowLogOn();
user=Security.CurUser.Copy();
}
}Code: Select all
if(passHash!=user.PasswordHash || !Programs.UsingEcwTightOrFullMode())//password not accepted or not using eCW
{
//So present logon screen
ShowLogOn();
}
else {//password accepted and using eCW tight.
//this part usually happens in the logon window
Security.CurUser = user.Copy();
SecurityLogs.MakeLogEntry(Permissions.UserLogOnOff,0,Lan.g(this,"User:")+" "+Security.CurUser.UserName+" "+Lan.g(this,"has logged on via command line."));
}