Disabled simple login for BitID-enabled accounts

This commit is contained in:
Rick Falkvinge
2016-12-13 21:07:10 +01:00
parent 7d4aa29890
commit 5f6149b36d
4 changed files with 29 additions and 2 deletions
+10 -1
View File
@@ -19,7 +19,7 @@ namespace Resources.Pages {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option or rebuild the Visual Studio project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Web.Application.StronglyTypedResourceProxyBuilder", "11.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Web.Application.StronglyTypedResourceProxyBuilder", "14.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Security {
@@ -250,6 +250,15 @@ namespace Resources.Pages {
}
}
/// <summary>
/// Looks up a localized string similar to &lt;strong&gt;BITID LOGIN REQUIRED&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;This login requires BitId authentication, as enabled by the account holder. You cannot log on with a username/password combination..
/// </summary>
internal static string Login_BitIdRequired_Dialog {
get {
return ResourceManager.GetString("Login_BitIdRequired_Dialog", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 2FA.
/// </summary>
@@ -182,6 +182,9 @@
<data name="Login_BitIdEnabled" xml:space="preserve">
<value>&lt;strong&gt;BitId two-factor authentication is now enabled.&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;From now on, you can use your bitcoin wallet to log in (and will &lt;strong&gt;need&lt;/strong&gt; to do so). Thank you for enabling added security.&lt;br/&gt;&lt;br/&gt;Please remember to keep your phone secure with a password, too.</value>
</data>
<data name="Login_BitIdRequired_Dialog" xml:space="preserve">
<value>&lt;strong&gt;BITID LOGIN REQUIRED&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;This login requires BitId authentication, as enabled by the account holder. You cannot log on with a username/password combination.</value>
</data>
<data name="Login_GoogleAuthenticatorCode" xml:space="preserve">
<value>2FA</value>
</data>
+2
View File
@@ -115,6 +115,8 @@
} else if (msg.d == "Fail") {
// inform user of bad credentials by means of a red cross on _both_ boxes
$('#TextLogin, #TextPass').css('background-image', "url('/Security/Images/iconshock-cross-12px.png')").css('background-position', 'right center').css('background-repeat', 'no-repeat');
} else if (msg.d == "BitIdRequired") {
alertify.alert(SwarmopsJS.unescape('<%=this.Localized_BitIdRequired_Dialog%>'));
} else {
// wut?
}
+14 -1
View File
@@ -316,6 +316,14 @@ namespace Swarmops.Pages.Security
Person authenticatedPerson = Authentication.Authenticate (credentialsLogin,
credentialsPass);
if (!string.IsNullOrEmpty(authenticatedPerson.BitIdAddress))
{
// We can't logon with username/password combo; bitID is activated and so
// require it.
return "BitIdRequired";
}
int lastOrgId = authenticatedPerson.LastLogonOrganizationId;
if (PilotInstallationIds.IsPilot (PilotInstallationIds.PiratePartySE) && (lastOrgId == 3 || lastOrgId == 0))
@@ -348,7 +356,7 @@ namespace Swarmops.Pages.Security
GuidCache.Set (logonUri + "-LoggedOn",
Authority.FromLogin (authenticatedPerson, Organization.FromIdentity (lastOrgId)).ToEncryptedXml());
return "Success"; // Prepare here for "2FARequired" return code
return "Success"; // Prepare here for "Additional2FARequired" return code
}
catch (UnauthorizedAccessException)
{
@@ -478,6 +486,11 @@ namespace Swarmops.Pages.Security
public string signature { get; set; }
}
public string Localized_BitIdRequired_Dialog
{
get { return Resources.Pages.Security.Login_BitIdRequired_Dialog; }
}
// ReSharper restore InconsistentNaming
}
}