home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Power Pack / Visual_Basic4_Power_Pack.bin / vb4files / passwd1 / passwrd.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-11-20  |  4.3 KB  |  150 lines

  1. VERSION 2.00
  2. Begin Form frmPassWord 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "Enter ID & Password"
  6.    ClientHeight    =   1572
  7.    ClientLeft      =   3768
  8.    ClientTop       =   2028
  9.    ClientWidth     =   4032
  10.    ClipControls    =   0   'False
  11.    ControlBox      =   0   'False
  12.    Height          =   1992
  13.    Left            =   3720
  14.    LinkTopic       =   "Form1"
  15.    MaxButton       =   0   'False
  16.    MinButton       =   0   'False
  17.    ScaleHeight     =   1572
  18.    ScaleWidth      =   4032
  19.    Top             =   1656
  20.    Width           =   4128
  21.    Begin TextBox txtID 
  22.       FontBold        =   0   'False
  23.       FontItalic      =   0   'False
  24.       FontName        =   "MS Sans Serif"
  25.       FontSize        =   7.8
  26.       FontStrikethru  =   0   'False
  27.       FontUnderline   =   0   'False
  28.       Height          =   336
  29.       Left            =   360
  30.       TabIndex        =   0
  31.       Top             =   240
  32.       Width           =   1692
  33.    End
  34.    Begin CommandButton cmdCancel 
  35.       Caption         =   "Cancel"
  36.       Height          =   372
  37.       Left            =   2760
  38.       TabIndex        =   4
  39.       Top             =   840
  40.       Width           =   972
  41.    End
  42.    Begin CommandButton cmdOK 
  43.       Caption         =   "OK"
  44.       Default         =   -1  'True
  45.       Height          =   372
  46.       Left            =   2760
  47.       TabIndex        =   3
  48.       Top             =   240
  49.       Width           =   972
  50.    End
  51.    Begin TextBox txtPwd 
  52.       Height          =   336
  53.       Left            =   360
  54.       PasswordChar    =   "*"
  55.       TabIndex        =   1
  56.       Top             =   840
  57.       Width           =   1692
  58.    End
  59.    Begin Label lblPwd 
  60.       AutoSize        =   -1  'True
  61.       BackColor       =   &H00C0C0C0&
  62.       Height          =   192
  63.       Left            =   360
  64.       TabIndex        =   6
  65.       Top             =   1320
  66.       Width           =   60
  67.    End
  68.    Begin Label Label1 
  69.       AutoSize        =   -1  'True
  70.       BackColor       =   &H00C0C0C0&
  71.       Caption         =   "Enter your User ID:"
  72.       Height          =   192
  73.       Index           =   1
  74.       Left            =   360
  75.       TabIndex        =   5
  76.       Top             =   0
  77.       Width           =   1572
  78.    End
  79.    Begin Label Label1 
  80.       AutoSize        =   -1  'True
  81.       BackColor       =   &H00C0C0C0&
  82.       Caption         =   "Enter your password:"
  83.       Height          =   192
  84.       Index           =   0
  85.       Left            =   360
  86.       TabIndex        =   2
  87.       Top             =   600
  88.       Width           =   1752
  89.    End
  90. Option Explicit
  91. Sub cmdCancel_Click ()
  92.     End
  93. End Sub
  94. Sub cmdOk_Click ()
  95. Dim daysleft As Integer 'for expiration calc
  96. If txtID.Text = "" Then    'both required
  97.     txtID.SetFocus
  98.     Beep
  99.     lblPwd.Caption = "User ID is required."
  100.     Exit Sub
  101. ElseIf txtPwd.Text = "" Then
  102.     txtPwd.SetFocus
  103.     Beep
  104.     lblPwd.Caption = "User Password is required."
  105.     Exit Sub
  106. End If
  107. 'number of times tried entering password
  108. Static Tries As Integer
  109. Tries = Tries + 1
  110. UserID = UCase$(txtID.Text)
  111. Call ReadPasswd(True, UserID)
  112.     If UCase$(txtPwd.Text) = PassWord Then 'got it
  113.         Unload frmPassWord
  114.         daysleft = DateDiff("d", Now, UserExpireDate)
  115.         If daysleft < 1 Then
  116.             Beep
  117.             MsgBox "Your password has expired. You will have to change it.", 42, "Expired User"
  118.             frmChgPassWord.Show MODAL
  119.         End If
  120.         Exit Sub
  121.     ElseIf Tries >= NUM_TRIES Then     'nope, otta hear.
  122.         MsgBox "ACCESS DENIED", 16, "Password"
  123.         End
  124.     End If
  125. 'incorrect
  126. MsgBox "Invalid password - please try again", 48, "Password"
  127. txtPwd.Text = ""
  128. txtPwd.SetFocus
  129. End Sub
  130. Sub Form_Load ()
  131. ' Look for the encrypted password file. If not found, set the PassWord
  132. ' to the default "COMPUTER"
  133. Call FormCenterModal(Me)
  134. End Sub
  135. Sub Form_Unload (Cancel As Integer)
  136.     Set frmPassWord = Nothing
  137. End Sub
  138. Sub txtID_KeyPress (KeyAscii As Integer)
  139.  If KeyAscii = 13 Then 'enter key
  140.         SendKeys "{Tab}"
  141.         KeyAscii = 0
  142.      End If
  143. End Sub
  144. Sub txtPwd_KeyPress (KeyAscii As Integer)
  145.  If KeyAscii = 13 Then 'enter key
  146.         SendKeys "{Tab}"
  147.         KeyAscii = 0
  148.      End If
  149. End Sub
  150.