MitarbeiterDetails-> CreditSafe Credentials
This commit is contained in:
@@ -7,8 +7,7 @@ Imports System.Security.Policy
|
||||
Imports System.Text
|
||||
Imports System.Windows
|
||||
Imports Newtonsoft.Json
|
||||
|
||||
|
||||
Imports VERAG_PROG_ALLGEMEIN
|
||||
|
||||
Public Class frmMitarbDetails
|
||||
|
||||
@@ -853,7 +852,6 @@ Public Class frmMitarbDetails
|
||||
|
||||
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
|
||||
|
||||
Dim myUrl As New Uri("https://connect.creditsafe.com/v1/authenticate")
|
||||
lblCheckconnection.Text = ""
|
||||
|
||||
If txtCSUser.Text = "" Then
|
||||
@@ -865,55 +863,13 @@ Public Class frmMitarbDetails
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim csUser As New CreditSafeUser(txtCSUser.Text, txtCSPW.Text)
|
||||
|
||||
Dim yourJSONString = JsonConvert.SerializeObject(csUser)
|
||||
|
||||
lblCheckconnection.Text = SendRequest(myUrl, yourJSONString, "application/json", "POST")
|
||||
Dim cs = New cCreditSafeAPI
|
||||
lblCheckconnection.Text = cs.authenticate(txtCSUser.Text, txtCSPW.Text)
|
||||
|
||||
End Sub
|
||||
|
||||
Private Function SendRequest(uri As Uri, jsonString As String, contentType As String, method As String) As String
|
||||
|
||||
Dim response As HttpWebResponse
|
||||
Dim request As WebRequest
|
||||
Dim jsonDataBytes = Encoding.UTF8.GetBytes(jsonString)
|
||||
|
||||
Try
|
||||
|
||||
request = WebRequest.Create(uri)
|
||||
request.ContentLength = jsonDataBytes.Length
|
||||
request.ContentType = contentType
|
||||
request.Method = method
|
||||
|
||||
Using requestStream = request.GetRequestStream
|
||||
requestStream.Write(jsonDataBytes, 0, jsonDataBytes.Length)
|
||||
requestStream.Close()
|
||||
|
||||
End Using
|
||||
response = request.GetResponse
|
||||
Return response.StatusDescription
|
||||
|
||||
Catch ex As WebException
|
||||
|
||||
Dim ExResponse = TryCast(ex.Response, HttpWebResponse)
|
||||
Return ExResponse.StatusDescription
|
||||
|
||||
End Try
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Private Sub cbxShowPW_CheckedChanged(sender As Object, e As EventArgs) Handles cbxShowPW.CheckedChanged
|
||||
txtCSPW.UseSystemPasswordChar = Not cbxShowPW.Checked
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Public Class CreditSafeUser
|
||||
Public Property username As String
|
||||
Public Property password As String
|
||||
|
||||
Public Sub New(_username As String, _password As String)
|
||||
username = _username
|
||||
password = _password
|
||||
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user