Skip to content
This repository has been archived by the owner on Dec 14, 2017. It is now read-only.

Commit

Permalink
changed verification key timeout duration from int to time span
Browse files Browse the repository at this point in the history
  • Loading branch information
brockallen committed Jul 25, 2014
1 parent 8ece291 commit 24c2fbb
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public void TestDefaults()
Assert.AreEqual(true, settings.AllowAccountDeletion);
Assert.AreEqual(0, settings.PasswordHashingIterationCount);
Assert.AreEqual(0, settings.PasswordResetFrequency);
Assert.AreEqual(TimeSpan.FromMinutes(20), settings.VerificationKeyStaleDuration);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1965,7 +1965,7 @@ protected virtual bool IsVerificationKeyStale(TAccount account)
return true;
}

if (account.VerificationKeySent < UtcNow.AddMinutes(-Configuration.VerificationKeyStaleDurationMinutes))
if (account.VerificationKeySent < UtcNow.Subtract(Configuration.VerificationKeyStaleDuration))
{
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public MembershipRebootConfiguration(SecuritySettings securitySettings)
this.AllowAccountDeletion = securitySettings.AllowAccountDeletion;
this.PasswordHashingIterationCount = securitySettings.PasswordHashingIterationCount;
this.PasswordResetFrequency = securitySettings.PasswordResetFrequency;
this.VerificationKeyStaleDurationMinutes = securitySettings.VerificationKeyStaleDurationMinutes;
this.VerificationKeyStaleDuration = securitySettings.VerificationKeyStaleDuration;

this.Crypto = new DefaultCrypto();
}
Expand All @@ -46,7 +46,7 @@ public MembershipRebootConfiguration(SecuritySettings securitySettings)
public bool AllowAccountDeletion { get; set; }
public int PasswordHashingIterationCount { get; set; }
public int PasswordResetFrequency { get; set; }
public int VerificationKeyStaleDurationMinutes { get; set; }
public TimeSpan VerificationKeyStaleDuration { get; set; }

AggregateValidator<TAccount> usernameValidators = new AggregateValidator<TAccount>();
public void RegisterUsernameValidator(params IValidator<TAccount>[] items)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ public int PasswordResetFrequency
set { this[PASSWORDRESETFREQUENCY] = value; }
}

[ConfigurationProperty(VERIFICATIONKEYSTALEDURATIONMINUTES, DefaultValue = MembershipRebootConstants.UserAccount.VerificationKeyStaleDurationMinutes)]
public int VerificationKeyStaleDurationMinutes
[ConfigurationProperty(VERIFICATIONKEYSTALEDURATIONMINUTES, DefaultValue = MembershipRebootConstants.SecuritySettingDefaults.VerificationKeyStaleDuration)]
public TimeSpan VerificationKeyStaleDuration
{
get { return (int)this[VERIFICATIONKEYSTALEDURATIONMINUTES]; }
get { return (TimeSpan)this[VERIFICATIONKEYSTALEDURATIONMINUTES]; }
set { this[VERIFICATIONKEYSTALEDURATIONMINUTES] = value; }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ public class SecuritySettingDefaults
internal const bool AllowAccountDeletion = true;
internal const int PasswordHashingIterationCount = 0;
internal const int PasswordResetFrequency = 0;
internal const string VerificationKeyStaleDuration = "00:20:00";
}

public class UserAccount
{
internal const int VerificationKeyStaleDurationMinutes = 20;
internal const int MobileCodeLength = 6;
internal const int MobileCodeResendDelayMinutes = 1;
internal const int MobileCodeStaleDurationMinutes = 10;
Expand Down

0 comments on commit 24c2fbb

Please # to comment.