Make all tokens expire

Closes #335
This commit is contained in:
jvyden 2022-07-29 15:08:41 -04:00
parent a8410fe352
commit 4ba75f09a9
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
16 changed files with 188 additions and 10 deletions

View file

@ -49,15 +49,18 @@ public class SetEmailForm : BaseLayout
UserId = user.UserId,
User = user,
EmailToken = CryptoHelper.GenerateAuthToken(),
ExpiresAt = DateTime.Now + TimeSpan.FromHours(6),
};
this.Database.EmailVerificationTokens.Add(emailVerifyToken);
// The user just set their email address. Now, let's grant them a token to proceed with verifying the email.
// TODO: insecure
WebToken webToken = new()
{
UserId = user.UserId,
UserToken = CryptoHelper.GenerateAuthToken(),
ExpiresAt = DateTime.Now + TimeSpan.FromDays(7),
};
this.Response.Cookies.Append