Added more validation to the various AuthController functions.
This commit is contained in:
@@ -47,7 +47,6 @@ namespace SecureCore.Authentication
|
||||
public static void InsertPasswordResetRequest(string email, string sessionToken, DateTime expirationDate, string userAgent, string ipAddress, string connectionString)
|
||||
{
|
||||
using var connection = new SqlConnection(connectionString);
|
||||
|
||||
using var command = new SqlCommand("LogPasswordResetRequest", connection) { CommandType = CommandType.StoredProcedure };
|
||||
|
||||
command.Parameters.AddWithValue("SessionToken", sessionToken);
|
||||
@@ -78,7 +77,6 @@ namespace SecureCore.Authentication
|
||||
public static (string PasswordHash, string Salt) GetPasswordHashAndSalt(string username, string connectionString)
|
||||
{
|
||||
using var connection = new SqlConnection(connectionString);
|
||||
|
||||
using var command = new SqlCommand("SELECT [Password Hash], [Salt] FROM dbo.GetUserPasswordHashAndSalt(@Username)", connection);
|
||||
|
||||
command.Parameters.AddWithValue("Username", username);
|
||||
|
||||
@@ -20,7 +20,6 @@ namespace SecureCore.Authentication
|
||||
public static bool IsSessionTokenValid(string sessionToken, string connectionString, bool isResetToken = false)
|
||||
{
|
||||
using var connection = new SqlConnection(connectionString);
|
||||
|
||||
using var command = new SqlCommand("ValidateSessionToken", connection) { CommandType = CommandType.StoredProcedure };
|
||||
|
||||
command.Parameters.AddWithValue("SessionToken", sessionToken);
|
||||
@@ -36,7 +35,6 @@ namespace SecureCore.Authentication
|
||||
public static void Logout(string sessionToken, string connectionString)
|
||||
{
|
||||
using var connection = new SqlConnection(connectionString);
|
||||
|
||||
using var command = new SqlCommand("LogoutUser", connection) { CommandType = CommandType.StoredProcedure };
|
||||
|
||||
command.Parameters.AddWithValue("SessionToken", sessionToken);
|
||||
@@ -49,7 +47,6 @@ namespace SecureCore.Authentication
|
||||
public static void Login(string userName, string sessionToken, DateTime expirationDate, string userAgent, string ipAddress, string connectionString)
|
||||
{
|
||||
using var connection = new SqlConnection(connectionString);
|
||||
|
||||
using var command = new SqlCommand("LoginUser", connection) { CommandType = CommandType.StoredProcedure };
|
||||
|
||||
command.Parameters.AddWithValue("SessionToken", sessionToken);
|
||||
|
||||
Reference in New Issue
Block a user