<!--
File Version Start - Do not remove this if you are modifying the file
Build: 8.0.2
File Version End
-->
<%
Option Explicit
Dim L_PASSWORD_EXPIRED
'*********************************************************************
'VBSCRIPT STRING VARIABLES FOR LOCALIZING
'*********************************************************************
L_PASSWORD_EXPIRED = "Password Expired"
'*********************************************************************
%>
<!-- #include file="handleerror.csp" -->
<%
Dim DEBUG
DEBUG = False
On Error Resume Next
'PREVENT BROWSER FROM CACHING THE PAGE
Response.ExpiresAbsolute = Now() - 1
Dim GUEST_ID
GUEST_ID = 11
'********************************************
'*** DEFAULT GUEST USER LOGON INFORMATION ***
'********************************************
Dim defaultaps
Dim defaultusr
Dim defaultpwd
Dim defaultaut
defaultaps = Request.ServerVariables("WCS_NAME_SERVER")
defaultusr = ""
defaultpwd = ""
defaultaut = "secWindowsNT"
'********************************************
Dim aps
Dim usr
Dim pwd
Dim aut
aps = defaultaps
usr = Request.Form("usr")
pwd = Request.Form("pwd")
aut = Request.Form("aut")
If( aut = "" ) Then
aut = defaultaut
End If
If( DEBUG ) Then
Response.Write "User: " & usr & "<br>"
Response.Write "Password: " & pwd & "<br>"
Response.Write "APS: " & aps & "<br>"
Response.Write "Authentication: " & aut & "<br>"
End If
'********************************************
'IF THERE ISN'T AN EXISTING SESSION
If( TypeName(Session("IStore")) <> "ISInfoStore" ) Then
Call LogonUser(usr, pwd, aps, aut)
'IF THERE IS AN EXISTING SESSION
Else
If( DEBUG ) Then Response.Write( TypeName(Session("IStore")) & "<br>") End If
'****************************************
'LOGOFF CURRENT USER ACCOUNT
'****************************************
If( Request.QueryString("action") = "logoff" ) Then
Call LogoffUser()
Call LogonUser(usr, pwd, aps, aut)
'****************************************
'EXIT TO LAUNCHPAD
'****************************************
ElseIf( Request.QueryString("action") = "exit" ) Then
Session.Abandon
Response.Redirect "/crystal/enterprise/"
'****************************************
'ASSIGN NEW PASSWORD
'****************************************
ElseIf( Request.QueryString("action") = "newpwd" ) Then
Dim newpwd
Dim oldpwd
newpwd = Request.Form("newpwd")
oldpwd = Request.Form("oldpwd")
If( DEBUG ) Then
Response.Write "new password = " & newpwd & "<br>"
Response.Write "old password = " & oldpwd & "<br>"
End If
Session("IStore").EnterpriseSession.UserInfo.Password(oldpwd) = newpwd
If( Err.Number = 0 ) Then
If( Session("IStore").EnterpriseSession.UserInfo.UserID = GUEST_ID ) Then
Response.Redirect "available.csp?pageView=guest"
Else
Response.Redirect GetPersonalPage(true, 0)
End If
Else
Session("ErrMessage") = Err.Description
Response.Write Err.Number & Err.Description
Response.Redirect "newpwdform.csp"
End If
'****************************************
'SIGN UP NEW USER
'****************************************
ElseIf( Request.QueryString("action") = "newusr" ) Then
Dim fname
Dim newusrparams
fname = Request.Form("fullname")
usr = Trim(Request.Form("username"))
pwd = Request.Form("password")
Call CreateNewUser(fname, usr, pwd)
If( Err.Number <> 0 ) Then
Session("ErrMessage") = Err.Description
newusrparams = Server.URLEncode("fullname=" & fname & "&username=" & usr)
Response.Redirect "signup.csp?" & newusrparams
Else
Call LogonUser(usr, pwd, aps, aut)
End If
Else
'IF USER IS GUEST THEN REDIRECT TO GUEST VIEW
If Session("IStore").EnterpriseSession.UserInfo.UserID = GUEST_ID Then
If( Err.Number = 0 ) Then
Response.Redirect "available.csp?pageView=guest"
Else
Err.Clear
Call LogoffUser()
Call LogonUser(usr, pwd, aps, aut)
End If
'OTHERWISE REDIRECT TO PERSONAL VIEW
Else
Response.Redirect GetPersonalPage(true, 0)
End If
End If
End If
'********************************************
'*** CreateNewUser Sub
'********************************************
Sub CreateNewUser( fullname, userName, password )
Dim es
Dim pmgr
'SET OUR ENTERPRISE SESSION
Set es = Session("IStore").EnterpriseSession
'CHECK IF APSADMIN PLUGIN IS INSTALLED. IF NOT INSTALL IT.
Set pmgr = es.PluginManager
Dim testplugin
Set testplugin = pmgr.InstalledPluginInfo("CrystalEnterprise.APSAdmin")
If Err.Number <> 0 Then
pmgr.InstallPlugin("CrystalEnterprise.APSAdmin")
Err.Clear
End If
'CREATE AN ADMIN HELPER OBJECT
Dim WCSah
Set WCSah = CreateObject("CrystalEnterprise.FW_WCSAdminHelper")
'CREATE THE NEW USER
Call WCSah.CreateNewUser ( es, username, fullname, "", password )
End Sub
'********************************************
'*** GetDesktopSettings Function
'*** - get the desktop settings from UserInfo.ProfileString
'*** - set the cookies for each setting
'*** - returns the "view" setting
'********************************************
Function GetDesktopSettings(SessionObj)
If( DEBUG ) Then Response.Write "Getting desktop settings!<br>" End If
GetDesktopSettings = -1
Dim strDesktopSettings
strDesktopSettings =SessionObj.UserInfo.ProfileString("desktopsettings")
If( DEBUG ) Then Response.Write "strDesktopSettings: " & strDesktopSettings & "<br>" End If
If( strDesktopSettings = "" ) Then
If( DEBUG ) Then Response.Write "desktopsettings haven't been set yet!<br>" End If
'SET DEFAULT SETTINGS VALUES
strDesktopSettings = "ePortfolio_view=0&ePortfolio_csn=0&ePortfolio_vwm=0&ePortfolio_dv0=1&ePortfolio_dv1=1&ePortfolio_dv2=1&ePortfolio_dv3=1&ePortfolio_dv4=1&ePortfolio_cbr=1&ePortfolio_vwr=0&ePortfolio_rpp=6&ePortfolio_expo=0&ePortfolio_zone=0"
End If
Dim ss
ss = Split(strDesktopSettings, "&")
If( DEBUG ) Then
Response.Write "LBound = " & LBound(ss) & "; UBound = " & UBound(ss) & "<br>" & vbCrLf
End If
Dim i
Dim sss
For i = LBound(ss) to UBound(ss)
If( DEBUG ) Then
Response.Write "Setting desktop settings cookies!<br>"
Response.Write ss(i) & "<br>"
End If
sss = Split(ss(i), "=")
Response.Cookies("ePortfolio_prefs")(sss(0)) = sss(1)
Response.Cookies("ePortfolio_prefs").Path = "/"
If sss(0) = "ePortfolio_view" Then
GetDesktopSettings = CLng(sss(1))
End If
'SET TIMEZONE VALUE.
If sss(0) = "ePortfolio_zone" Then
SessionObj.TimeZone = Int(sss(1))
End If
Next
End Function
'FUNCTION WHICH STORES USERNAME AND AUTHENTICATION TYPE IN A COOKIE
Sub SetCookies_LogonInfo( username, authentication )
If( DEBUG ) Then Response.Write "Setting logon info cookies!<br>" End If
Dim expDate
expDate = DateAdd("yyyy", 1, Now)
Response.Cookies("ePortfolio_lastusr") = username
Response.Cookies("ePortfolio_lastusr").Expires = expDate
Response.Cookies("ePortfolio_lastusr").Path = "/"
Response.Cookies("ePortfolio_lastaut") = authentication
Response.Cookies("ePortfolio_lastaut").Expires = expDate
Response.Cookies("ePortfolio_lastaut").Path = "/"
End Sub
'FUNCTION WHICH LOGS OFF THE CURRENT USER
Sub LogoffUser()
Response.Cookies("ePortfolio_logontoken") = ""
Session("IStore") = Nothing
Session("lastFiveRptName") = Nothing
Session("ErrMessage") = Nothing
Session("collection") = Nothing
If( DEBUG ) Then
Response.Write "Logoff called!<br>"
Response.Write IsObject(Session("IStore")) & "<br>"
Response.Write TypeName(Session("IStore")) & "<br>"
If( Err.Number <> 0 ) Then
Response.Write "*** ERROR! " & Err.Number & Err.Description & "<br>"
End If
End If
End Sub
'FUNCTION WHICH LOGS ON A NEW USER
Sub LogonUser( username, password, apsname, authentication )
If( DEBUG ) Then Response.Write "Logon called!<br>" End If
Dim sm
Dim es
Dim ltm
Dim viewSetting
On Error Resume Next
'INSTANTIATE INFOSTORE OBJECT FOR SESSION
Set sm = CreateObject("CrystalEnterprise.SessionMgr")
If CheckErrorGeneral() Then Exit Sub End If
'SET THE SOCKS SERVER IF ANY
sm.SOCKSURI = Request.ServerVariables("WCS_SOCKS_URI")
'LOGON USER
Set es = sm.Logon(username, password, apsname, authentication)
If( Err.Number = 0 ) Then
viewSetting = GetDesktopSettings(es)
'STORE THE INFOSTORE SESSION IN OUR SESSION VARIABLE
Dim iStore
Set iStore = es.Service ("", "InfoStore")
Session("IStore") = iStore
'IF NOT GUEST LOGON THEN GET USERS DESKTOPSETTINGS
If (iStore.EnterpriseSession.UserInfo.UserID <> GUEST_ID ) Then
Call SetCookies_LogonInfo(username, authentication)
End If
'SET THE LOGON TOKEN MANAGER
Set ltm = es.LogonTokenMgr
If CheckErrorGeneral() Then Exit Sub End If
'WRITE THE LOGONTOKEN TO A COOKIE
Response.Cookies("ePortfolio_logontoken") = ltm.CreateLogonToken("", 1, 100)
If CheckErrorGeneral() Then Exit Sub End If
'CHECK IF PASSWORD HAS EXPIRED FOR ENTERPRISE AUTHENTICATION ONLY
If( authentication = "secEnterprise" ) Then
If( es.UserInfo.PasswordExpiry <> 0 ) Then
If( iStore.EnterpriseSession.UserInfo.UserID = GUEST_ID ) Then
'REDIRECT TO GUEST VIEW
Response.Redirect "available.csp?pageView=guest"
Else
Response.Redirect GetPersonalPage(false, viewSetting)
End If
Else
Call SetCookies_LogonInfo(usr, aut)
Session("ErrMessage") = L_PASSWORD_EXPIRED
Response.Redirect "newpwdform.csp"
End If
Else
Response.Redirect GetPersonalPage(false, viewSetting)
End If
'LOGON ERROR
Else
'IF ATTEMPTING TO LOG ONTO GUEST ACCOUNT FAILS WE DON'T WANT TO DISPLAY ERROR MESSAGE SO JUST SHOW LOGON FORM
If( usr = defaultusr And pwd = defaultpwd And aut = defaultaut ) Then
Response.Redirect "logonform.csp?action=logoff"
Else
Call SetCookies_LogonInfo(usr, aut)
Session("ErrMessage") = Err.Description
Response.Redirect "logonform.csp?action=logonerror"
End If
End If
End Sub
'********************************************
'*** GetPersonalPage Function
'*** - returns the URL for the appropriate initial page for the user
'*** - if bUseCookie is true then viewSetting is ignored
'********************************************
Function GetPersonalPage(bUseCookie, viewSetting)
On Error Resume Next
Dim view
If bUseCookie Then
view = CLng(Request.Cookies("ePortfolio_prefs")("ePortfolio_view"))
Else
view = viewSetting
End If
If view = 0 Then
GetPersonalPage = "available.csp?pageView=personal"
ElseIf (view = -1 Or view = "") Then
GetPersonalPage = "available.csp?pageView=subscription"
Else
GetPersonalPage = "available.csp?pageView=personal&currID=" & view
End If
End Function
%>