%@ CodePage=65001 Language="VBScript"%>
<% Option Explicit %>
<% sBBSLangPage = "logon"
BBS.SetupBBS
BBS.SetScheme(0)
dim sPostUsername, sPostPassword, iLogonType, sMessage, sRedirect, sAction, sPasswordAction, dExpireDate, sExpireDate
dim sImageRoot, iIndex, sVerification, sPostVerification
sPostUsername = request.form("postusername")
sPostPassword = ucase(request.form("postpassword"))
sPostVerification = request.form("postverification")
sRedirect = request.querystring("redirect")
sAction = request.form("action")
sPasswordAction = request.querystring("password")
' Above removed for security reasons
sRedirect = sBBSValidatedBaseURL & "/category-view.asp"
if len(sRedirect) = 0 then sRedirect = "category-view.asp"
if sPasswordAction = "assigned" then
sMessage = sMessage & dictLanguage.item("LOGON-1") & "
" & dictLanguage("LOGON-2") & "
"
elseif sPasswordAction = "authorization" then
sMessage = sMessage & dictLanguage.item("LOGON-3") & "
"
elseif sPasswordAction = "uservalidated" then
sMessage = sMessage & dictLanguage.item("LOGON-4") & "
"
end if
if request("error") = "admin" then
' Admin priveleges required
sMessage = sMessage & dictLanguage.item("LOGON-5") & "
"
elseif request("error") = "restricted" then
' A restricted area of the forum
sMessage = sMessage & dictLanguage.item("LOGON-6") & "
"
elseif request("error") = "needregistration" then
' Required to have an account
sMessage = sMessage & dictLanguage.item("LOGON-7") & "
" & dictLanguage.item("LOGON-8") & "
"
end if
if sAction = "logon" then
' Encrypt the password
dim vAttemptedUser
vAttemptedUser = BBS.GetUserInfoByName(sPostUsername)
sPostPassword = Encrypt.HashEncode(sPostPassword & vAttemptedUser(UI_Salt))
' Determine the validity of the logon
iLogonType = BBS.CheckUsername (sPostUsername, sPostPassword)
' Check the verification code, if applicable
if dictConfiguration("bLOGONVERIFICATION") = 1 then
if sPostVerification <> session("verification") then iLogonType = US_IncorrectCode
end if
if (iLogonType=US_Inactive) then
' The attempted logon was by an inactive user account
sMessage = sMessage & dictLanguage.item("LOGON-9") & "
" & dictLanguage.item("LOGON-8") & "
"
elseif (iLogonType=US_BadPassword) or (iLogonType=US_NotRegistered) then
sMessage = sMessage & dictLanguage.item("LOGON-10") & "
"
elseif (iLogonType=US_IncorrectCode) then
sMessage = sMessage & dictLanguage.item("LOGON-23") & "
"
elseif (iLogonType=US_Registered) then
if request.form("storeincookie") = "1" then
dExpireDate = dateadd("m", 2, now)
sExpireDate = GetCookieDate(dExpireDate)
' response.write "username=" & BBS.ValidateURL(sPostUsername) & "; path=/; Expires=" & cstr(sExpireDate) & "; HttpOnly" : response.flush
Response.AddHeader "Set-Cookie",sBBSCookieRoot & "bbsmid=" & BBS.ValidateURL(iBBSMemberID) & "; path=/; Expires=" & cstr(sExpireDate) & "; HttpOnly"
Response.AddHeader "Set-Cookie",sBBSCookieRoot & "password=" & BBS.ValidateURL(sPostPassword) & "; path=/; Expires=" & cstr(sExpireDate) & "; HttpOnly"
else
Response.AddHeader "Set-Cookie",sBBSCookieRoot & "bbsmid=" & BBS.ValidateURL(iBBSMemberID) & "; path=/; HttpOnly;"
Response.AddHeader "Set-Cookie",sBBSCookieRoot & "password=" & BBS.ValidateURL(sPostPassword) & "; path=/; HttpOnly;"
end if
sBBSUsername = sPostUsername
sBBSPassword = sPostPassword
iBBSUserLevel = BBS.GetUserLevel(MODULE_BBS, -1)
' Update who's online page now to avoid incorrect users online in header
BBS.DeleteUserFromLocation ("Guest " & iBBSGuestID)
response.cookies(sBBSCookieRoot & "guestID") = ""
response.cookies(sBBSCookieRoot & "guestID").path = "/"
BBS.UpdateLocation sBBSUsername, sBBSCurrentURLPath, request.servervariables("REMOTE_ADDR"), 1
if instr(sRedirect, sBBSForumRoot & "/logon.asp") > 0 or instr(sRedirect, sBBSForumRoot & "/logoff.asp") or _
instr(sRedirect, sBBSForumRoot & "/forget-password.asp") or instr(sRedirect, sBBSForumRoot & "/register.asp") or _
instr(sRedirect, sBBSForumRoot & "/restricted-page.asp") or instr(sRedirect, sBBSForumRoot & "/banned.asp") or _
instr(sRedirect, sBBSForumRoot & "/reset-password.asp") or instr(sRedirect, sBBSForumRoot & "/delete-cookies.asp") or _
instr(sRedirect, sBBSForumRoot) = 0 then
sRedirect = sBBSValidatedBaseURL & "/category-view.asp"
end if
dictEnvironment.add "V-METATAG", ""
dictEnvironment.add "C-LOGON", True
end if
else
sAction = "logon"
end if
' Verification code
if dictConfiguration("bLOGONVERIFICATION") = 1 then
session("verification") = BBS.GenerateVerificationCode()
sImageRoot = sBBSForumRoot & "/images/verification-image.asp?nocache=" & timer & "&digit="
sVerification = "
| "
for iIndex = 1 to 6
sVerification = sVerification & " |