Skip to content

Commit

Permalink
Fixed the persistent cookie code
Browse files Browse the repository at this point in the history
The cookie expiration date should be set only if the cookie is
persistent, not the other way around.  The previous code did
exactly the opposite.
  • Loading branch information
mehrdada committed Apr 9, 2013
1 parent 2da2c51 commit 93ca90d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion AppHarbor.Web.Security/CookieAuthenticationModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private void RenewCookieIfExpiring(HttpContext context, CookieProtector protecto
HttpOnly = true,
Secure = _configuration.RequireSSL,
};
if (!authenticationCookie.Persistent)
if (authenticationCookie.Persistent)
{
newCookie.Expires = authenticationCookie.IssueDate + _configuration.Timeout;
}
Expand Down
2 changes: 1 addition & 1 deletion AppHarbor.Web.Security/CookieAuthenticator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void SetCookie(string username, bool persistent = false, string[] roles =
HttpOnly = true,
Secure = _configuration.RequireSSL,
};
if (!persistent)
if (persistent)
{
httpCookie.Expires = cookie.IssueDate + _configuration.Timeout;
}
Expand Down

0 comments on commit 93ca90d

Please sign in to comment.