public static bool AuthenticateUser(hMailServer.Application application)
{
// First try to authenticate using an empty password.
if (AuthenticateUser(application, ""))
return true;
// Try to authenticate using password on command line...
string [] args = Environment.GetCommandLineArgs();
foreach (string password in args)
{
if (AuthenticateUser(application, password))
return true;
}
while (true)
{
formEnterPassword passwordDlg = new formEnterPassword();
if (passwordDlg.ShowDialog() != System.Windows.Forms.DialogResult.OK)
return false;
string password = passwordDlg.Password;
if (AuthenticateUser(application, password))
return true;
MessageBox.Show("Invalid user name or password.", "hMailServer");
}
}