Checkpoint commit: security settings
This commit is contained in:
@@ -118,7 +118,7 @@ namespace Swarmops.Logic.Security
|
||||
|
||||
public static string CreateWeakSecret (int length)
|
||||
{
|
||||
string allowedChars = "ABCDEFHJKMNPQRTUVWXYZ23456789";
|
||||
string allowedChars = "abcdefhjkmnpqrtuvwxyz23456789";
|
||||
char[] chars = new char[length];
|
||||
Random randomizer = new Random();
|
||||
|
||||
@@ -417,15 +417,15 @@ namespace Swarmops.Logic.Security
|
||||
pers.ResetPasswordTicket = "";
|
||||
}
|
||||
|
||||
internal static bool ValidatePassword (Person person, string oldpassword)
|
||||
internal static bool ValidatePassword (Person person, string password)
|
||||
{
|
||||
if (CheckPassword (person, oldpassword))
|
||||
if (CheckPassword (person, password))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// If the most recent password hash mechanism fails, try legacy hashes
|
||||
|
||||
string[] legacyHashes = GenerateLegacyPasswordHashes (person, oldpassword);
|
||||
string[] legacyHashes = GenerateLegacyPasswordHashes (person, password);
|
||||
|
||||
foreach (string legacyHash in legacyHashes)
|
||||
{
|
||||
|
||||
@@ -1023,9 +1023,9 @@ namespace Swarmops.Logic.Swarm
|
||||
return newAddress;
|
||||
}
|
||||
|
||||
public bool ValidatePassword (string oldpassword)
|
||||
public bool ValidatePassword (string password)
|
||||
{
|
||||
return Authentication.ValidatePassword (this, oldpassword);
|
||||
return Authentication.ValidatePassword (this, password);
|
||||
}
|
||||
|
||||
public string HexIdentifier()
|
||||
|
||||
@@ -391,5 +391,19 @@ namespace Swarmops.Frontend.Automation
|
||||
}
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public static bool ValidatePassword(int personId, string password)
|
||||
{
|
||||
AuthenticationData authData = GetAuthenticationDataAndCulture();
|
||||
|
||||
// We can only verify password for personId zero (the self)
|
||||
|
||||
if (personId != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return authData.CurrentUser.ValidatePassword(password);
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
-8
@@ -368,17 +368,23 @@
|
||||
|
||||
function masterPersonEditorOnSecurityPasswordChanging(newValue, cookie, controlName) {
|
||||
|
||||
if (newValue == "foobar") {
|
||||
if (!_master_PersonEditor_SecurityShowing) {
|
||||
if (_master_PersonEditor_SecurityShowing) {
|
||||
$('div.divMasterPersonEditSecurityRolldown').slideUp();
|
||||
_master_PersonEditor_SecurityShowing = false;
|
||||
}
|
||||
|
||||
var jsonData =
|
||||
{
|
||||
personId: _master_PersonEditedId,
|
||||
password: newValue
|
||||
}
|
||||
|
||||
SwarmopsJS.ajaxCall("/Automation/SwarmFunctions.aspx/ValidatePassword", jsonData, function(result) {
|
||||
if (result.d) {
|
||||
$('div.divMasterPersonEditSecurityRolldown').slideDown();
|
||||
_master_PersonEditor_SecurityShowing = true;
|
||||
}
|
||||
} else {
|
||||
if (_master_PersonEditor_SecurityShowing) {
|
||||
$('div.divMasterPersonEditSecurityRolldown').slideUp();
|
||||
_master_PersonEditor_SecurityShowing = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function masterBeginEditPerson(personId) {
|
||||
|
||||
Reference in New Issue
Block a user