40 lines
1.5 KiB
VB.net
40 lines
1.5 KiB
VB.net
Imports System.Text
|
|
|
|
Public Class frmAdminPasswort
|
|
Dim akt_pw As String
|
|
|
|
Private Sub frmAdminPasswort_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|
Try
|
|
Me.TBPM_KONFIGURATIONTableAdapter.Connection.ConnectionString = MyConnectionString
|
|
akt_pw = TBPM_KONFIGURATIONTableAdapter.cmdGetAdminPW
|
|
Catch ex As Exception
|
|
MsgBox("Fehler bei Form Load:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
|
End Try
|
|
|
|
End Sub
|
|
|
|
Private Sub btnSetNew_Click(sender As Object, e As EventArgs) Handles btnSetNew.Click
|
|
Dim oldPW As String
|
|
oldPW = Me.txtOld.Text
|
|
Dim bytesToEncode As Byte()
|
|
bytesToEncode = Encoding.UTF8.GetBytes(oldPW)
|
|
Dim encoded_oldPW As String
|
|
encoded_oldPW = Convert.ToBase64String(bytesToEncode)
|
|
|
|
If encoded_oldPW = akt_pw Then
|
|
Dim newPW As String
|
|
newPW = Me.txtNew.Text
|
|
bytesToEncode = Encoding.UTF8.GetBytes(newPW)
|
|
Dim encoded_newPW As String
|
|
encoded_newPW = Convert.ToBase64String(bytesToEncode)
|
|
TBPM_KONFIGURATIONTableAdapter.cmdSetAdminPW(encoded_newPW)
|
|
MsgBox("Das neue Passwort wurde erfolgreich eingetragen!", MsgBoxStyle.Information)
|
|
akt_pw = TBPM_KONFIGURATIONTableAdapter.cmdGetAdminPW
|
|
Else
|
|
MsgBox("Achtung das alte Passwort ist nicht korrekt!", MsgBoxStyle.Exclamation)
|
|
Me.txtOld.Focus()
|
|
Me.txtOld.Text = ""
|
|
End If
|
|
|
|
End Sub
|
|
End Class |