diff --git a/External Dependencies/NBitcoin b/External Dependencies/NBitcoin index 3e118efe..ec11b894 160000 --- a/External Dependencies/NBitcoin +++ b/External Dependencies/NBitcoin @@ -1 +1 @@ -Subproject commit 3e118efebd7f7100311be010fa9a4c3552bbbd89 +Subproject commit ec11b894ec22a499f48348e9091cdaa026edbf3c diff --git a/Logic/Support/ExtensionMethods.cs b/Logic/Support/ExtensionMethods.cs index 20c0cfa1..f1e8651d 100644 --- a/Logic/Support/ExtensionMethods.cs +++ b/Logic/Support/ExtensionMethods.cs @@ -1,7 +1,28 @@ -using System.IO; +using System.Globalization; +using System.IO; namespace System.Web.ExtensionMethods { + /// + /// Extension methods for HTTP Response. + /// + public static class HttpResponseExtensions + { + /// + /// Set the response to be JSON format, and add appropriate headers. + /// + /// None. + public static void SetJson(this HttpResponse response) + { + response.ContentType = "application/json"; + response.CacheControl = "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"; // IE dumbfixes + response.AddHeader("Last-Modified", DateTime.UtcNow.ToString(CultureInfo.InvariantCulture)); + response.AddHeader("Pragma", "no-cache"); + } + } + + + /// /// Extension methods for HTTP Request. /// diff --git a/Site5/Security/BitId.aspx b/Site5/Security/BitId.aspx deleted file mode 100644 index f240c524..00000000 --- a/Site5/Security/BitId.aspx +++ /dev/null @@ -1 +0,0 @@ -<%@ Page Language="C#" AutoEventWireup="true" CodeFile="BitId.aspx.cs" Inherits="Swarmops.Security.BitId" %> \ No newline at end of file diff --git a/Site5/Security/FinalizeLogin.aspx b/Site5/Security/FinalizeLogin.aspx new file mode 100644 index 00000000..c4572b32 --- /dev/null +++ b/Site5/Security/FinalizeLogin.aspx @@ -0,0 +1 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeFile="FinalizeLogin.aspx.cs" Inherits="Swarmops.Security.FinalizeLogin" %> \ No newline at end of file diff --git a/Site5/Security/BitId.aspx.cs b/Site5/Security/FinalizeLogin.aspx.cs similarity index 93% rename from Site5/Security/BitId.aspx.cs rename to Site5/Security/FinalizeLogin.aspx.cs index d4e38b56..fba7ff73 100644 --- a/Site5/Security/BitId.aspx.cs +++ b/Site5/Security/FinalizeLogin.aspx.cs @@ -13,7 +13,7 @@ using Swarmops.Logic.Support; namespace Swarmops.Security { - public partial class BitId : System.Web.UI.Page + public partial class FinalizeLogin : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { diff --git a/Site5/Security/Login.aspx b/Site5/Security/Login.aspx index 21bb5cff..3c202f9e 100644 --- a/Site5/Security/Login.aspx +++ b/Site5/Security/Login.aspx @@ -52,7 +52,7 @@ success: function (msg) { if (msg.d) { // Login confirmed, fetch auth cookie from nonce in-context - document.location = "/Security/BitId.aspx?Nonce=" + bitIdNonce; + document.location = "/Security/FinalizeLogin.aspx?Nonce=" + bitIdNonce; } else { // Retry twice per second setTimeout(function () { @@ -112,8 +112,11 @@
-
User
Pass
 
-
+ + + + +
User  
Pass  
2FA  
diff --git a/Site5/Security/Login.aspx.cs b/Site5/Security/Login.aspx.cs index fd080616..1ef0d1ec 100644 --- a/Site5/Security/Login.aspx.cs +++ b/Site5/Security/Login.aspx.cs @@ -42,6 +42,8 @@ namespace Swarmops.Pages.Security { // We should ONLY get here if we're getting a BitId by Webform submission. + Persistence.Key["BitId_RawData"] = Request.ToRaw(); + if (Request.Params["address"] != null) { // yes, indeed looks like it @@ -138,10 +140,10 @@ namespace Swarmops.Pages.Security GuidCache.Set(bitIdUri + "-Logon", "Unauth"); - // TODO: need to NOT FUCKING USE GOOGLE CHARTS for this but bring home a free QR package + // TODO: need to NOT USE GOOGLE CHARTS for this but bring home a free QR package this.ImageBitIdQr.ImageUrl = - "http://chart.apis.google.com/chart?cht=qr&chs=400x400&chl=" + HttpUtility.UrlEncode(bitIdUri); + "https://chart.googleapis.com/chart?cht=qr&chs=400x400&chl=" + HttpUtility.UrlEncode(bitIdUri); } @@ -188,13 +190,13 @@ namespace Swarmops.Pages.Security // TODO: Error codes response.StatusCode = 200; - response.ContentType = "application/json"; + response.SetJson(); response.Write("{\"address\":\"" + credentials.address + "\",\"signature\":\"" + credentials.signature + "\"}"); response.End(); } else { - // TODO: return fuckoff code (technical term) + response.StatusCode = 401; // Be a bit more friendly in your return codes } }