Rename CreateRandomPassword to CreateWeakSecret, to underscore it's nowhere near random

This commit is contained in:
Rick Falkvinge
2016-03-13 11:41:51 +01:00
parent 6f0dca0089
commit 978dfd6fa8
7 changed files with 10 additions and 10 deletions
@@ -74,7 +74,7 @@ namespace Swarmops.Logic.Communications.Payload
if (body.Contains ("[RandomPassword]"))
{
string randomPassword = Authentication.CreateRandomPassword (24);
string randomPassword = Authentication.CreateWeakSecret (24);
person.SetPassword (randomPassword);
body = body.Replace ("[RandomPassword]", randomPassword);
}
+1 -1
View File
@@ -239,7 +239,7 @@ namespace Swarmops.Logic.Financial
dueDate,
budget.Identity, customerName, invoiceAddressPaper,
invoiceAddressMail, currency.Identity, string.Empty, domestic,
Authentication.CreateRandomPassword (6), theirReference));
Authentication.CreateWeakSecret (6), theirReference));
// Set reference
+1 -1
View File
@@ -39,7 +39,7 @@ namespace Swarmops.Logic.Governance
FromIdentity (SwarmDb.GetDatabaseForWriting()
.CreateInternalPollVote (poll.Identity, voteGeography.Identity,
Authentication.
CreateRandomPassword (12)));
CreateWeakSecret (12)));
}
public void AddDetail (int position, MeetingElectionCandidate candidate)
+3 -3
View File
@@ -116,7 +116,7 @@ namespace Swarmops.Logic.Security
}
public static string CreateRandomPassword (int length)
public static string CreateWeakSecret (int length)
{
string allowedChars = "ABCDEFHJKMNPQRTUVWXYZ23456789";
char[] chars = new char[length];
@@ -295,7 +295,7 @@ namespace Swarmops.Logic.Security
return null;
}
string passwordTicket = CreateRandomPassword (EmailVerificationTicketLength);
string passwordTicket = CreateWeakSecret (EmailVerificationTicketLength);
foreach (Person p in candidatePeople)
{
@@ -359,7 +359,7 @@ namespace Swarmops.Logic.Security
public static void RequestMembershipConfirmation (Person p, string URL)
{
string passwordTicket = CreateRandomPassword (EmailVerificationTicketLength);
string passwordTicket = CreateWeakSecret (EmailVerificationTicketLength);
string encodedPasswordTicket = SHA1.Hash (passwordTicket);
p.ResetPasswordTicket = encodedPasswordTicket + ";" + DateTime.Now.ToString ("yyyy-MM-dd HH:mm:ss");
+1 -1
View File
@@ -80,7 +80,7 @@ namespace Swarmops.Logic.Support
public static string GeneratePassword (int length)
{
return Authentication.CreateRandomPassword (length);
return Authentication.CreateWeakSecret (length);
}
+1 -1
View File
@@ -78,7 +78,7 @@ namespace Swarmops.Logic.Swarm
private static string CreateRandomCode (int length)
{
return Authentication.CreateRandomPassword (length);
return Authentication.CreateWeakSecret (length);
}
}
}
+2 -2
View File
@@ -69,7 +69,7 @@ namespace Swarmops.Frontend.Pages.v5.Public
// this.LanguageSelector.LanguageChanged += new EventHandler(LanguageSelector_LanguageChanged);
this.TextRandomDbLabel.Text = Authentication.CreateRandomPassword (5);
this.TextRandomDbLabel.Text = Authentication.CreateWeakSecret (5);
Localize();
}
@@ -122,7 +122,7 @@ namespace Swarmops.Frontend.Pages.v5.Public
if (string.IsNullOrEmpty (random))
{
random = Authentication.CreateRandomPassword (5);
random = Authentication.CreateWeakSecret (5);
}
SwarmDb.Credentials rootCredentials = new SwarmDb.Credentials ("mysql",