[AccessD] Electronic Signature

Jim Lawrence accessd at shaw.ca
Mon May 28 14:37:30 CDT 2007


Hi Drew:

Thanks for that looks really cool... how all the pieces fit together would
undoubtedly become clear when viewing a working model.

Jim 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Drew Wutka
Sent: Monday, May 28, 2007 10:45 AM
To: Access Developers discussion and problem solving
Subject: [AccessD] Electronic Signature

Hey folks, I've spent most of the weekend updating a system I built
about 7 years ago.  It's our Help Desk program.  One of the features
I've always wanted to add was an electronic signature capability.  To do
this, I wanted to be able to prompt for a user's NT Name and Password,
and validate it.  It is very simple to get the currently logged on
user's NT name, but for an electronic signature, it is much better to
prompt for credentials.  I found code, years ago, that did this, but it
wasn't perfect, because it didn't work for my NT account.  I have an odd
character in my password, and everything I had found would fail to
authenticate with passwords that had odd ascii values in them.  (Even
though I can log onto our network fine).

 

This weekend I found (and tweaked) a process that works perfectly.  I
figured I would share the validation function with ya'all:  (It needs a
reference to ADO)

 

Function ValidateNTUser(strUserName As String, strPassword As String) As
Boolean

On Error Resume Next

Dim strDomain As String

Dim conLDAP As ADODB.Connection

Dim strSQL As String

Dim strLDAPConn As String

Dim rsUser As ADODB.Recordset

strDomain = GetObject("LDAP://RootDSE").Get("defaultNamingContext")

Set conLDAP = New ADODB.Connection

conLDAP.Provider = "ADSDSOOBject"

strSQL = "Select AdsPath, cn From 'LDAP://" & strDomain & "' where
objectClass='user' and objectcategory='person' and SamAccountName='" &
strUserName & "'"

conLDAP.Provider = "ADsDSOObject"

conLDAP.Properties("User ID") = strUserName

conLDAP.Properties("Password") = strPassword

conLDAP.Properties("Encrypt Password") = True

conLDAP.Open "DS Query", strUserName, strPassword

Err.Clear

Set rsUser = conLDAP.Execute(strSQL)

ValidateNTUser = False

If Err.Number = 0 Then

    If Not (rsUser Is Nothing) Then

        If Not (rsUser.EOF And rsUser.BOF) Then

                ValidateNTUser = True

        End If

    End If

End If

End Function

 

Drew


The information contained in this transmission is intended only for the
person or entity to which it is addressed and may contain II-VI Proprietary
and/or II-VI BusinessSensitve material. If you are not the intended
recipient, please contact the sender immediately and destroy the material in
its entirety, whether electronic or hard copy. You are notified that any
review, retransmission, copying, disclosure, dissemination, or other use of,
or taking of any action in reliance upon this information by persons or
entities other than the intended recipient is prohibited.



-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list