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

Commit da3ad4f

Browse files
committed
fix bug in authenticate related to logging in before account is verified. #496
1 parent 270debb commit da3ad4f

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/BrockAllen.MembershipReboot.Test/AccountService/UserAccountServiceTests.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2467,8 +2467,20 @@ public void SendUsernameReminder_EmailIsNotUnique_Fails()
24672467
Assert.Fail();
24682468
}
24692469
catch (InvalidOperationException) { }
2470-
24712470
}
24722471

2472+
[TestMethod]
2473+
public void Logging_in_before_account_is_verified_does_not_cause_account_to_have_last_login_set()
2474+
{
2475+
configuration.RequireAccountVerification = true;
2476+
2477+
var acct = subject.CreateAccount("test", "pass", "[email protected]");
2478+
2479+
var result = subject.Authenticate("test", "pass");
2480+
Assert.IsFalse(result);
2481+
2482+
acct = subject.GetByID(acct.ID);
2483+
Assert.IsTrue(acct.IsNew());
2484+
}
24732485
}
24742486
}

src/BrockAllen.MembershipReboot/AccountService/UserAccountService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ protected virtual bool Authenticate(TAccount account, string password)
902902
{
903903
Tracing.Error("[UserAccountService.Authenticate] failed -- account not verified");
904904
this.AddEvent(new AccountNotVerifiedEvent<TAccount>() { Account = account });
905-
result = false;
905+
return false;
906906
}
907907

908908
Tracing.Verbose("[UserAccountService.Authenticate] authentication success");

0 commit comments

Comments
 (0)