#INCLUDE WCONNECT.H
DEFINE CLASS SpeakerLogin AS rbPage
PROCEDURE Page
IF This.AlreadyLoggedIn()
This.Redirect('SpeakerLoggedIn.Page')
ELSE
This.ShowLoginPage()
ENDIF
ENDPROC
HIDDEN Function AlreadyLoggedIn
Return NOT EMPTY(SessionVars.Globals.Get("SpeakerID", []))
ENDFUNC
HIDDEN FUNCTION ShowLoginPage()
This.oData = This.DataObject()
This.Content = This.MergeToString("SpeakerLoginFragment.htm")
This.PageTitle = "Speaker Login"
This.Merge("TemplatePage.htm")
ENDFUNC
FUNCTION DataObject(P1,P2,P3)
SELECT SPACE(30) as FirstName, SPACE(30) as LastName, SPACE(10) As SpeakerID, SPACE(100) as email, SPACE(20) as password FROM (Site.MemberPath+"Member.dbf") INTO CURSOR qResult
SCATTER NAME loData
USE IN (SELECT("qResult"))
RETURN loData
ENDFUNC
Procedure Submit()
This.oData = This.ReadForm("speaker","speakerid")
IF UPPER(Request.Form("btnSubmit")) == UPPER([EMail My Password to Me])
This.MailPassword()
ELSE
This.Login()
ENDIF
ENDPROC
HIDDEN Function Login
LOCAL lcPassword
STORE [] TO lcPassword
IF NOT This.ValidatePassword(This.oData.Email, This.oData.Password, This.oData)
This.AddError([Your name or password not found ] + "<br>"+ ;
[Try "Email My Password" button<br>]+;
[Or Click on "Email to WebMaster" link below])
This.Content = This.MergeToString("SpeakerLoginFragment.htm")
This.Merge("TemplatePage.htm")
ELSE
SessionVars.Globals.Set("SpeakerID", This.oData.SpeakerID)
SessionVars.Globals.Set("SpeakerFirstName", This.oData.FirstName)
SessionVars.Globals.Set("SpeakerLastName", This.oData.LastName)
This.Redirect("SpeakerLoggedIn.Page")
ENDIF
ENDFUNC
HIDDEN Function MailPassword
LOCAL lcPassword, lcMessage
STORE [] TO lcUserLevel, lcPassword, lcMessage
IF This.GetPassword(This.oData.Email, @lcPassword)
lcMessage = [Your Password is ]+lcPassword;
Server.SendMail("mail.bricksoftware.com",;
Site.SiteName + [ Automated Response], ;
"Website@"+Site.SiteName+[.org] ,;
This.oData.Email, ;
[], ;
Site.SiteName+ [ Speakers Password] , ;
lcMessage)
This.WaitWindow("Password Mailed to You!", "/Home.Page.fox?SessionID=_6VU00A5EO")
ELSE
This.PageTitle = "Login"
This.AddError("Sorry!<br>Email not found<br>Please try again<br>or contact WebMaster")
This.Content = This.MergeToString("LoginFragment.htm")
This.Merge("TemplatePage.htm")
ENDIF
ENDFUNC
HIDDEN FUNCTION ValidatePassword(tcEmail, tcPassword, toData)
This.Openandselect("Speaker")
tcEmail = UPPER(PADR(tcEmail,LEN(Speaker.Email)))
tcPassword = UPPER(PADR(tcPassword,LEN(Speaker.Password)))
DO CASE
CASE SEEK(tcEmail,"Speaker","email") AND (tcPassword == Password)
toData.SpeakerID = SpeakerID
toData.LastName = LastName
toData.FirstName = FirstName
RETURN .T.
OTHERWISE
RETURN .F.
ENDCASE
ENDFUNC
HIDDEN FUNCTION GetPassword(tcEmail, tcPassword)
This.Openandselect("Speaker")
tcEmail = UPPER(PADR(tcEmail,LEN("Speaker.Email")))
DO CASE
CASE SEEK(tcEmail,"Speaker","EMail")
tcPassword = Password
RETURN .T.
OTHERWISE
RETURN .F.
ENDCASE
ENDFUNC
ENDDEFINE
csCodeParser v0.9 stats: 155 lines in 0.01 seconds.