93 lines
3.8 KiB
VB.net
93 lines
3.8 KiB
VB.net
Imports System.ComponentModel
|
|
Imports System.IO
|
|
Imports System.Security.Cryptography
|
|
Imports System.Text
|
|
|
|
Public Class passe
|
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
|
If TextBox2.Text = "" Then
|
|
MsgBox("Merci entrer le nouveau mot de passe", MsgBoxStyle.Critical)
|
|
Exit Sub
|
|
Else
|
|
pass1()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub passe_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing
|
|
TextBox2.Clear()
|
|
End Sub
|
|
|
|
Private Sub PictureBox2_Click(sender As Object, e As EventArgs) Handles PictureBox2.Click
|
|
TextBox2.UseSystemPasswordChar = False
|
|
PictureBox4.Show()
|
|
PictureBox2.Hide()
|
|
End Sub
|
|
|
|
Private Sub PictureBox4_Click(sender As Object, e As EventArgs) Handles PictureBox4.Click
|
|
TextBox2.UseSystemPasswordChar = True
|
|
PictureBox2.Show()
|
|
PictureBox4.Hide()
|
|
End Sub
|
|
Sub pass1()
|
|
Dim texteEnBytes() As Byte = Encoding.UTF8.GetBytes(TextBox2.Text)
|
|
Dim keyBytes() As Byte = Encoding.UTF8.GetBytes("Jj@msms7")
|
|
Dim Crypto As New DESCryptoServiceProvider()
|
|
Crypto.Key = keyBytes
|
|
Crypto.IV = keyBytes
|
|
Dim Icrypto As ICryptoTransform = Crypto.CreateEncryptor
|
|
Dim Resultatbytes() As Byte = Icrypto.TransformFinalBlock(texteEnBytes, 0, texteEnBytes.Length)
|
|
Dim passecrypt = Convert.ToBase64String(Resultatbytes)
|
|
|
|
|
|
Dim sw13 As New StreamWriter(cozip & "pass.txt")
|
|
sw13.WriteLine(passecrypt)
|
|
sw13.Close()
|
|
|
|
File.Delete(compte & "passtemps.txt")
|
|
|
|
FileCopy(cozip & "pass.txt", compte & "passtemps.txt")
|
|
pass2()
|
|
End Sub
|
|
Sub pass2()
|
|
Try
|
|
My.Computer.Network.UploadFile(cozip & "pass.txt", ipserver & "utilisateur/" & Form3.Label21.Text & "/pass.txt")
|
|
File.Delete(cozip & "pass.txt")
|
|
MsgBox("Votre mot de passe a bien été changer", MsgBoxStyle.Information)
|
|
Close()
|
|
Catch ex As Exception
|
|
Timer1.Start()
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub passe_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|
Dim lines1a() As String = File.ReadAllLines(théme)
|
|
|
|
If lines1a(0) = 2 Then
|
|
Me.BackColor = Color.FromArgb(64, 64, 64)
|
|
Button1.BackColor = Color.FromArgb(64, 64, 64)
|
|
Button1.ForeColor = Color.White
|
|
Label2.ForeColor = Color.White
|
|
TextBox2.BackColor = Color.FromArgb(64, 64, 64)
|
|
TextBox2.ForeColor = Color.White
|
|
ElseIf lines1a(0) = 3 Then
|
|
Me.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
Button1.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
Button1.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
|
Label2.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
|
TextBox2.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
TextBox2.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
|
|
Timer1.Stop()
|
|
Try
|
|
My.Computer.Network.UploadFile(cozip & "pass.txt", ipserver & "utilisateur/" & Form3.Label21.Text & "/pass.txt")
|
|
File.Delete(cozip & "pass.txt")
|
|
MsgBox("Votre mot de passe a bien été changer", MsgBoxStyle.Information)
|
|
Close()
|
|
Catch ex As Exception
|
|
Timer1.Start()
|
|
End Try
|
|
End Sub
|
|
End Class |