157 lines
6.3 KiB
VB.net
157 lines
6.3 KiB
VB.net
Imports System.IO
|
|
Imports System.Net
|
|
Imports System.Net.Mail
|
|
Imports System.Security.Cryptography
|
|
Imports System.Text
|
|
|
|
Public Class Form141
|
|
Private Sub Form141_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)
|
|
Label1.ForeColor = Color.White
|
|
Button1.BackColor = Color.FromArgb(64, 64, 64)
|
|
Button1.ForeColor = Color.White
|
|
Label2.ForeColor = Color.White
|
|
TextBox1.BackColor = Color.FromArgb(64, 64, 64)
|
|
TextBox1.ForeColor = Color.White
|
|
ElseIf lines1a(0) = 3 Then
|
|
Me.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
Label1.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
|
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)
|
|
TextBox1.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
|
|
TextBox1.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
|
|
Else
|
|
|
|
End If
|
|
|
|
Gencode()
|
|
End Sub
|
|
Sub mail()
|
|
Try
|
|
My.Computer.Network.DownloadFile(ipsite & "utilisateur/" & Form3.TextBox7.Text & "/mail.txt", cozip & "mail.txt")
|
|
mail2()
|
|
Catch ex As Exception
|
|
Timer2.Start()
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
|
If TextBox1.Text = Label1.Text Then
|
|
Form3.co7()
|
|
Close()
|
|
Else
|
|
MsgBox("Le code de vérification est incorrect", MsgBoxStyle.Exclamation)
|
|
End If
|
|
End Sub
|
|
Function Gencode() As Integer
|
|
Dim NumRandom As Integer
|
|
Dim Rand As Random = New Random
|
|
Dim NumStr As String
|
|
|
|
Try
|
|
NumRandom = (Rand.Next(1, 999999))
|
|
NumStr = Strings.Right("" & NumRandom.ToString(), 6)
|
|
Label1.Text = "LM-" & NumStr
|
|
mail()
|
|
Catch ex As Exception
|
|
|
|
End Try
|
|
|
|
End Function
|
|
|
|
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
|
|
Timer1.Stop()
|
|
Dim t1 = cozip & "/mail.txt"
|
|
Dim lines() As String = File.ReadAllLines(t1)
|
|
|
|
Dim Resultatbytes() As Byte = Convert.FromBase64String(lines(0))
|
|
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.CreateDecryptor()
|
|
Dim donné() As Byte = Icrypto.TransformFinalBlock(Resultatbytes, 0, Resultatbytes.Length)
|
|
Dim maildecrypt = Encoding.UTF8.GetString(donné)
|
|
|
|
Try
|
|
Dim maj As New WebClient
|
|
Dim vri As String = maj.DownloadString("http://lecteur2.lecteur-media.fr/lecteur/passmail.txt")
|
|
Dim t2 = Label1.Text
|
|
Dim MyMailMessage As New MailMessage()
|
|
Dim SMTPServer As New SmtpClient("mail48.lwspanel.com")
|
|
Dim mail = maildecrypt
|
|
Dim message = "Le code de vérification est le: " & t2
|
|
|
|
MyMailMessage.From = New MailAddress("noreply@lecteur-media.fr")
|
|
MyMailMessage.To.Add(mail)
|
|
MyMailMessage.Subject = ("Vérification de connexion")
|
|
MyMailMessage.Body = (message)
|
|
|
|
SMTPServer.Port = ("587") 'Port
|
|
SMTPServer.Credentials = New System.Net.NetworkCredential("noreply@lecteur-media.fr", vri)
|
|
SMTPServer.EnableSsl = True
|
|
|
|
SMTPServer.Send(MyMailMessage) 'Envoi
|
|
|
|
File.Delete(cozip & "mail.txt")
|
|
|
|
MsgBox("Le code de vérification été envoyé à l'adresse mail", MsgBoxStyle.Information)
|
|
Catch ex As Exception
|
|
Timer1.Start()
|
|
End Try
|
|
End Sub
|
|
Sub mail2()
|
|
Dim t1 = cozip & "/mail.txt"
|
|
Dim lines() As String = File.ReadAllLines(t1)
|
|
|
|
Dim Resultatbytes() As Byte = Convert.FromBase64String(lines(0))
|
|
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.CreateDecryptor()
|
|
Dim donné() As Byte = Icrypto.TransformFinalBlock(Resultatbytes, 0, Resultatbytes.Length)
|
|
Dim maildecrypt = Encoding.UTF8.GetString(donné)
|
|
|
|
Try
|
|
Dim maj As New WebClient
|
|
Dim vri As String = maj.DownloadString("http://lecteur2.lecteur-media.fr/lecteur/passmail.txt")
|
|
Dim t2 = Label1.Text
|
|
Dim MyMailMessage As New MailMessage()
|
|
Dim SMTPServer As New SmtpClient("mail48.lwspanel.com")
|
|
Dim mail = maildecrypt
|
|
Dim message = "Le code de vérification est le: " & t2
|
|
|
|
MyMailMessage.From = New MailAddress("noreply@lecteur-media.fr")
|
|
MyMailMessage.To.Add(mail)
|
|
MyMailMessage.Subject = ("Vérification de connexion")
|
|
MyMailMessage.Body = (message)
|
|
|
|
SMTPServer.Port = ("587") 'Port
|
|
SMTPServer.Credentials = New System.Net.NetworkCredential("noreply@lecteur-media.fr", vri)
|
|
SMTPServer.EnableSsl = True
|
|
|
|
SMTPServer.Send(MyMailMessage) 'Envoi
|
|
|
|
File.Delete(cozip & "mail.txt")
|
|
|
|
MsgBox("Le code de vérification été envoyé à l'adresse mail", MsgBoxStyle.Information)
|
|
Catch ex As Exception
|
|
Timer1.Start()
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
|
|
Timer2.Stop()
|
|
Try
|
|
My.Computer.Network.DownloadFile(ipsite & "utilisateur/" & Form3.TextBox7.Text & "/mail.txt", cozip & "mail.txt")
|
|
mail2()
|
|
Catch ex As Exception
|
|
Timer2.Start()
|
|
End Try
|
|
End Sub
|
|
End Class |