From c66646bfeb81b24db8912568799650600ee4fb46 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Fri, 31 Oct 2014 00:30:02 +0100 Subject: [PATCH] Housekeeping from today's work --- Site5/App_GlobalResources/Pages_Security.resx | 3 ++ Site5/Security/Authenticate.aspx | 16 --------- Site5/Security/Authenticate.aspx.cs | 9 ----- Site5/Security/Login.aspx.cs | 33 ++++++++++--------- 4 files changed, 21 insertions(+), 40 deletions(-) delete mode 100644 Site5/Security/Authenticate.aspx delete mode 100644 Site5/Security/Authenticate.aspx.cs diff --git a/Site5/App_GlobalResources/Pages_Security.resx b/Site5/App_GlobalResources/Pages_Security.resx index dd7910c8..5fe5737f 100644 --- a/Site5/App_GlobalResources/Pages_Security.resx +++ b/Site5/App_GlobalResources/Pages_Security.resx @@ -190,6 +190,9 @@ Reset Password + + Swarmops doesn't recognize this address. Please log in manually and activate your address before using it to login. + User diff --git a/Site5/Security/Authenticate.aspx b/Site5/Security/Authenticate.aspx deleted file mode 100644 index 06279715..00000000 --- a/Site5/Security/Authenticate.aspx +++ /dev/null @@ -1,16 +0,0 @@ -<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Authenticate.aspx.cs" Inherits="Security_Authenticate" %> - - - - - - - - -
-
- Testing. -
-
- - diff --git a/Site5/Security/Authenticate.aspx.cs b/Site5/Security/Authenticate.aspx.cs deleted file mode 100644 index 9998a1fb..00000000 --- a/Site5/Security/Authenticate.aspx.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; - -public partial class Security_Authenticate : System.Web.UI.Page -{ - protected void Page_Load(object sender, EventArgs e) - { - - } -} diff --git a/Site5/Security/Login.aspx.cs b/Site5/Security/Login.aspx.cs index 1b475bd0..fd080616 100644 --- a/Site5/Security/Login.aspx.cs +++ b/Site5/Security/Login.aspx.cs @@ -27,7 +27,6 @@ namespace Swarmops.Pages.Security { protected void Page_Load(object sender, EventArgs e) { - Person.FromIdentity(1).BitIdAddress = "14fRQCbR62EGzjPQks9XRAVRiqWhftn3dA"; // Check if this is the first run ever. If so, redirect to Init. @@ -45,7 +44,7 @@ namespace Swarmops.Pages.Security if (Request.Params["address"] != null) { - // looks like it + // yes, indeed looks like it BitIdCredentials credentials = new BitIdCredentials { @@ -112,10 +111,6 @@ namespace Swarmops.Pages.Security } } - - - - this.ImageCultureIndicator.Style[HtmlTextWriterStyle.MarginTop] = "-3px"; this.ImageCultureIndicator.Style[HtmlTextWriterStyle.MarginRight] = "3px"; this.ImageCultureIndicator.Style[HtmlTextWriterStyle.Cursor] = "pointer"; @@ -143,7 +138,7 @@ namespace Swarmops.Pages.Security GuidCache.Set(bitIdUri + "-Logon", "Unauth"); - // TODO: need to NOT FUCKING USE GOOGLE CHARTS for this but bring home a QR package + // TODO: need to NOT FUCKING 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); @@ -163,8 +158,12 @@ namespace Swarmops.Pages.Security { if ((string) GuidCache.Get(credentials.uri + "-Intent") == "Register") { - // set currentUser bitid - // Then go do something else, I guess + // the currently logged-on user desires to register this address + // so set currentUser bitid + this.CurrentUser.BitIdAddress = credentials.address; + // Then go do something else, I guess? Flag somehow to original page + // that the op is completed? + GuidCache.Set(credentials.uri + "-Intent", "Complete"); } } @@ -172,22 +171,26 @@ namespace Swarmops.Pages.Security { Person person = Person.FromBitIdAddress(credentials.address); + // TODO: If above throws, show friendly "unknown wallet" message + // TODO: Determine last logged-on organization. Right now, log on to Sandbox. GuidCache.Set(credentials.uri + "-LoggedOn", person.Identity.ToString(CultureInfo.InvariantCulture) + ",1,,BitId 2FA"); } - - response.StatusCode = 200; - response.ContentType = "application/json"; - response.Write("{\"address\":\"" + credentials.address + "\",\"signature\":\"" + credentials.signature + "\"}"); - response.End(); } catch (Exception e) { Persistence.Key["BitIdLogin_Debug_Exception"] = e.ToString(); } + + // TODO: Error codes + + response.StatusCode = 200; + response.ContentType = "application/json"; + response.Write("{\"address\":\"" + credentials.address + "\",\"signature\":\"" + credentials.signature + "\"}"); + response.End(); } else { @@ -203,7 +206,7 @@ namespace Swarmops.Pages.Security string uri = HttpUtility.UrlDecode(uriEncoded); // a little sloppy nonce and uri checking rather than full parsing - // TODO: Full parse + // TODO: Full URI parse, the above is not enough if (!uri.Contains(nonce) || !uri.Contains(HttpContext.Current.Request.Url.Host)) { throw new ArgumentException();