Fix multi site view SigeOut/Login problem when user/admin viewing multi site

This commit is contained in:
stephen 2013-09-09 12:45:59 +08:00
parent 6f220a3a2b
commit 4159c9c419

View file

@ -47,6 +47,9 @@ namespace WebsitePanel.AWStats.Viewer
{ {
private void Page_Load(object sender, EventArgs e) private void Page_Load(object sender, EventArgs e)
{ {
string username = Request["username"];
string password = Request["password"];
if (Request.IsAuthenticated) if (Request.IsAuthenticated)
{ {
string identity = Context.User.Identity.Name; string identity = Context.User.Identity.Name;
@ -55,9 +58,21 @@ namespace WebsitePanel.AWStats.Viewer
if (String.Compare(Request["config"], domain, true) != 0) if (String.Compare(Request["config"], domain, true) != 0)
{ {
FormsAuthentication.SignOut(); FormsAuthentication.SignOut();
domain = Request["domain"];
if (!String.IsNullOrEmpty(domain)
&& !String.IsNullOrEmpty(username)
&& !String.IsNullOrEmpty(password))
{
// perform login
txtUsername.Text = username;
txtDomain.Text = domain;
Login(domain, username, password);
}
else
{
Response.Redirect(Request.Url.AbsolutePath); Response.Redirect(Request.Url.AbsolutePath);
} }
}
Response.Clear(); Response.Clear();
string queryParams = Request.Url.Query; string queryParams = Request.Url.Query;
@ -74,7 +89,6 @@ namespace WebsitePanel.AWStats.Viewer
// replace links // replace links
awStatsPage = awStatsPage.Replace(AWStatsScript, Request.Url.AbsolutePath); awStatsPage = awStatsPage.Replace(AWStatsScript, Request.Url.AbsolutePath);
Response.Write(awStatsPage); Response.Write(awStatsPage);
Response.End(); Response.End();
@ -86,8 +100,6 @@ namespace WebsitePanel.AWStats.Viewer
if (!IsPostBack) if (!IsPostBack)
{ {
string domain = Request["domain"]; string domain = Request["domain"];
string username = Request["username"];
string password = Request["password"];
if (String.IsNullOrEmpty(domain)) if (String.IsNullOrEmpty(domain))
domain = Request["config"]; domain = Request["config"];