Admin auth functionally complete
This commit is contained in:
@@ -136,11 +136,11 @@ namespace MileageTraker.Web.DAL
|
||||
}
|
||||
if (!user.IsApproved)
|
||||
{
|
||||
return false;
|
||||
throw new UserAccountDisabledException();
|
||||
}
|
||||
if (user.IsLockedOut)
|
||||
{
|
||||
return false;
|
||||
throw new UserLockedOutException();
|
||||
}
|
||||
var hashedPassword = user.Password;
|
||||
var verificationSucceeded = (hashedPassword != null && Crypto.VerifyHashedPassword(hashedPassword, password));
|
||||
|
||||
@@ -475,6 +475,8 @@ namespace MileageTraker.Web.DAL
|
||||
var user = GetUser(userId);
|
||||
user.Password = Crypto.HashPassword(password);
|
||||
user.LastPasswordChangedDate = DateTime.Now;
|
||||
user.IsLockedOut = false;
|
||||
user.PasswordFailuresSinceLastSuccess = 0;
|
||||
UpdateUser(user);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
using System;
|
||||
|
||||
namespace MileageTraker.Web.DAL
|
||||
{
|
||||
public class UserAccountDisabledException : Exception
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using System;
|
||||
|
||||
namespace MileageTraker.Web.DAL
|
||||
{
|
||||
public class UserLockedOutException : Exception
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user