public bool ResetPassword(common.clsUser User, common.clsPassword Password) { try { // Get the full LDAP path to the user // Set the DirectoryEntry object for this User DirectoryEntry de = clsADMngr.GetUserByLoginID(User.LoginID); string strLDAPPath = de.Properties["distinguishedName"].Value.ToString(); // Instantiate a new PBSAD object using this user path clsADMngr = new ad.clsActiveDirectoryManager(CONFIG_ADSI_AdminUsr, CONFIG_ADSI_AdminPwd, strLDAPPath); // Return success/failure; bool boolSuccess = clsADMngr.ResetPassword(User, Password); if (boolSuccess) { strMessage += "Password change successful<br>"; return(true); } else { throw new System.Exception(); } } catch (System.Exception ex) { strMessage += "Password change failed!<br><br>" + ex.GetBaseException().Message + "<br>"; clsErr = new common.LogError(); clsErr.WriteLogEntry(common.LogError.LogEntryType.Error, "PBSConnectBusinessAccountManager", "Unable to ResetPassword!", ex); } return(false); }
/// <summary> /// This constructor is parameterless, but all of this class' properties must be set before instantiating the object /// </summary> public clsAccount() { if (CONFIG_CONN_StationDB == null) { throw new System.Exception("PBS.Connect.Business.AccountManager.CONFIG_CONN_StationDB is undefined!"); } if (CONFIG_CONN_WebBoardDB == null) { throw new System.Exception("PBS.Connect.Business.AccountManager.CONFIG_CONN_WebBoardDB is undefined!"); } if (CONFIG_CONN_WebBoardDefaultBoardID == 0) { throw new System.Exception("PBS.Connect.Business.AccountManager.CONFIG_CONN_WebBoardDefaultBoardID is undefined!"); } if (CONFIG_ADSI_Root == null) { throw new System.Exception("PBS.Connect.Business.AccountManager.CONFIG_ADSI_Root is undefined!"); } if (CONFIG_ADSI_AdminUsr == null) { throw new System.Exception("PBS.Connect.Business.AccountManager.CONFIG_ADSI_AdminUsr is undefined!"); } if (CONFIG_ADSI_AdminPwd == null) { throw new System.Exception("PBS.Connect.Business.AccountManager.CONFIG_ADSI_AdminPwd is undefined!"); } if (CONFIG_MAIL_SmtpServer == null) { throw new System.Exception("PBS.Connect.Business.AccountManager.CONFIG_MAIL_SmtpServer is undefined!"); } if (CONFIG_MAIL_SmtpDefaultFromAddress == null) { throw new System.Exception("PBS.Connect.Business.AccountManager.CONFIG_MAIL_SmtpDefaultFromAddress is undefined!"); } clsStationDBMngr = new stations.clsStationDBManager(CONFIG_CONN_StationDB); clsStationDBMngr.SmtpServer = CONFIG_MAIL_SmtpServer; clsWebBoardMngr = new webboard.WebBoardDB(CONFIG_CONN_WebBoardDB); clsADMngr = new ad.clsActiveDirectoryManager(CONFIG_ADSI_AdminUsr, CONFIG_ADSI_AdminPwd); strMessage = ""; }