Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2004
    Posts
    38

    Cool Unanswered: Accessing current user's L/P

    How can I find out the current user's login/password, and how do I let him change his password and save it back to the WDM file?

    Thanx ahead

    dd+

  2. #2
    Join Date
    Sep 2001
    Location
    Chicago, Illinois, USA
    Posts
    601
    To the best of my knowledge, the password is write only, you cannot read an existing password.

  3. #3
    Join Date
    Mar 2004
    Posts
    38

    Lets start at the beginning

    Lets start at the beginning - how can I access the current l/p of the user?

    dd+

  4. #4
    Join Date
    Mar 2004
    Location
    UK
    Posts
    30
    As with PracticalPrograms reponse I dont think you can read a users password.

    If you want to force a users password to change from a form heres an example of some code I used in a database

    This code is quite old so sorry about the lack of comments etc

    To use it you need a form with 3 text boxes. Call the form frmChange_Password

    and the text boxes:
    oldpass
    newpass
    veripass

    Code:
    Public Sub ChangePassword()
    Dim wrk as Workspace
    Dim usr as User
    
    Set wrk = DBEngine.Workspaces(0)
    Set usr = wrk.Users(wrk.UserName)
    
    oldpass = Forms!frmChange_Password!oldpass
    If IsNull(oldpass) Then oldpass = ""
    newpass = Forms!frmChange_Password!newpass
    If IsNull(newpass) Then newpass = ""
    veripass = Forms!frmChange_Password!veripass
    If IsNull(veripass) Then veripass = ""
    
    If Len(newpass) < 6 Or Len(newpass) > 14 Then
        MsgBox "Passwords Must Be More Than 6 And Less Than 14 Letters Or Numbers.", vbCritical, "Security Warning"
        Forms!frmChange_Password!newpass = ""
        Forms!frmChange_Password!veripass = ""
        Exit Function
    Else
        If oldpass = newpass Then
            MsgBox "Password Change Error. New Password Cannot Be The Same As The Old Password", vbCritical, "Security Warning"
            Forms!frmChange_Password!newpass = ""
            Forms!frmChange_Password!veripass = ""
            Exit Function
        Else
            If newpass = veripass Then
                usr.NewPassword oldpass, newpass
                MsgBox "Password Change Confirmed. Password For User " & wrk.UserName & ", Successfully Changed", vbInformation, "Security Update"
                DoCmd.Close acForm, "frmChange_Password"
            Else
                MsgBox "Password Change Error.  The New Password And Confirm Password Do Not Match, Please Re-Enter", vbCritical, "Security Warning"
                Forms!frmChange_Password![newpass] = ""
                Forms!frmChange_Password![veripass] = ""
                Exit Function
            End If
        End If
    End If
    End Sub

    Basically you can use the User object and Workspace object to access information about the user however as previously mentioned you cant read from the Password object of User

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •