Work on BitId enabling

This commit is contained in:
Falkvinge
2016-11-22 19:12:43 +01:00
parent 72dfa4f236
commit d7107ed8f6
5 changed files with 58 additions and 7 deletions
+10 -1
View File
@@ -1573,7 +1573,7 @@ namespace Resources {
}
/// <summary>
/// Looks up a localized string similar to &lt;strong&gt;PASSWORD CHANGED&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;You have successfully changed your password. As a security measure, all withdrawals are now in quarantine for the next 48 hours.&lt;br/&gt;&lt;br/&gt;If you can, please enable BitID two-factor authentication..
/// Looks up a localized string similar to &lt;strong&gt;PASSWORD CHANGED&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;You have successfully changed your password. As a security measure, all withdrawals are now in quarantine for the next 48 hours..
/// </summary>
internal static string Master_EditPersonNewPassword_Changed {
get {
@@ -1653,6 +1653,15 @@ namespace Resources {
}
}
/// <summary>
/// Looks up a localized string similar to If you can, please enable BitID two-factor authentication..
/// </summary>
internal static string Master_EditPerson_PleaseEnable2FA {
get {
return ResourceManager.GetString("Master_EditPerson_PleaseEnable2FA", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to You are currently logged into &lt;strong&gt;{0}&lt;/strong&gt;. Would you like to switch to another organization?.
/// </summary>
+4 -1
View File
@@ -823,6 +823,9 @@
<value>Unable to set new password: The new password is too weak. Use a stronger password.</value>
</data>
<data name="Master_EditPersonNewPassword_Changed" xml:space="preserve">
<value>&lt;strong&gt;PASSWORD CHANGED&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;You have successfully changed your password. As a security measure, all withdrawals are now in quarantine for the next 48 hours.&lt;br/&gt;&lt;br/&gt;If you can, please enable BitID two-factor authentication.</value>
<value>&lt;strong&gt;PASSWORD CHANGED&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;You have successfully changed your password. As a security measure, all withdrawals are now in quarantine for the next 48 hours.</value>
</data>
<data name="Master_EditPerson_PleaseEnable2FA" xml:space="preserve">
<value>If you can, please enable BitID two-factor authentication.</value>
</data>
</root>
+14 -2
View File
@@ -225,6 +225,10 @@ namespace Swarmops.Frontend.Automation
public string Phone { get; set; }
public string TwitterId { get; set; }
// Security tab
public bool TwoFactorActive { get; set; }
// Accounts tab
// (no data)
@@ -259,7 +263,8 @@ namespace Swarmops.Frontend.Automation
Name = person.Name,
Mail = person.Mail,
Phone = person.Phone,
TwitterId = person.TwitterId
TwitterId = person.TwitterId,
TwoFactorActive = !string.IsNullOrEmpty(person.BitIdAddress)
};
}
@@ -453,10 +458,17 @@ namespace Swarmops.Frontend.Automation
// TODO: NOTIFY
authData.CurrentUser.Quarantines.Withdrawal.QuarantineFor(new TimeSpan(2, 0, 0, 0)); // Quarantine for two days
string displayMessage = Resources.Global.Master_EditPersonNewPassword_Changed;
if (string.IsNullOrEmpty(authData.CurrentUser.BitIdAddress))
{
displayMessage += @"<br/><br/>" + Resources.Global.Master_EditPerson_PleaseEnable2FA;
}
return new AjaxCallResult
{
Success = true,
DisplayMessage = Resources.Global.Master_EditPersonNewPassword_Changed
DisplayMessage = displayMessage
};
}
}
+21 -3
View File
@@ -18,7 +18,8 @@
<script language="javascript" type="text/javascript" src="/Scripts/hoverIntent.min.js" ></script>
<script language="javascript" type="text/javascript" src="/Scripts/superfish.js" ></script>
<script language="javascript" type="text/javascript" src="/Scripts/jquery.json.min.js" ></script>
<script language="javascript" type="text/javascript" src="/Scripts/jquery.qrcode.min.js"></script>
<!-- fonts -->
<link href='https://fonts.googleapis.com/css?family=Permanent+Marker' rel='stylesheet' type='text/css' />
<link href='https://fonts.googleapis.com/css?family=Ubuntu:light,regular,500,bold' rel='stylesheet' type='text/css' />
@@ -249,7 +250,7 @@
<h2><span class="spanModalEditingPersonName">PERSONNAME</span>: <asp:Label runat="server" ID="MasterLabelEditPersonHeaderSecurity" Text="#Your Security#"/></h2>
<div class="entryFields">
<Swarmops5:AjaxTextBox ID="MasterEditPersonCurrentPassword" runat="server" Mode="Password" OnKeyDown="masterPersonEditorOnSecurityPasswordKeyDown" OnChanging="masterPersonEditorOnSecurityPasswordChanging" Cookie="CurrentPassword" AjaxCallbackUrl="" />&#8203;<br/>
<div class="divMasterPersonEditSecurityRolldown" style="display:none"><Swarmops5:AjaxToggleSlider ID="MasterEditPerson2FA" runat="server" OnChange="masterPersonEditorOnFieldChange" Cookie="2FA" AjaxCallbackUrl="" />&#8203;<br/>
<div class="divMasterPersonEditSecurityRolldown" style="display:none"><Swarmops5:AjaxToggleSlider ID="MasterEditPerson2FA" runat="server" OnChange="masterPersonEditor2FAToggle" Cookie="2FA" AjaxCallbackUrl="" />&#8203;<br/>
<Swarmops5:AjaxTextBox ID="MasterEditPersonNewPassword1" runat="server" Mode="Password" OnChanging="masterPersonEditorOnSecurityNewPasswordChanging" Cookie="Password1" AjaxCallbackUrl="" />&#8203;<br/>
<Swarmops5:AjaxTextBox ID="MasterEditPersonNewPassword2" runat="server" Mode="Password" OnChanging="masterPersonEditorOnSecurityNewPasswordChanging" Cookie="Password2" AjaxCallbackUrl="" />
</div>
@@ -357,6 +358,13 @@
</DialogCode>
</Swarmops5:ModalDialog>
<Swarmops5:ModalDialog ID="ModalMasterEnableBitId" runat="server">
<DialogCode>
<h2>Scan this code to enable BitId login</h2>
<div id="divBitIdEnable" style="height:400px"></div>
</DialogCode>
</Swarmops5:ModalDialog>
<script type="text/javascript" language="javascript">
// This JavaScript block is for the Master Modal Person Editor.
@@ -477,7 +485,8 @@
<%= this.MasterEditPersonPhone.ClientID %>_initialize(data.Phone);
<%= this.MasterEditPersonTwitterId.ClientID %>_initialize(data.TwitterId);
<%=this.MasterEditPerson2FAProvisioning.ClientID %>_initialize(true); // TODO: Based on data.2FA
<%= this.MasterEditPerson2FA.ClientID%>_initialize(data.TwoFactorActive);
<%= this.MasterEditPerson2FAProvisioning.ClientID %>_initialize(data.TwoFactorActive);
_master_PersonEditLoading = false;
@@ -503,6 +512,15 @@
}
function masterPersonEditor2FAToggle(newValue, fieldName, controlName) {
if (newValue) // this is a boolean, so "== true" is implicit
{
<%= this.ModalMasterEnableBitId.ClientID %>_open();
$('div.divBitIdEnable').qrcode({ text: "https://falkvinge.net/ " });
}
}
function masterPersonEditor2FAProvisionToggle(newValue, fieldName, controlName) {
if (newValue) { // it's a boolean, so "if true" meaning if the slider is "on"
// 2FA can't be provisioned true, only installed by the user
+9
View File
@@ -524,5 +524,14 @@ namespace Swarmops.Frontend {
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::Swarmops.Frontend.Controls.Base.AjaxTextBox MasterEditPersonLegacyBitcoinAddress;
/// <summary>
/// ModalMasterEnableBitId control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::Swarmops.Frontend.Controls.Base.ModalDialog ModalMasterEnableBitId;
}
}