mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
fix(auth): replace HMAC token generation with SHA256 for email verification
the HMAC is intended for other actions like change email, i just forgot and was rushing at the time, whoops!
This commit is contained in:
@@ -233,7 +233,7 @@ namespace SharpbinV3.Server.Services
|
|||||||
}
|
}
|
||||||
|
|
||||||
string token = Utilities.GenerateSecureRandomString(EmailVerificationTokenLength);
|
string token = Utilities.GenerateSecureRandomString(EmailVerificationTokenLength);
|
||||||
string tokenHash = Utilities.ComputeHmacSha256(token, _emailSettings.Verification_HMAC_Secret);
|
string tokenHash = Utilities.ComputeSha256(token);
|
||||||
|
|
||||||
await _email.SendAsync(
|
await _email.SendAsync(
|
||||||
user.Email,
|
user.Email,
|
||||||
@@ -259,7 +259,7 @@ namespace SharpbinV3.Server.Services
|
|||||||
if (string.IsNullOrWhiteSpace(_emailSettings.Verification_HMAC_Secret))
|
if (string.IsNullOrWhiteSpace(_emailSettings.Verification_HMAC_Secret))
|
||||||
return (false, "Email verification is not configured.");
|
return (false, "Email verification is not configured.");
|
||||||
|
|
||||||
string tokenHash = Utilities.ComputeHmacSha256(token, _emailSettings.Verification_HMAC_Secret);
|
string tokenHash = Utilities.ComputeSha256(token);
|
||||||
var verificationToken = await _db.EmailVerificationTokens.Include(t => t.User).FirstOrDefaultAsync(t => t.TokenHash == tokenHash);
|
var verificationToken = await _db.EmailVerificationTokens.Include(t => t.User).FirstOrDefaultAsync(t => t.TokenHash == tokenHash);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|||||||
Reference in New Issue
Block a user