Use cConnection.pkg Use cLoginEncryption.pkg Use Tools\LoginConnectDialog.dg #Replace C_$LoginAllFailedWillNotAbort "Login attempts failed. Application will not be halted, but there will be issues with data files." Define C_THConnectionIniSectionPWD for "THPWD" Class cConnectionManager is a cConnection Procedure Construct_Object String sEncryptPassword Forward Send Construct_Object Set pbAutoConnect to False Get Create (RefClass(cLoginEncryption)) to ghoLoginEncryption // base64 phrase Move "VGhlLk9uZS5IYW1tZXIuVG8uUnVsZS5UaGVtLkFsbAo=" to sEncryptPassword Set psEncryptPassword of ghoLoginEncryption to sEncryptPassword End_Procedure // Login to all managed connections in all managed drivers. Abort if any fail // if you don't want automatic abort, use the function LoginAllConnections or // LoginConnectionId // This has been overridden to not abort Procedure LoginAll Boolean bOk Integer iError String sError Get LoginAllConnections to bOk If not bOk Begin Get psErrorText to sError Get piErrorNumber to iError Send UserError (C_$LoginAllFailedWillNotAbort + "\n\n" + sError) //Abort End End_Procedure Function ConnectionIniFile Returns String String sConnections sPath sPName If (ghoWorkSpaceHandlerEx) Begin Get CurrentConnections of ghoWorkSpaceHandlerEx to sConnections If (sConnections="") Move C_ConnectionIniFileName to sConnections Move (Trim(sConnections)) to sConnections If (sConnections<>"") Begin // first data path If (Pos("\",Lowercase(sConnections))) Begin Get PrimaryDataPath of ghoWorkSpaceHandlerEx to sPath Move "\" to sPName End // first programs path Else If (Pos("\",Lowercase(sConnections))) Begin Get PrimaryProgramPath of ghoWorkSpaceHandlerEx to sPath Move "\" to sPName End // first workspace home path Else If (Pos("\",Lowercase(sConnections))) Begin Get CurrentHomePath of ghoWorkSpaceHandlerEx to sPath Move "\" to sPName End // if no special path, use first data path Else If (not(IsFilenameQualified(sConnections))) Begin Get PrimaryDataPath of ghoWorkSpaceHandlerEx to sPath Move '' to sPName End If (sPath<>"") Begin Get PathAtIndex of (phoWorkspace(ghoApplication)) sPath 1 to sPath If (sPName<>"") Begin Move (Replace(sPName, sConnections, (sPath + "\"))) to sConnections End Else Begin Move (sPath + "\" + sConnections) to sConnections End End End End Function_Return sConnections End_Function Procedure OnReadCredentials String sSection String sId Handle hoIni String ByRef sUID String ByRef sPWDEncrypted Boolean ByRef bTrusted Forward Send OnReadCredentials sSection sId hoIni (&sUID) (&sPWDEncrypted) (&bTrusted) If (hoIni) Get ReadString of hoIni sSection C_THConnectionIniSectionPWD "" to sPWDEncrypted End_Procedure Procedure OnWriteCredentials String sSection String sId Handle hoIni String sUID String sPWDEncrypted Boolean bTrusted If hoIni Begin If (not(bTrusted) and sUID<>"") Begin Send WriteString of hoIni sSection C_ConnectionIniSectionUID sUID End Else Begin Send DeleteKey of hoIni sSection C_ConnectionIniSectionUID End If (not(bTrusted) and sUID<>"" and sPWDEncrypted<>"") Begin Send WriteString of hoIni sSection C_THConnectionIniSectionPWD sPWDEncrypted End Else Begin Send DeleteKey of hoIni sSection C_THConnectionIniSectionPWD End If (bTrusted) Begin Send WriteString of hoIni sSection C_ConnectionIniSectionTrusted "yes" End Else Begin Send DeleteKey of hoIni sSection C_ConnectionIniSectionTrusted End End End_Procedure Procedure End_Construct_Object Forward Send End_Construct_Object End_Procedure End_Class