<% Server.ScriptTimeout = 5 lookFailed = False loginNow = False logoutNow = False Session("authenticationStatus") = "pending" If Session("authenticated") = "authenticated" Then If Request.Form("logoutNow").Count = 1 Then Session.Contents.Remove("authenticated") Session.Contents.Remove("authenticationName") Session.Contents.Remove("authenticationAcct") Session.Contents.Remove("authenticationCode") Session.Contents.Remove("authenticationEmail") Session.Contents.Remove("authenticationStatus") logoutNow = True End If Else found = False If Request.Form("loginId").Count = 1 And Request.Form("loginPwd").Count = 1 And Request.Form("loginCohort").Count = 1 Then On Error Resume Next Session.Contents.Remove("authenticated") Session.Contents.Remove("authenticationName") Session.Contents.Remove("authenticationAcct") Session.Contents.Remove("authenticationCode") Session.Contents.Remove("authenticationEmail") Session.Contents.Remove("authenticationStatus") loginId = Request.Form("loginId") loginPwd = Request.Form("loginPwd") loginCohort = Request.Form("loginCohort") objGroupName = "CN=" + loginCohort 'or dvc.staff or dvc.students or dvc.fa.students or dvc.faculty or lmc.* or ccc.* Set ns = GetObject("LDAP:") objGroupNameAlt = "" If loginCohort = "dvc.faculty" Then objGroupNameAlt = "CN=const-faculty" If loginCohort = "dvc.staff" Then objGroupNameAlt = "CN=const-staff" If Instr(loginId, "\") = 0 Then loginId = "acportal\" & loginId accountName = Mid(loginId, 10) 'lose the acportal\ prefix Err.Clear Set oUser = ns.OpenDSObject("LDAP://10.11.2.252/CN=users,DC=ac,DC=portal", loginId, loginPwd, ADS_SERVER_BIND) If Err.Number = 0 Then For Each objGroup In oUser If objGroup.Name = objGroupName Then For Each objMember In objGroup.Members If objMember.sAMAccountName = accountName Then found = True Exit For End If Next Exit For End If Next If Not found Then For Each objGroup In oUser If objGroup.Name = objGroupNameAlt Then For Each objMember In objGroup.Members If objMember.sAMAccountName = accountName Then found = True Exit For End If Next Exit For End If Next End If End If If found Then ldapEmail = LCase(objMember.Mail) atSignIndex = Instr(ldapEmail, "@email.4cd.edu") If atSignIndex > 4 Then ldapEmail = Left(ldapEmail, atSignIndex - 4) & "@dvc.edu" atSignIndex = Instr(ldapEmail, "@insite.4cd.edu") If atSignIndex > 4 Then ldapEmail = Left(ldapEmail, atSignIndex - 4) & "@dvc.edu" Set TypeLib = CreateObject("Scriptlet.TypeLib") guid = Replace(Mid(CStr(TypeLib.Guid), 2, 36), "-", "") Set TypeLib = Nothing Session("authenticated") = "authenticated" Session("authenticationName") = objMember.displayName Session("authenticationAcct") = objMember.sAMAccountName Session("authenticationEmail") = ldapEmail Session("authenticationCode") = guid Session("authenticationStatus") = loginCohort Response.Cookies("authentication")("loginId") = loginId Response.Cookies("authentication")("email") = ldapEmail Response.Cookies("authentication")("name") = objMember.displayName Response.Cookies("authentication").Expires = Date() + 31 loginNow = true Else lookFailed = True End If Set objComputer = Nothing Set ns = Nothing End If If Not found Then loginId = Request.Cookies("authentication")("loginId") End If End If %>
<% If Session("authenticated") = "authenticated" Then %>

Logged in as <%=Session("authenticationName")%> (<%=Session("authenticationAcct")%>), a member of "<%=Session("authenticationStatus")%>"
  with email ID <%=Session("authenticationEmail")%> (for use in WEPR and WebSLOs)
  using authentication code <%=Session("authenticationCode")%>

DO NOT CLOSE THIS WINDOW

It keeps you logged in, even through long periods of inactivity.

<% Else %>
Your portal id:
Your portal password:
Log in as
<% End If %>


User's IP: <%=Request.ServerVariables("REMOTE_ADDR")%>
User's browser: <%=Request.ServerVariables("HTTP_USER_AGENT")%>
Date and time: of last refresh <%=Date%> <%=Time%>
Last Updated: 10/30/13