From 94cc216ecbad0079413f4799119eb93d02417921 Mon Sep 17 00:00:00 2001 From: ja Date: Wed, 6 Oct 2021 16:19:21 +0200 Subject: [PATCH] =?UTF-8?q?Design=C3=A4nderungen=20und=20Tokengenerierungs?= =?UTF-8?q?funktion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- login/ForgotPW.aspx | 6 +++--- login/ForgotPW.aspx.vb | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/login/ForgotPW.aspx b/login/ForgotPW.aspx index 3a2b386..1e118ff 100644 --- a/login/ForgotPW.aspx +++ b/login/ForgotPW.aspx @@ -72,19 +72,19 @@
- + + -->
- +

Passwort vergessen:

diff --git a/login/ForgotPW.aspx.vb b/login/ForgotPW.aspx.vb index 3b7b7ad..6505523 100644 --- a/login/ForgotPW.aspx.vb +++ b/login/ForgotPW.aspx.vb @@ -106,7 +106,23 @@ Partial Class login_ForgotPW Return False End Function + Function genToken() As String + Dim time() As Byte = BitConverter.GetBytes(DateTime.UtcNow.ToBinary()) + Dim Key() As Byte = Guid.NewGuid().ToByteArray() + Dim token As String = Convert.ToBase64String(time.Concat(Key).ToArray()) + Return token + End Function + Function getDateoftoken(tokenname As String) As Boolean + Dim data() As Byte = Convert.FromBase64String(tokenname) + Dim wenn As DateTime = DateTime.FromBinary(BitConverter.ToInt64(data, 0)) + If wenn < DateTime.UtcNow.AddHours(-24) Then + Return False + MsgBox("Token nicht gefunden oder zu alt!" + Environment.NewLine + "Bitte erneut Mail senden!") + Else + Return True + End If + End Function Protected Sub txtEmail_TextChanged(sender As Object, e As EventArgs) regexval_txt_Email.Validate()