<% Dim FO : Set FO=new FormObject FO.Add "username,pwd,msg" Dim oEncryptedData Dim encString Set oEncryptedData = Server.CreateObject("CAPICOM.EncryptedData") //Create CAPICOM object oEncryptedData.Algorithm.Name = 4 //AES oEncryptedData.Algorithm.KeyLength = 0 //Max oEncryptedData.SetSecret "f732ff23-5b70-4752-aee0-eaa6e96a0d04" //Shared key, do not change If FO.Posted Then FO.Validate "username", "Please enter a Username" FO.Validate "pwd", "Please enter a Password" If FO.FormValid Then Dim tRS : Set tRS=DBR.GetRS("select dbo.getid(rid,gid) as id from Dealers where active=1 and username='"&fSQL(FO("username").Value)&"'") If tRS.eof Then // FO.SetError "msg", "Login Failed!
The username and password information // provided does not match an existing account." Response.Redirect "http://www.control4.com/dealer/dealer-logout" Else Session("dealer_logged_in")=true Session("LOGIN_ID")=tRS("id").Value oEncryptedData.Content = tRS("id").Value //Username encString = oEncryptedData.Encrypt(0) //Encrypt in Base64 Response.Cookies("c4singlesignon")=encString //Save in cookie Response.Redirect "http://www.control4.com/dealer/dealer-home" End If End If End If Response.Redirect "http://www.control4.com/dealer/dealer-logout" //Page.Load "dealer/forms.xml", "login" //Page.AddNode FO.GetXML //Page.Output rem Session.Abandon %>