Asyncroner Aufruf der PW Erstellung
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
<%@ Page Language="VB" AutoEventWireup="false" Debug="True" CodeFile="ForgotPW.aspx.vb" Inherits="ForgotPW" %>
|
<%@ Page Language="VB" AutoEventWireup="false" Debug="True" CodeFile="ForgotPW.aspx.vb" Inherits="ForgotPW" Async="true" %>
|
||||||
<%@ Reference VirtualPath="~/login/Change_PW.aspx" %>
|
<%@ Reference VirtualPath="~/login/Change_PW.aspx" %>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ Imports System.Drawing
|
|||||||
Imports System.Configuration
|
Imports System.Configuration
|
||||||
Imports System.Data.SqlClient
|
Imports System.Data.SqlClient
|
||||||
Imports System.Data
|
Imports System.Data
|
||||||
|
Imports System.Threading
|
||||||
|
Imports System.Threading.Tasks
|
||||||
|
|
||||||
Partial Class ForgotPW
|
Partial Class ForgotPW
|
||||||
Inherits System.Web.UI.Page
|
Inherits System.Web.UI.Page
|
||||||
@@ -269,7 +271,7 @@ Partial Class ForgotPW
|
|||||||
End Try
|
End Try
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Protected Sub btn_Send_M_Click(sender As Object, e As EventArgs)
|
Protected Async Sub btn_Send_M_Click(sender As Object, e As EventArgs)
|
||||||
|
|
||||||
Dim username As String = String.Empty
|
Dim username As String = String.Empty
|
||||||
Dim password As String = String.Empty
|
Dim password As String = String.Empty
|
||||||
@@ -356,7 +358,7 @@ Partial Class ForgotPW
|
|||||||
lblMessage_M.Text = "Error 08. The form has not been filled completeley."
|
lblMessage_M.Text = "Error 08. The form has not been filled completeley."
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'Erweiterte Degub Msg-Box
|
'Erweiterte Debug Msg-Box
|
||||||
'MsgBox("Userdaten in App" + Environment.NewLine + email + Environment.NewLine + username + Environment.NewLine + "Userdaten desktop" + txt_Username.Text + Environment.NewLine + txtEmail.Text + Environment.NewLine + "Userdaten Mobil:" + Environment.NewLine + txtEmail_M.Text + Environment.NewLine + txt_Username_M.Text)
|
'MsgBox("Userdaten in App" + Environment.NewLine + email + Environment.NewLine + username + Environment.NewLine + "Userdaten desktop" + txt_Username.Text + Environment.NewLine + txtEmail.Text + Environment.NewLine + "Userdaten Mobil:" + Environment.NewLine + txtEmail_M.Text + Environment.NewLine + txt_Username_M.Text)
|
||||||
If String.IsNullOrEmpty(tokenname) = True And String.IsNullOrEmpty(password) = True Then
|
If String.IsNullOrEmpty(tokenname) = True And String.IsNullOrEmpty(password) = True Then
|
||||||
If HttpContext.Current.Request.ServerVariables("SERVER_NAME") = "localhost" Then
|
If HttpContext.Current.Request.ServerVariables("SERVER_NAME") = "localhost" Then
|
||||||
@@ -454,8 +456,14 @@ Partial Class ForgotPW
|
|||||||
Else
|
Else
|
||||||
tokenname = Session.Item("TokenforEmail")
|
tokenname = Session.Item("TokenforEmail")
|
||||||
End If
|
End If
|
||||||
'Dim md5temptoken As String = gensaltToken(username, password, email, customerID, isusernameright, isuserIDright, isuserEmailright, Session.IsNewSession, UserID)
|
'Dim md5temptoken As String
|
||||||
|
|
||||||
|
'md5temptoken = Await Findtokenhashsalt(username, password, email, customerID, isusernameright, isuserIDright, isuserEmailright, Session.IsNewSession, UserID)
|
||||||
|
|
||||||
|
'md5temptoken = gensaltToken(username, password, email, customerID, isusernameright, isuserIDright, isuserEmailright, Session.IsNewSession, UserID)
|
||||||
|
|
||||||
'MsgBox("Token:" + tokenname + Environment.NewLine + "md5" + md5temptoken)
|
'MsgBox("Token:" + tokenname + Environment.NewLine + "md5" + md5temptoken)
|
||||||
|
|
||||||
If SendEmail_M(username, password, email, tokenname, customerID, isusernameright, isuserIDright, isuserEmailright, Session.IsNewSession, UserID) = True Then
|
If SendEmail_M(username, password, email, tokenname, customerID, isusernameright, isuserIDright, isuserEmailright, Session.IsNewSession, UserID) = True Then
|
||||||
'password = RandomString(New Random, 10)
|
'password = RandomString(New Random, 10)
|
||||||
If (getDateoftoken(tokenname) = True) Then
|
If (getDateoftoken(tokenname) = True) Then
|
||||||
@@ -597,6 +605,13 @@ Partial Class ForgotPW
|
|||||||
End If
|
End If
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Async Function Findtokenhashsalt(username As String, password As String, email As String, customerID As String, isusernameright As Boolean, isuserIDright As Boolean, isuserEmailright As Boolean, isnewsess As Boolean, UserID As String) As Task(Of String)
|
||||||
|
Dim t As Task(Of String)
|
||||||
|
t = Task.Run(Function() As String
|
||||||
|
Return gensaltToken(username, password, email, customerID, isusernameright, isuserIDright, isuserEmailright, isnewsess, UserID)
|
||||||
|
End Function)
|
||||||
|
Return Await t
|
||||||
|
End Function
|
||||||
Function SendEmail(username As String, password As String, email As String, tokenname As String, customerID As String, isusrnmright As Boolean, iscstmIDright As Boolean, isemailright As Boolean, sessionisnew As Boolean, theUserID As String) As Boolean
|
Function SendEmail(username As String, password As String, email As String, tokenname As String, customerID As String, isusrnmright As Boolean, iscstmIDright As Boolean, isemailright As Boolean, sessionisnew As Boolean, theUserID As String) As Boolean
|
||||||
Dim getdomianenvironment As String = String.Empty
|
Dim getdomianenvironment As String = String.Empty
|
||||||
Dim pagename As String = String.Empty
|
Dim pagename As String = String.Empty
|
||||||
@@ -738,7 +753,7 @@ Partial Class ForgotPW
|
|||||||
Dim time() As Byte = BitConverter.GetBytes(DateTime.UtcNow.ToBinary())
|
Dim time() As Byte = BitConverter.GetBytes(DateTime.UtcNow.ToBinary())
|
||||||
Dim Key() As Byte = Guid.NewGuid().ToByteArray()
|
Dim Key() As Byte = Guid.NewGuid().ToByteArray()
|
||||||
Dim token As String
|
Dim token As String
|
||||||
Dim MyMin As Integer = 55, MyMax As Integer = 87555, My1stRandomNumber As Integer, My2ndRandomNumber As Integer
|
Dim MyMin As Integer = 25, MyMax As Integer = 788755, My1stRandomNumber As Integer, My2ndRandomNumber As Integer
|
||||||
' Create a random number generator
|
' Create a random number generator
|
||||||
Dim Generator As System.Random = New System.Random()
|
Dim Generator As System.Random = New System.Random()
|
||||||
|
|
||||||
@@ -751,7 +766,7 @@ Partial Class ForgotPW
|
|||||||
Try
|
Try
|
||||||
Dim salt As String = VERAG_VARIABLES.GenerateSalt(My1stRandomNumber)
|
Dim salt As String = VERAG_VARIABLES.GenerateSalt(My1stRandomNumber)
|
||||||
Dim tok As String = Convert.ToBase64String(time.Concat(Key).ToArray())
|
Dim tok As String = Convert.ToBase64String(time.Concat(Key).ToArray())
|
||||||
token = VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(VERAG_VARIABLES.HashPassword(tok, salt, 10101, My1stRandomNumber))
|
token = VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(VERAG_VARIABLES.HashPassword(tok, salt, 1991, My1stRandomNumber))
|
||||||
Return token
|
Return token
|
||||||
Catch Ex As Exception
|
Catch Ex As Exception
|
||||||
'Dim Msg, Style, Title As String
|
'Dim Msg, Style, Title As String
|
||||||
@@ -763,7 +778,7 @@ Partial Class ForgotPW
|
|||||||
'genToken(username, password, email)
|
'genToken(username, password, email)
|
||||||
Dim salt As String = VERAG_VARIABLES.GenerateSalt(My1stRandomNumber)
|
Dim salt As String = VERAG_VARIABLES.GenerateSalt(My1stRandomNumber)
|
||||||
Dim tok As String = Convert.ToBase64String(time.Concat(Key).ToArray())
|
Dim tok As String = Convert.ToBase64String(time.Concat(Key).ToArray())
|
||||||
token = VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(VERAG_VARIABLES.HashPassword(tok, salt, 10101, My1stRandomNumber))
|
token = VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(VERAG_VARIABLES.HashPassword(tok, salt, 1991, My2ndRandomNumber))
|
||||||
|
|
||||||
If SendEmail(username, password, email, token, CustomerID, isusrnmright, iscstmIDright, isemailright, Session.IsNewSession, theUserID) = True Then
|
If SendEmail(username, password, email, token, CustomerID, isusrnmright, iscstmIDright, isemailright, Session.IsNewSession, theUserID) = True Then
|
||||||
'MsgBox("Email could not been sent because of an internal encryption error.", vbOK + vbInformation + vbDefaultButton1, "Token-Generation Error")
|
'MsgBox("Email could not been sent because of an internal encryption error.", vbOK + vbInformation + vbDefaultButton1, "Token-Generation Error")
|
||||||
@@ -850,7 +865,7 @@ Partial Class ForgotPW
|
|||||||
Dim CustomerID As String = "717585"
|
Dim CustomerID As String = "717585"
|
||||||
Dim TheusrID As String = "3"
|
Dim TheusrID As String = "3"
|
||||||
Dim tokentest As String = genToken(username, Passw, email, CustomerID, True, True, True, False, TheusrID)
|
Dim tokentest As String = genToken(username, Passw, email, CustomerID, True, True, True, False, TheusrID)
|
||||||
'Dim md5temptoken As String = gensaltToken(username, Passw, email, CustomerID, True, True, True, False, TheusrID)
|
|
||||||
If Session.Item("TokenforEmail") = Nothing Then
|
If Session.Item("TokenforEmail") = Nothing Then
|
||||||
tokentest = genToken(username, Passw, email, CustomerID, True, True, True, False, TheusrID)
|
tokentest = genToken(username, Passw, email, CustomerID, True, True, True, False, TheusrID)
|
||||||
Session.Add("TokenforEmail", tokentest)
|
Session.Add("TokenforEmail", tokentest)
|
||||||
|
|||||||
Reference in New Issue
Block a user