Sub processlogin(page As ABMPage, user As Map)
page.ws.Session.SetAttribute("authType", "local")
page.ws.Session.SetAttribute("authName", user.Get("userlogin"))
page.ws.Session.SetAttribute("IsAuthorized", "true")
Dim amp As Int = user.Get("adminpriv")
Log(" **** what is admin setting: "&)
If amp = 1 Then
page.ws.Session.SetAttribute("UserType", "1") ' is administrator
Else
page.ws.Session.SetAttribute("UserType", "0" )
End If
'Dim usrt As String = ABMShared.GetUsrType( user.Get("usertype") )
'page.ws.Session.SetAttribute("UserType", usrt ) ' lowercase!
page.ws.Session.SetAttribute("UserID", "" & user.Get("userid") ) ' lowercase!
page.ws.Session.SetAttribute("UserRows", user.Get("userrows") ) ' lowercase!
page.ws.Session.SetAttribute("comp_id", user.Get("comp_id") ) ' lowercase!
Maincomp_id = user.Get("comp_id")
page.ws.Session.SetAttribute("orgtype", -1 ) ' lowercase!
Dim SQL As SQL = DBM.GetSQL
Dim memb As List = DBM.SQLSelect(SQL, "SELECT * FROM member WHERE pk = " & Maincomp_id ,Null)
If memb.Size > 0 Then
Dim m As Map = memb.Get(0)
page.ws.Session.SetAttribute( "orgtype",m.Get("otype")) ' lowercase!
End If
DBM.CloseSQL(SQL)
Log(" ............ Handled login User: "& user.Get("userid")&" UserType: "&&" org type: "&page.ws.Session.GetAttribute2("orgtype",-1))
Dim downloadfolder As String = File.Combine(File.DirApp, "/www/" & ABMShared.AppName & "/uploads/"&"comp_"&Maincomp_id)
Dim tdown As String = downloadfolder&"\comp_"&Maincomp_id
File.MakeDir(downloadfolder, "")' "comp_"&Maincomp_id)
page.CloseModalSheet("login")
' where do we go from here?
If amp = "1" Then
ABMShared.NavigateToPage(page.ws, "x123Login", "../AboutPage")
Else
ABMShared.NavigateToPage(page.ws, "x123Login", "../CouncilPage")
End If
End Sub