'******************************************
'*** Check Password Against Windows ***
'******************************************
'If in update mode we dont have to check password against windows
If strMode <> "update" then
Dim NTServerName, Uname, Passwd, objUser, ErrorCode
NTServerName = "cateye"
Uname = strUsername
Passwd = strPassword
On Error Resume Next
Set objUser = GetObject("WinNT://" & NTServerName & "/" & Uname & ",user")
objUser.ChangePassword Passwd, Passwd
If Err <> 0 Then
If CLng(Err.Number) = CLng(-2147024810) Then
ErrorCode = "Your password was incorrect. Enter the password that you use to logon to the network"
Response.Write("<script Language=""VBScript"">" & vbCRLF)
Response.write("MsgBox """ & ErrorCode & """,,""Invalid Password""" & vbCRLF)
Response.Write("Parent.Navigate ""default.asp""" & vbCRLF)
Response.Write("</script>" & vbCRLF)
Response.End
ELSEif Clng(Err.Number) = CLng(424) Then
ErrorCode = "Invalid User Name. Enter the username that you use to logon to the network"
Response.Write("<script Language=""VBScript"">" & vbCRLF)
Response.write("MsgBox """ & ErrorCode & """,,""Invalid Username""" & vbCRLF)
Response.Write("Parent.Navigate ""default.asp""" & vbCRLF)
Response.Write("</script>" & vbCRLF)
Response.End
Else
ErrorCode = "An unexpected error has occured. Please try again"
Response.Write("<script Language=""VBScript"">" & vbCRLF)
Response.write("MsgBox """ & ErrorCode & """,,""Unknown Error""" & vbCRLF)
Response.Write("Parent.Navigate ""default.asp""" & vbCRLF)
Response.Write("</script>" & vbCRLF)
Response.End
END IF
ELSE
ErrorCode = "You have been authenticated successfully"
End If
End if