diff --git a/Site/Master-v5.master.cs b/Site/Master-v5.master.cs index 2f312aea..f90682b5 100644 --- a/Site/Master-v5.master.cs +++ b/Site/Master-v5.master.cs @@ -518,7 +518,7 @@ namespace Swarmops.Frontend string hostName = this.Request.Url.Host; - string bitIdUri = "bitid://" + hostName + "/Security/Login.aspx?x=" + this.bitIdNonce; + string bitIdUri = "bitid://" + hostName + "/Security/Login.aspx/BitIdLogin?x=" + this.bitIdNonce; if (this.Request.Url.ToString().StartsWith("http://") && !cloudFlareSsl) { diff --git a/Site/Security/Login.aspx.cs b/Site/Security/Login.aspx.cs index dd4758bb..04e019af 100644 --- a/Site/Security/Login.aspx.cs +++ b/Site/Security/Login.aspx.cs @@ -201,8 +201,10 @@ namespace Swarmops.Pages.Security protected string _cacheVersionMark; // CSS cache buster - protected void ProcessRespondBitId (BitIdCredentials credentials, HttpResponse response) + protected static void ProcessRespondBitId (BitIdCredentials credentials, HttpResponse response) { + AuthenticationData authData = GetAuthenticationDataAndCulture(); + BitcoinPubKeyAddress testAddress = new BitcoinPubKeyAddress (credentials.address); if (testAddress.VerifyMessage (credentials.uri, credentials.signature)) { @@ -210,13 +212,13 @@ namespace Swarmops.Pages.Security try { - if (CurrentUser != null) + if (authData.CurrentUser != null) { if ((string) GuidCache.Get (credentials.uri + "-Intent") == "Register") { // the currently logged-on user desires to register this address // so set currentUser bitid - CurrentUser.BitIdAddress = credentials.address; + authData.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"); @@ -348,6 +350,19 @@ namespace Swarmops.Pages.Security } + [WebMethod] + public static void BitIdLogin(string address, string signature, string uri) + { + BitIdCredentials credentials = new BitIdCredentials + { + address = address, + signature = signature, + uri = uri + }; + + ProcessRespondBitId(credentials, HttpContext.Current.Response); + } + protected override void OnPreInit (EventArgs e) { base.OnPreInit (e);