Fixes: U4-3482 keepUserLoggedIn setting ignored? and streamlines some of the auth methods.

This commit is contained in:
Shannon
2013-11-12 17:38:32 +11:00
parent c28f800fe6
commit a532b49485
10 changed files with 68 additions and 44 deletions

View File

@@ -173,6 +173,9 @@ namespace Umbraco.Web.Security
_httpContext.UmbracoLogout();
}
/// <summary>
/// Renews the user's login ticket
/// </summary>
public void RenewLoginTimeout()
{
_httpContext.RenewUmbracoAuthTicket();
@@ -357,18 +360,6 @@ namespace Umbraco.Web.Security
return userApps.Any(uApp => uApp.InvariantEquals(app));
}
internal void UpdateLogin()
{
_httpContext.RenewUmbracoAuthTicket();
}
internal long GetTimeout()
{
var ticket = _httpContext.GetUmbracoAuthTicket();
var ticks = ticket.Expiration.Ticks - DateTime.Now.Ticks;
return ticks;
}
/// <summary>
/// Gets the user id.
/// </summary>
@@ -409,15 +400,8 @@ namespace Umbraco.Web.Security
/// <returns></returns>
public bool ValidateCurrentUser()
{
var ticket = _httpContext.GetUmbracoAuthTicket();
if (ticket != null)
{
if (ticket.Expired == false)
{
return true;
}
}
return false;
var result = ValidateCurrentUser(false);
return result == ValidateRequestAttempt.Success;
}
/// <summary>
@@ -440,8 +424,7 @@ namespace Umbraco.Web.Security
{
if (throwExceptions) throw new ArgumentException("You have no priviledges to the umbraco console. Please contact your administrator");
return ValidateRequestAttempt.FailedNoPrivileges;
}
UpdateLogin();
}
return ValidateRequestAttempt.Success;
}
if (throwExceptions) throw new ArgumentException("User has timed out!!");