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

  1. VERSION 2.00
  2. Begin Form frmChgPassword 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "Change Password"
  6.    ClientHeight    =   1572
  7.    ClientLeft      =   4248
  8.    ClientTop       =   4584
  9.    ClientWidth     =   4032
  10.    ClipControls    =   0   'False
  11.    Height          =   1992
  12.    Left            =   4200
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   1572
  17.    ScaleWidth      =   4032
  18.    Top             =   4212
  19.    Width           =   4128
  20.    Begin CommandButton cmdCancel 
  21.       Caption         =   "Cancel"
  22.       Height          =   372
  23.       Left            =   2760
  24.       TabIndex        =   5
  25.       Top             =   960
  26.       Width           =   972
  27.    End
  28.    Begin CommandButton cmdOk 
  29.       Caption         =   "OK"
  30.       Default         =   -1  'True
  31.       Height          =   372
  32.       Left            =   2760
  33.       TabIndex        =   4
  34.       Top             =   360
  35.       Width           =   972
  36.    End
  37.    Begin TextBox txtNewPwd 
  38.       Height          =   300
  39.       Left            =   480
  40.       PasswordChar    =   "*"
  41.       TabIndex        =   1
  42.       Top             =   960
  43.       Width           =   1550
  44.    End
  45.    Begin TextBox txtOldPwd 
  46.       Height          =   300
  47.       Left            =   480
  48.       PasswordChar    =   "*"
  49.       TabIndex        =   0
  50.       Top             =   360
  51.       Width           =   1550
  52.    End
  53.    Begin Label lblPwd 
  54.       AutoSize        =   -1  'True
  55.       BackColor       =   &H00C0C0C0&
  56.       Height          =   192
  57.       Left            =   480
  58.       TabIndex        =   6
  59.       Top             =   1320
  60.       Width           =   60
  61.    End
  62.    Begin Label lblNPass 
  63.       AutoSize        =   -1  'True
  64.       BackColor       =   &H00C0C0C0&
  65.       Caption         =   "New Password: "
  66.       Height          =   192
  67.       Left            =   480
  68.       TabIndex        =   3
  69.       Top             =   720
  70.       Width           =   1332
  71.    End
  72.    Begin Label lblOPass 
  73.       AutoSize        =   -1  'True
  74.       BackColor       =   &H00C0C0C0&
  75.       Caption         =   "Old Password:"
  76.       Height          =   192
  77.       Left            =   480
  78.       TabIndex        =   2
  79.       Top             =   120
  80.       Width           =   1212
  81.    End
  82. Option Explicit
  83. Dim Tries As Integer
  84. Sub cmdCancel_Click ()
  85. Unload Me
  86. End Sub
  87. Sub cmdOk_Click ()
  88. Dim Action As Integer
  89. Action = False'edit
  90. If txtOldPwd.Text = "" Then    'both required
  91.     txtOldPwd.SetFocus
  92.     Beep
  93.     lblPwd.Caption = "Old Password is required."
  94.     Exit Sub
  95. ElseIf txtNewPwd.Text = "" Then
  96.     txtNewPwd.SetFocus
  97.     Beep
  98.     lblPwd.Caption = "New Password is required."
  99.     Exit Sub
  100. End If
  101. Static Try1 As String, Try2 As String
  102. 'correct old password?
  103. If UCase$(txtOldPwd.Text) = PassWord Then
  104.     txtNewPwd.SetFocus
  105.     MsgBox "Incorrect password - please try again", 48, "Password"
  106.     txtOldPwd.Text = ""
  107.     txtOldPwd.SetFocus
  108. End If
  109. 'old passed
  110. Tries = Tries + 1
  111. If Tries = 1 Then
  112.     Try1 = UCase$(txtNewPwd.Text)
  113.     txtNewPwd.Text = ""
  114.     Beep
  115.     lblPwd.Caption = "Verify New password:"
  116.     txtNewPwd.SetFocus
  117.     Exit Sub
  118.     Try2 = UCase$(txtNewPwd.Text)
  119.     If Try1 <> Try2 Then
  120.         MsgBox "Sorry - entries do not match", 48, "Password"
  121.         Unload Me
  122.         Exit Sub
  123.     End If
  124. End If
  125. 'reaches here only if the two enties match.
  126. 'assign variables and concatinate the rest UserID is user's
  127. Try1 = Try1 & "|" & UserTaskLevel & "|" & Now & "|" & DateAdd("d", EXPIRE_TERM, Now)
  128. Call WritePasswd(Action, UserID, UserName, Try1)
  129. Tries = 0
  130. Unload Me
  131. End Sub
  132. Sub Form_Load ()
  133. Call FormCenterModal(Me)
  134. End Sub
  135. Sub Form_Unload (Cancel As Integer)
  136. Set FrmChgPassword = Nothing
  137. End Sub
  138. Sub txtNewPwd_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 txtOldPwd_KeyPress (KeyAscii As Integer)
  145. If KeyAscii = 13 Then 'enter key
  146.         SendKeys "{Tab}"
  147.         KeyAscii = 0
  148.      End If
  149. End Sub
  150.