Sub msbtn1_Clicked(Target As String)
page.Pause
Dim inpUser As ABMInput = page.Component("inpuser")
Dim inpPass As ABMInput = page.Component("inppass")
Dim inpCc As ABMInput = page.Component("inpcc")
Dim jStr As JStringFunctions
jStr.Initialize
Dim Nm_Usr As String = inpUser.Text
Dim Pw_Usr As String = DB.SHA2(inpPass.Text)
Dim Id_CCs As Long = jStr.Val(inpCc.Text) +10000
Dim usrSQL As SQL = DB.pool.GetConnection
Try
Dim qry As String = $"SELECT um.ID_Usr idm, up.ID_Usr id, up.ID_UsrMod md, up.Nm_Usr us, up.ID_Empl em, e.Nomb1 nm, e.Apell1 ap, e.ID_Dpto dp, e.ID_Secc sc
FROM Users um,
SM_Usr up INNER JOIN Pers e ON up.ID_Empl=e.ID_Empl
WHERE up.Nm_Usr = ? AND up.Pw_Usr = ? AND um.ID_Usr = ?"$
Dim m As Map = DBUtils.ExecuteMap(usrSQL, qry, Array As String(Nm_Usr,Pw_Usr,Id_CCs))
usrSQL.Close
Catch
usrSQL.Close
Log(LastException)
page.Resume
Return
End Try
Dim pwInit as String = "1m2nb3jh3i2 3k12hk3jhkrh2 k3jhrk32jrh k3jhrk2j3hrkb3"
If m.IsInitialized = True Then
If Pw_Usr = pwInit Then
DB.smVar_Set(page,2,"" & m.Get("us"))
DB.smVar_Set(page,5,"" & m.Get("nm") & " " & m.Get("ap"))
ABMShared.NavigateToPage(ws, "../" & RsetpwdPage)
Else
ws.Session.SetAttribute("IsAuthorized", "true")
ws.Session.SetAttribute("authType", "local")
ws.Session.SetAttribute("authName", inpUser.Text)
ABMShared.NavigateToPage(ws, "../" & InitialPage)
End If
Log("LOGIN OK")
Else
Log("LOGIN X")
End If
page.Resume
End Sub