home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / CODE_UPLOAD147672102001.psc / frmForgot.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2001-02-10  |  8.4 KB  |  255 lines

  1. VERSION 5.00
  2. Begin VB.Form frmForgot 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "Confirm your identity"
  5.    ClientHeight    =   3660
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   5745
  9.    ControlBox      =   0   'False
  10.    BeginProperty Font 
  11.       Name            =   "Verdana"
  12.       Size            =   8.25
  13.       Charset         =   0
  14.       Weight          =   400
  15.       Underline       =   0   'False
  16.       Italic          =   0   'False
  17.       Strikethrough   =   0   'False
  18.    EndProperty
  19.    LinkTopic       =   "Form1"
  20.    MaxButton       =   0   'False
  21.    MinButton       =   0   'False
  22.    ScaleHeight     =   3660
  23.    ScaleWidth      =   5745
  24.    ShowInTaskbar   =   0   'False
  25.    StartUpPosition =   2  'CenterScreen
  26.    Begin VB.TextBox txtMasterPassword 
  27.       Height          =   330
  28.       Left            =   1800
  29.       TabIndex        =   11
  30.       Top             =   2775
  31.       Width           =   3855
  32.    End
  33.    Begin VB.CommandButton cmdOK 
  34.       Caption         =   "&Proceed"
  35.       Height          =   375
  36.       Left            =   3720
  37.       TabIndex        =   9
  38.       Top             =   3240
  39.       Width           =   1935
  40.    End
  41.    Begin VB.CommandButton cmdCancel 
  42.       Caption         =   "&Cancel"
  43.       Height          =   375
  44.       Left            =   2280
  45.       TabIndex        =   8
  46.       Top             =   3240
  47.       Width           =   1335
  48.    End
  49.    Begin VB.Frame Frame1 
  50.       Height          =   25
  51.       Left            =   -120
  52.       TabIndex        =   7
  53.       Top             =   1440
  54.       Width           =   6255
  55.    End
  56.    Begin VB.TextBox txtAnswer 
  57.       Height          =   285
  58.       Left            =   1800
  59.       TabIndex        =   6
  60.       Top             =   2400
  61.       Width           =   3855
  62.    End
  63.    Begin VB.Label Label3 
  64.       Caption         =   "Type in your Hint Answer and click Proceed, then, Password Guard will recover your Master Password."
  65.       Height          =   495
  66.       Left            =   120
  67.       TabIndex        =   12
  68.       Top             =   840
  69.       Width           =   5535
  70.    End
  71.    Begin VB.Label Label6 
  72.       Caption         =   "Your Master Password:"
  73.       BeginProperty Font 
  74.          Name            =   "Verdana"
  75.          Size            =   8.25
  76.          Charset         =   0
  77.          Weight          =   700
  78.          Underline       =   0   'False
  79.          Italic          =   0   'False
  80.          Strikethrough   =   0   'False
  81.       EndProperty
  82.       ForeColor       =   &H00800000&
  83.       Height          =   375
  84.       Left            =   75
  85.       TabIndex        =   10
  86.       Top             =   2760
  87.       Width           =   1335
  88.    End
  89.    Begin VB.Label Label5 
  90.       Alignment       =   2  'Center
  91.       AutoSize        =   -1  'True
  92.       Caption         =   "Hint Answer :"
  93.       BeginProperty Font 
  94.          Name            =   "Verdana"
  95.          Size            =   8.25
  96.          Charset         =   0
  97.          Weight          =   700
  98.          Underline       =   0   'False
  99.          Italic          =   0   'False
  100.          Strikethrough   =   0   'False
  101.       EndProperty
  102.       ForeColor       =   &H00800000&
  103.       Height          =   195
  104.       Left            =   60
  105.       TabIndex        =   5
  106.       Top             =   2400
  107.       Width           =   1305
  108.    End
  109.    Begin VB.Label lblQuestion 
  110.       AutoSize        =   -1  'True
  111.       Caption         =   "HintQuestion"
  112.       Height          =   195
  113.       Left            =   1800
  114.       TabIndex        =   4
  115.       Top             =   2040
  116.       Width           =   1080
  117.    End
  118.    Begin VB.Label lblUserID 
  119.       AutoSize        =   -1  'True
  120.       Caption         =   "UserID"
  121.       Height          =   195
  122.       Left            =   1800
  123.       TabIndex        =   3
  124.       Top             =   1680
  125.       Width           =   600
  126.    End
  127.    Begin VB.Label Label4 
  128.       Alignment       =   2  'Center
  129.       AutoSize        =   -1  'True
  130.       Caption         =   "Hint Question:"
  131.       BeginProperty Font 
  132.          Name            =   "Verdana"
  133.          Size            =   8.25
  134.          Charset         =   0
  135.          Weight          =   700
  136.          Underline       =   0   'False
  137.          Italic          =   0   'False
  138.          Strikethrough   =   0   'False
  139.       EndProperty
  140.       ForeColor       =   &H00800000&
  141.       Height          =   195
  142.       Left            =   90
  143.       TabIndex        =   2
  144.       Top             =   2040
  145.       Width           =   1395
  146.    End
  147.    Begin VB.Image Image1 
  148.       Height          =   450
  149.       Left            =   240
  150.       Picture         =   "frmForgot.frx":0000
  151.       Stretch         =   -1  'True
  152.       Top             =   240
  153.       Width           =   570
  154.    End
  155.    Begin VB.Label Label2 
  156.       Caption         =   "Please confirm your identity by typing the Answer of your Hint Question (Case Sensitive)."
  157.       Height          =   495
  158.       Left            =   960
  159.       TabIndex        =   1
  160.       Top             =   240
  161.       Width           =   4695
  162.    End
  163.    Begin VB.Label Label1 
  164.       AutoSize        =   -1  'True
  165.       Caption         =   "User ID:"
  166.       BeginProperty Font 
  167.          Name            =   "Verdana"
  168.          Size            =   8.25
  169.          Charset         =   0
  170.          Weight          =   700
  171.          Underline       =   0   'False
  172.          Italic          =   0   'False
  173.          Strikethrough   =   0   'False
  174.       EndProperty
  175.       ForeColor       =   &H00800000&
  176.       Height          =   195
  177.       Left            =   120
  178.       TabIndex        =   0
  179.       Top             =   1680
  180.       Width           =   795
  181.    End
  182. Attribute VB_Name = "frmForgot"
  183. Attribute VB_GlobalNameSpace = False
  184. Attribute VB_Creatable = False
  185. Attribute VB_PredeclaredId = True
  186. Attribute VB_Exposed = False
  187. Private Sub cmdCancel_Click()
  188.     frmForgot.Hide
  189.     frmLogIn.Show
  190. End Sub
  191. Private Sub cmdOK_Click()
  192.     Dim hintAnswerKeyword As String
  193.     Dim arFlag() As String, arKey(1 To 16) As Long
  194.     Dim AnswerLen As Integer, curKeyRef As Integer
  195.     Dim resultMPasswordKey As String
  196.     txtAnswer.Text = Trim(txtAnswer.Text)
  197.     hintAnswerKeyword = AscEncode(txtAnswer.Text)
  198.     If hintAnswerKeyword = "" Then GoTo InvalidAnswer
  199.     On Error GoTo InvalidAnswer
  200.     tmpString = decrypt(GetSetting(MainTitle, UserRegSection, txtAnswer.Tag), hintAnswerKeyword & Mid$(txtAnswer.Tag, 5, 1))
  201.     On Error GoTo InvalidAnswer
  202.     arFlag = Split(tmpString, sDivide)
  203.                 
  204.     On Error GoTo InvalidAnswer
  205.     AnswerLen = Int(arFlag(LBound(arFlag)))
  206.     ' Compare user-provided Hint Answer with the stored one
  207.     If Not AnswerLen = Len(txtAnswer.Text) Then GoTo InvalidAnswer
  208.     If Not txtAnswer.Text = arFlag(LBound(arFlag) + 1) Then GoTo InvalidAnswer
  209.     curKeyRef = 0
  210.     resultMPassword = ""
  211.     tmpAsc = 0
  212.     For currentCounter = 1 To Len(hintAnswerKeyword)
  213.         tmpAsc = tmpAsc + Asc(Mid$(hintAnswerKeyword, currentCounter, 1))
  214.     Next
  215.         
  216.     ' Restore flags from arFlag() string array
  217.     For currentCounter = LBound(arFlag) + 2 To UBound(arFlag)
  218.         curKeyRef = curKeyRef + 1
  219.         On Error GoTo ErrAnswer
  220.         arKey(curKeyRef) = arFlag(currentCounter)
  221. '        arKey(curKeyRef) = arKey(curKeyRef) Xor tmpAsc
  222.     Next
  223.     resultMPasswordKey = ""
  224.     For currentCounter = 16 To 1 Step -1
  225.         On Error GoTo ErrAnswer
  226.         If Not arKey(currentCounter) = 0 Then resultMPasswordKey = resultMPasswordKey & Chr$(arKey(currentCounter))
  227.     Next
  228.     txtMasterPassword.Text = decrypt(GetSetting(MainTitle, UserRegSection, txtMasterPassword.Tag), resultMPasswordKey)
  229.     txtAnswer.Locked = True
  230.     cmdOK.Enabled = False
  231.     frmLogIn.txtMasterPassword.Text = txtMasterPassword.Text
  232.     cmdCancel.Caption = "&Close"
  233.     Screen.MousePointer = 0
  234.     Exit Sub
  235. InvalidAnswer:
  236.         
  237.         Screen.MousePointer = 0
  238.         MsgBox "Sorry. Invalid Answer.", 16, "Access Denied"
  239.         txtAnswer.SelStart = 0
  240.         txtAnswer.SelLength = Len(txtAnswer.Text)
  241.         txtAnswer.SetFocus
  242.         Exit Sub
  243. ErrAnswer:
  244.     Screen.MousePointer = 0
  245.     MsgBox "Unexpected error occured during decryption process!", 16, MainTitle
  246.     Exit Sub
  247. End Sub
  248. Private Sub txtAnswer_Change()
  249.     If Len(Trim(txtAnswer.Text)) > 0 Then
  250.         cmdOK.Enabled = True
  251.     Else
  252.         cmdOK.Enabled = False
  253.     End If
  254. End Sub
  255.