Update password field in db, set null for uninitialized
This commit is contained in:
@@ -8,6 +8,8 @@ namespace MileageTraker.Web.DAL
|
||||
{
|
||||
public class CodeFirstMembershipProvider : MembershipProvider
|
||||
{
|
||||
public const string UninitializedPassword = "uninitialized_state";
|
||||
|
||||
#region Properties
|
||||
|
||||
public override string ApplicationName
|
||||
@@ -68,19 +70,17 @@ namespace MileageTraker.Web.DAL
|
||||
status = MembershipCreateStatus.InvalidUserName;
|
||||
return null;
|
||||
}
|
||||
if (string.IsNullOrEmpty(password))
|
||||
{
|
||||
status = MembershipCreateStatus.InvalidPassword;
|
||||
return null;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(email))
|
||||
{
|
||||
status = MembershipCreateStatus.InvalidEmail;
|
||||
return null;
|
||||
}
|
||||
|
||||
var hashedPassword = Crypto.HashPassword(password);
|
||||
if (hashedPassword.Length > 128)
|
||||
string hashedPassword = null;
|
||||
if (password != UninitializedPassword)
|
||||
hashedPassword = Crypto.HashPassword(password);
|
||||
if (hashedPassword != null && hashedPassword.Length > 128)
|
||||
{
|
||||
status = MembershipCreateStatus.InvalidPassword;
|
||||
return null;
|
||||
@@ -143,7 +143,11 @@ namespace MileageTraker.Web.DAL
|
||||
throw new UserLockedOutException();
|
||||
}
|
||||
var hashedPassword = user.Password;
|
||||
var verificationSucceeded = (hashedPassword != null && Crypto.VerifyHashedPassword(hashedPassword, password));
|
||||
|
||||
if (hashedPassword == null)
|
||||
throw new UninitializedAccountException();
|
||||
|
||||
var verificationSucceeded =Crypto.VerifyHashedPassword(hashedPassword, password);
|
||||
if (verificationSucceeded)
|
||||
{
|
||||
user.PasswordFailuresSinceLastSuccess = 0;
|
||||
|
||||
Reference in New Issue
Block a user