Jump to content

Login em camadas

Recommended Posts


Boa tarde! estou desenvolvendo um sistema de login em camadas,mas ele só está identificando o usuário com ID =1

E não identifica os outros usuários.

Segue o código:

Public Class CredantialsBAL
Public Class CredantialsBAL
Public ID As String
Public Function authenticate(username As String, password As String) As Boolean
Dim dal As CredantialsDAL = New CredantialsDAL()
Dim dTable As DataTable = dal.getAuthentication()

Dim found As Boolean = False
For Each dRow As DataRow In dTable.Rows
If (username = dRow("username").ToString()) AndAlso password = dRow("userpassword").ToString() Then
ID = dRow("id").ToString()
found = True
End If
If Not found Then
Return False
End If

Return found

End Function
End Class
End Class

Imports DComPostg
Imports Npgsql
Imports Mono
Public Class CredantialsDAL
#Region "Check user Exist"
Public Function getAuthentication() As DataTable

Dim cmd As New NpgsqlCommand("SELECT * FROM login", DComPostg.DComPostg.Conectar)
Dim dTable As New DataTable()
Dim adapter As New NpgsqlDataAdapter(cmd)
adapter.SelectCommand = cmd

Return dTable

End Function
#End Region
End Class

Edited by ribeiro55

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.