Lots of work on Security UI
This commit is contained in:
+36
@@ -690,6 +690,33 @@ namespace Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Two-factor authentication.
|
||||
/// </summary>
|
||||
internal static string Global_2FA {
|
||||
get {
|
||||
return ResourceManager.GetString("Global_2FA", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Two-factor auth.
|
||||
/// </summary>
|
||||
internal static string Global_2FA_Short {
|
||||
get {
|
||||
return ResourceManager.GetString("Global_2FA_Short", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 2FA.
|
||||
/// </summary>
|
||||
internal static string Global_2FA_Shorter {
|
||||
get {
|
||||
return ResourceManager.GetString("Global_2FA_Shorter", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Action.
|
||||
/// </summary>
|
||||
@@ -1500,6 +1527,15 @@ namespace Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Two-factor authentication was not removed and is still active..
|
||||
/// </summary>
|
||||
internal static string Master_EditPerson2FAEnable_NotRemoved {
|
||||
get {
|
||||
return ResourceManager.GetString("Master_EditPerson2FAEnable_NotRemoved", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Account.
|
||||
/// </summary>
|
||||
|
||||
@@ -774,6 +774,15 @@
|
||||
<data name="Master_EditPersonResetPassword_ResetLinkSent" xml:space="preserve">
|
||||
<value>A password reset link was sent to this user.</value>
|
||||
</data>
|
||||
<data name="Global_2FA" xml:space="preserve">
|
||||
<value>Two-factor authentication</value>
|
||||
</data>
|
||||
<data name="Global_2FA_Short" xml:space="preserve">
|
||||
<value>Two-factor auth</value>
|
||||
</data>
|
||||
<data name="Global_2FA_Shorter" xml:space="preserve">
|
||||
<value>2FA</value>
|
||||
</data>
|
||||
<data name="Master_EditPerson2FAEnable_CannotProvision" xml:space="preserve">
|
||||
<value><strong>CANNOT PROVISION 2FA</strong><br/><br/>You cannot turn on two-factor authentication for someone else. They must do it by themselves, thereby being alone in having their secret keys.</value>
|
||||
<comment>Displayed when somebody tries to turn on 2FA for someone else.</comment>
|
||||
@@ -792,6 +801,9 @@
|
||||
<value><strong>REMOVE TWO-FACTOR AUTHENTICATION?</strong><br/><br/>Only do this if you have been requested to turn off 2FA for this user, by this user themselves, <strong>and</strong> you are absolutely, positively sure that the request came from the person whose security you are disabling (as per the verification policy of the organization).<br/><br/>Proceed with removing this user's security? They will fall back to password-only security.</value>
|
||||
<comment>Displayed when removing 2FA for someone else</comment>
|
||||
</data>
|
||||
<data name="Master_EditPerson2FAEnable_NotRemoved" xml:space="preserve">
|
||||
<value>Two-factor authentication was not removed and is still active.</value>
|
||||
</data>
|
||||
<data name="Timespan_Selection_OneDay" xml:space="preserve">
|
||||
<value>One day</value>
|
||||
</data>
|
||||
|
||||
@@ -7,7 +7,18 @@
|
||||
var _initVal_<%=this.TextInput.ClientID%> = $('#<%=this.TextInput.ClientID%>').val();
|
||||
|
||||
$(document).ready(function () {
|
||||
$('#<%=this.TextInput.ClientID%>').keydown(function (e) {
|
||||
// reset timer if set
|
||||
if (<%=this.ClientID%>_onChangingTimer != null) {
|
||||
clearTimeout(<%=this.ClientID%>_onChangingTimer);
|
||||
<%=this.ClientID%>_onChangingTimer = setTimeout(function() { <%=this.ClientID%>_fireOnChanging(); }, 500);
|
||||
} else {
|
||||
// otherwise set new timer with a more generous timeout on keydown in general
|
||||
<%=this.ClientID%>_onChangingTimer = setTimeout(function () { <%=this.ClientID%>_fireOnChanging(); }, 500);
|
||||
}
|
||||
});
|
||||
|
||||
// OnChange event, AjaxCallback event
|
||||
$('#<%=this.TextInput.ClientID%>').blur(function() {
|
||||
|
||||
var currentValue = $('#<%=this.TextInput.ClientID%>').val();
|
||||
@@ -82,6 +93,21 @@
|
||||
|
||||
});
|
||||
|
||||
function <%=this.ClientID%>_fireOnChanging() {
|
||||
<%=this.ClientID%>_onChangingTimer = null;
|
||||
|
||||
alertify.log("FireOnChanging");
|
||||
|
||||
<%
|
||||
if (string.IsNullOrEmpty(this.OnChanging))
|
||||
{
|
||||
Response.Write(this.OnChanging + "(" + this.TextInput.ClientID + ".val(), '" + this.Cookie + "', '" + this.ClientID + "');"); // cookie may be empty and that's ok
|
||||
}
|
||||
%>
|
||||
}
|
||||
|
||||
var <%=this.ClientID%>_onChangingTimer = null;
|
||||
|
||||
function <%=this.ClientID%>_updateSuccessAnimate(newValue) {
|
||||
$('#<%=this.TextInput.ClientID%>').css('background-color', '#E0FFE0');
|
||||
$('#<%=this.TextInput.ClientID%>').animate({ backgroundColor: "#FFFFFF" }, 500);
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace Swarmops.Frontend.Controls.Base
|
||||
|
||||
public string Cookie { set; get; }
|
||||
public string OnChange { get; set; }
|
||||
public string OnChanging { get; set; }
|
||||
public string AjaxCallbackUrl { set; get; }
|
||||
|
||||
public string CssClass
|
||||
|
||||
+54
-11
@@ -245,16 +245,22 @@
|
||||
<asp:Label runat="server" ID="MasterLabelEditPersonTwitter" /><br/>
|
||||
</div>
|
||||
</div>
|
||||
<!--<div title="<img src='/Images/Icons/iconshock-lock-256px.png' height='64' width='64' />">
|
||||
<h2><span class="spanModalEditingPersonName">PERSONNAME</span>: Security (your own)</h2>
|
||||
<div class="entryFields">...</div>
|
||||
<div class="entryLabels">
|
||||
New Password<br/>
|
||||
New Password Again<br/>
|
||||
Enable BitId (bitcoin signature login)<br/>
|
||||
Enter current password to save
|
||||
<div title="<img src='/Images/Icons/iconshock-lock-256px.png' height='64' width='64' />">
|
||||
<h2><span class="spanModalEditingPersonName">PERSONNAME</span>: <asp:Label runat="server" ID="MasterLabelEditPersonHeaderSecurity" Text="#Security#"/></h2>
|
||||
<div class="entryFields">
|
||||
<Swarmops5:AjaxTextBox ID="MasterEditPersonCurrentPassword" runat="server" OnChanging="masterPersonEditorOnSecurityPasswordChanging" Cookie="CurrentPassword" AjaxCallbackUrl="" />​<br/>
|
||||
<div class="divMasterPersonEditSecurityRolldown" style="display:none"><Swarmops5:AjaxToggleSlider ID="MasterEditPerson2FA" runat="server" OnChange="masterPersonEditorOnFieldChange" Cookie="2FA" AjaxCallbackUrl="" />​<br/>
|
||||
<Swarmops5:AjaxTextBox ID="MasterEditPersonNewPassword1" runat="server" OnChange="masterPersonEditorOnFieldChange" Cookie="Phone" AjaxCallbackUrl="" />​<br/>
|
||||
<Swarmops5:AjaxTextBox ID="MasterEditPersonNewPassword2" runat="server" OnChange="masterPersonEditorOnFieldChange" Cookie="TwitterId" AjaxCallbackUrl="" />
|
||||
</div>
|
||||
</div>
|
||||
</div>-->
|
||||
<div class="entryLabels">
|
||||
Type current password to enable changes<br/>
|
||||
<div class="divMasterPersonEditSecurityRolldown" style="display:none">Enable BitId (bitcoin signature login)<br/>
|
||||
Set new password<br/>
|
||||
Retype new password</div>
|
||||
</div>
|
||||
</div>
|
||||
<div title="<img src='/Images/Icons/iconshock-lock-256px.png' height='64' width='64' />">
|
||||
<h2><span class="spanModalEditingPersonName">PERSONNAME</span>: <asp:Label ID="MasterLabelEditPersonHeaderSecurityProvisioning" runat="server" /></h2>
|
||||
<div class="entryFields">
|
||||
@@ -355,6 +361,9 @@
|
||||
|
||||
// This JavaScript block is for the Master Modal Person Editor.
|
||||
|
||||
$(document).ready(function() {
|
||||
});
|
||||
|
||||
function masterBeginEditPerson(personId) {
|
||||
_master_PersonEditedId = personId;
|
||||
|
||||
@@ -369,6 +378,8 @@
|
||||
|
||||
$('span.spanModalEditingPersonName').text(SwarmopsJS.unescape('<%= this.Localized_LoadingPlaceholderShort %>'));
|
||||
|
||||
$('div.divMasterPersonEditSecurityRolldown').hide();
|
||||
|
||||
// Open the Modal
|
||||
<%=this.ModalMasterEditPerson.ClientID%>_open();
|
||||
|
||||
@@ -391,6 +402,8 @@
|
||||
<%= this.MasterEditPersonPhone.ClientID %>_initialize(data.Phone);
|
||||
<%= this.MasterEditPersonTwitterId.ClientID %>_initialize(data.TwitterId);
|
||||
|
||||
<%=this.MasterEditPerson2FAProvisioning.ClientID %>_initialize(true); // TODO: Based on data.2FA
|
||||
|
||||
_master_PersonEditLoading = false;
|
||||
|
||||
} else {
|
||||
@@ -422,10 +435,40 @@
|
||||
<%= this.MasterEditPerson2FAProvisioning.ClientID %>_initialize(false);
|
||||
alertify.alert(SwarmopsJS.unescape('<%=this.Localized_MasterPersonEdit_CannotProvision2FA%>'));
|
||||
} else {
|
||||
// We're turning 2FA _OFF_ for someone else - are we really sure we want to do this?
|
||||
alertify.confirm(SwarmopsJS.unescape('<%=this.Localized_MasterPersonEdit_ConfirmRemove2FAProvision%>'),
|
||||
function (response) {
|
||||
if (response) {
|
||||
alert("Success!");
|
||||
} else {
|
||||
<%= this.MasterEditPerson2FAProvisioning.ClientID %>_initialize(true);
|
||||
alertify.log(SwarmopsJS.unescape('<%=this.Localized_MasterPersonEdit_Cancelled2FARemoval%>'));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function masterPersonEditor2FAToggle(newValue, fieldName, controlName) {
|
||||
if (newValue) { // it's a boolean, so "if true" meaning if the slider is "on"
|
||||
// The user is requesting to enable 2FA. For now, we only use BitId.
|
||||
|
||||
<%= this.MasterEditPerson2FAProvisioning.ClientID %>_initialize(false);
|
||||
alertify.alert(SwarmopsJS.unescape('<%=this.Localized_MasterPersonEdit_CannotProvision2FA%>'));
|
||||
} else {
|
||||
// The user is requesting their 2FA be removed
|
||||
alertify.confirm(SwarmopsJS.unescape('<%=this.Localized_MasterPersonEdit_ConfirmRemove2FAOwn%>'),
|
||||
function (response) {
|
||||
if (response) {
|
||||
// TODO: Enter password as a security measure (or check against entered)
|
||||
alert("Success!");
|
||||
} else {
|
||||
<%= this.MasterEditPerson2FAProvisioning.ClientID %>_initialize(true);
|
||||
alertify.log(SwarmopsJS.unescape('<%=this.Localized_MasterPersonEdit_Cancelled2FARemoval%>'));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function masterPersonEditorOnFieldChange(newValue, fieldName, controlName) {
|
||||
// Do the AJAX call from here, as we need to also pass along the person ID of the person edited
|
||||
@@ -490,7 +533,7 @@
|
||||
if (response) {
|
||||
alert("Success!");
|
||||
} else {
|
||||
alert("Cancel");
|
||||
// Possibly notify user in small log format that cancellation is acknowledged
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -478,5 +478,10 @@ namespace Swarmops.Frontend
|
||||
{
|
||||
get { return CommonV5.JavascriptEscape(Resources.Global.Master_EditPerson2FAEnable_ConfirmRemoveOwn); }
|
||||
}
|
||||
|
||||
public string Localized_MasterPersonEdit_Cancelled2FARemoval
|
||||
{
|
||||
get { return CommonV5.JavascriptEscape(Resources.Global.Master_EditPerson2FAEnable_NotRemoved); }
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+45
@@ -363,6 +363,51 @@ namespace Swarmops.Frontend {
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label MasterLabelEditPersonTwitter;
|
||||
|
||||
/// <summary>
|
||||
/// MasterLabelEditPersonHeaderSecurity control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label MasterLabelEditPersonHeaderSecurity;
|
||||
|
||||
/// <summary>
|
||||
/// MasterEditPersonCurrentPassword 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.AjaxTextBox MasterEditPersonCurrentPassword;
|
||||
|
||||
/// <summary>
|
||||
/// MasterEditPerson2FA 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.AjaxToggleSlider MasterEditPerson2FA;
|
||||
|
||||
/// <summary>
|
||||
/// MasterEditPersonNewPassword1 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.AjaxTextBox MasterEditPersonNewPassword1;
|
||||
|
||||
/// <summary>
|
||||
/// MasterEditPersonNewPassword2 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.AjaxTextBox MasterEditPersonNewPassword2;
|
||||
|
||||
/// <summary>
|
||||
/// MasterLabelEditPersonHeaderSecurityProvisioning control.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user