Fixed UTF-8 for DashboardMessage
This commit is contained in:
@@ -67,6 +67,7 @@
|
||||
<Compile Include="PirateWebMapProvider.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="RssWriter.cs" />
|
||||
<Compile Include="Support\DashboardMessage.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Basic\Basic.csproj">
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
|
||||
namespace Swarmops.Interface.Support
|
||||
{
|
||||
public class DashboardMessage
|
||||
{
|
||||
public static void Set (string localizedMessage)
|
||||
{
|
||||
CheckContext();
|
||||
|
||||
HttpCookie setMessage = new HttpCookie("DashboardMessage", Uri.EscapeDataString (localizedMessage).Replace ("+", "%20").Replace ("'", "%27"));
|
||||
setMessage.Expires = DateTime.Now.AddDays(7);
|
||||
|
||||
HttpContext.Current.Response.SetCookie(setMessage);
|
||||
}
|
||||
|
||||
public static void Reset()
|
||||
{
|
||||
CheckContext();
|
||||
|
||||
HttpCookie clearMessage = new HttpCookie ("DashboardMessage", string.Empty);
|
||||
clearMessage.Expires = DateTime.Now.AddYears(-10);
|
||||
|
||||
HttpContext.Current.Response.SetCookie(clearMessage);
|
||||
}
|
||||
|
||||
private static void CheckContext()
|
||||
{
|
||||
if (HttpContext.Current == null)
|
||||
{
|
||||
throw new InvalidOperationException("No active HttpContext");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using Resources;
|
||||
using Swarmops.Interface.Support;
|
||||
using Swarmops.Logic.Financial;
|
||||
using Swarmops.Logic.Security;
|
||||
using Swarmops.Logic.Structure;
|
||||
@@ -155,9 +156,8 @@ namespace Swarmops
|
||||
if (dashMessage != null && dashMessage.Value.Length > 0)
|
||||
{
|
||||
this.LiteralDocumentReadyHook.Text =
|
||||
string.Format ("alertify.alert(unescape('{0}'.replace(/\\+/g, '%20')));", dashMessage.Value);
|
||||
Response.SetCookie (new HttpCookie ("DashboardMessage", string.Empty));
|
||||
Response.Cookies["DashboardMessage"].Expires = DateTime.Now.AddYears (-10);
|
||||
string.Format ("alertify.alert(decodeURIComponent('{0}'));", dashMessage.Value);
|
||||
DashboardMessage.Reset();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Globalization;
|
||||
using System.Web;
|
||||
using System.Web.UI.WebControls;
|
||||
using Resources;
|
||||
using Swarmops.Interface.Support;
|
||||
using Swarmops.Logic.Financial;
|
||||
using Swarmops.Logic.Structure;
|
||||
using Swarmops.Logic.Swarm;
|
||||
@@ -129,7 +130,7 @@ namespace Swarmops.Frontend.Pages.v5.Admin
|
||||
string successMessage = String.Format (Resources.Pages.Admin.CreateOrganization_Success,
|
||||
Participant.Localized (peopleLabel, TitleVariant.Ship));
|
||||
|
||||
Response.AppendCookie (new HttpCookie ("DashboardMessage", HttpUtility.UrlEncode (successMessage)));
|
||||
DashboardMessage.Set (successMessage);
|
||||
|
||||
// Log in to new organization, then redirect to Edit
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Web;
|
||||
using Swarmops.Interface.Support;
|
||||
using Swarmops.Logic.Financial;
|
||||
using Swarmops.Logic.Security;
|
||||
using Swarmops.Logic.Support;
|
||||
@@ -212,7 +213,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
claim.Attest (CurrentUser);
|
||||
}
|
||||
|
||||
Response.AppendCookie (new HttpCookie ("DashboardMessage", HttpUtility.UrlEncode (successMessage)));
|
||||
DashboardMessage.Set (successMessage);
|
||||
|
||||
// Redirect to dashboard
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Web;
|
||||
using Swarmops.Interface.Support;
|
||||
using Swarmops.Logic.Financial;
|
||||
using Swarmops.Logic.Security;
|
||||
|
||||
@@ -108,7 +109,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial
|
||||
cashAdvance.Attest (CurrentUser);
|
||||
}
|
||||
|
||||
Response.AppendCookie (new HttpCookie ("DashboardMessage", HttpUtility.UrlEncode (successMessage)));
|
||||
DashboardMessage.Set (successMessage);
|
||||
|
||||
// Redirect to dashboard
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ using Swarmops.Logic.Security;
|
||||
using Swarmops.Logic.Structure;
|
||||
using Swarmops.Logic.Support;
|
||||
using Swarmops.Logic.Swarm;
|
||||
using Swarmops.Interface.Support;
|
||||
|
||||
// TODO: There are significant remnants in this file from the old Telerik-based upload code. When Account Automation is complete and the user can select a bank profile
|
||||
// for an account, uploading payment files as well as bank statements, remove that dead code as its templates won't be needed after that.
|
||||
@@ -62,9 +63,7 @@ namespace Swarmops.Site.Pages.Ledgers
|
||||
|
||||
if (!supportedHardcode)
|
||||
{
|
||||
Response.AppendCookie (new HttpCookie ("DashboardMessage",
|
||||
HttpUtility.UrlEncode (
|
||||
"There are no asset accounts set up for automation, so no accounts support data upload at this time. Returning to Dashboard.")));
|
||||
DashboardMessage.Set ("There are no asset accounts set up for automation, so no accounts support data upload at this time. Returning to Dashboard.");
|
||||
Response.Redirect ("/", true);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Web.UI;
|
||||
using Swarmops.Basic.Types;
|
||||
using Swarmops.Basic.Types.Swarm;
|
||||
using Swarmops.Database;
|
||||
using Swarmops.Interface.Support;
|
||||
using Swarmops.Logic.Security;
|
||||
using Swarmops.Logic.Support;
|
||||
using Swarmops.Logic.Swarm;
|
||||
@@ -30,9 +31,7 @@ namespace Swarmops.Pages.Security
|
||||
if (Request.Url.Host == "dev.swarmops.com" &&
|
||||
PilotInstallationIds.IsPilot (PilotInstallationIds.DevelopmentSandbox))
|
||||
{
|
||||
Response.AppendCookie (new HttpCookie ("DashboardMessage",
|
||||
HttpUtility.UrlEncode (
|
||||
"<p>You have been logged on as <strong>Sandbox Administrator</strong> to the Swarmops Development Sandbox.</p><br/><p>This machine runs the latest development build, so you may run into diagnostic code and half-finished features. All data here is bogus test data and is reset every night.</p><br/><p><strong>In other words, welcome, and play away!</strong></p><br/><br/>")));
|
||||
DashboardMessage.Set ("<p>You have been logged on as <strong>Sandbox Administrator</strong> to the Swarmops Development Sandbox.</p><br/><p>This machine runs the latest development build, so you may run into diagnostic code and half-finished features. All data here is bogus test data and is reset every night.</p><br/><p><strong>In other words, welcome, and play away!</strong></p><br/><br/>");
|
||||
FormsAuthentication.RedirectFromLoginPage ("1,1", true);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ using System.Web.UI;
|
||||
using NBitcoin;
|
||||
using Resources;
|
||||
using Swarmops.Database;
|
||||
using Swarmops.Interface.Support;
|
||||
using Swarmops.Logic.Cache;
|
||||
using Swarmops.Logic.Security;
|
||||
using Swarmops.Logic.Structure;
|
||||
@@ -78,9 +79,7 @@ namespace Swarmops.Pages.Security
|
||||
PilotInstallationIds.IsPilot (PilotInstallationIds.DevelopmentSandbox) &&
|
||||
Request.QueryString["SuppressAutologin"] != "true")
|
||||
{
|
||||
Response.AppendCookie (new HttpCookie ("DashboardMessage",
|
||||
HttpUtility.UrlEncode (
|
||||
"<p>You have been logged on as <strong>Sandbox Administrator</strong> to the Swarmops Development Sandbox.</p><br/><p>This machine runs the latest development build, so you may run into diagnostic code and half-finished features. All data here is bogus test data and is reset every night.</p><br/><p><strong>In other words, welcome, and play away!</strong></p>")));
|
||||
DashboardMessage.Set ("<p>You have been logged on as <strong>Sandbox Administrator</strong> to the Swarmops Development Sandbox.</p><br/><p>This machine runs the latest development build, so you may run into diagnostic code and half-finished features. All data here is bogus test data and is reset every night.</p><br/><p><strong>In other words, welcome, and play away!</strong></p>");
|
||||
FormsAuthentication.SetAuthCookie ("1,1", true);
|
||||
Response.Redirect ("/");
|
||||
}
|
||||
@@ -91,9 +90,9 @@ namespace Swarmops.Pages.Security
|
||||
|
||||
if (organizationOpenLedgers != null)
|
||||
{
|
||||
Response.AppendCookie(new HttpCookie("DashboardMessage", HttpUtility.UrlEncode(String.Format(Resources.Pages.Security.Login_AsOpenLedgers, organizationOpenLedgers.Name))));
|
||||
DashboardMessage.Set (String.Format(Resources.Pages.Security.Login_AsOpenLedgers, organizationOpenLedgers.Name));
|
||||
FormsAuthentication.SetAuthCookie(Person.OpenLedgersIdentity.ToString() + "," + organizationOpenLedgers.Identity.ToString(), true);
|
||||
Response.Redirect ("/Ledgers/BalanceSheet");
|
||||
Response.Redirect (@"/Ledgers/BalanceSheet");
|
||||
}
|
||||
|
||||
// Check for SSL and force it
|
||||
|
||||
@@ -9,6 +9,7 @@ using System.Web.Services;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using NBitcoin.BouncyCastle.Asn1.Ocsp;
|
||||
using Swarmops.Interface.Support;
|
||||
using Swarmops.Logic.Communications;
|
||||
using Swarmops.Logic.Communications.Transmission;
|
||||
using Swarmops.Logic.Structure;
|
||||
@@ -135,7 +136,7 @@ namespace Swarmops.Pages.Security
|
||||
// Set cookies
|
||||
|
||||
FormsAuthentication.SetAuthCookie(resetPerson.Identity.ToString(CultureInfo.InvariantCulture) + "," + lastOrgId.ToString(CultureInfo.InvariantCulture) + ",,AuthPlain", true);
|
||||
HttpContext.Current.Response.SetCookie (new HttpCookie ("DashboardMessage", Resources.Pages.Security.ResetPassword_Success));
|
||||
DashboardMessage.Set (Resources.Pages.Security.ResetPassword_Success);
|
||||
|
||||
return true; // temp
|
||||
|
||||
|
||||
Reference in New Issue
Block a user