From 978dfd6fa8729ea7d25aa8d83c2454014d85fa77 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Sun, 13 Mar 2016 11:41:51 +0100 Subject: [PATCH] Rename CreateRandomPassword to CreateWeakSecret, to underscore it's nowhere near random --- Logic/Communications/Payload/ParticipantMailPayload.cs | 2 +- Logic/Financial/OutboundInvoice.cs | 2 +- Logic/Governance/MeetingElectionVote.cs | 2 +- Logic/Security/Authentication.cs | 6 +++--- Logic/Support/Formatting.cs | 2 +- Logic/Swarm/PaymentCode.cs | 2 +- Site5/Pages/v5/Public/Initialize.aspx.cs | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Logic/Communications/Payload/ParticipantMailPayload.cs b/Logic/Communications/Payload/ParticipantMailPayload.cs index a9dd088d..b7b66243 100644 --- a/Logic/Communications/Payload/ParticipantMailPayload.cs +++ b/Logic/Communications/Payload/ParticipantMailPayload.cs @@ -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); } diff --git a/Logic/Financial/OutboundInvoice.cs b/Logic/Financial/OutboundInvoice.cs index 06960354..ee39b092 100644 --- a/Logic/Financial/OutboundInvoice.cs +++ b/Logic/Financial/OutboundInvoice.cs @@ -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 diff --git a/Logic/Governance/MeetingElectionVote.cs b/Logic/Governance/MeetingElectionVote.cs index dd8e3dad..3248a3c4 100644 --- a/Logic/Governance/MeetingElectionVote.cs +++ b/Logic/Governance/MeetingElectionVote.cs @@ -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) diff --git a/Logic/Security/Authentication.cs b/Logic/Security/Authentication.cs index b49070c3..309e5151 100644 --- a/Logic/Security/Authentication.cs +++ b/Logic/Security/Authentication.cs @@ -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"); diff --git a/Logic/Support/Formatting.cs b/Logic/Support/Formatting.cs index bf27966c..8872993d 100644 --- a/Logic/Support/Formatting.cs +++ b/Logic/Support/Formatting.cs @@ -80,7 +80,7 @@ namespace Swarmops.Logic.Support public static string GeneratePassword (int length) { - return Authentication.CreateRandomPassword (length); + return Authentication.CreateWeakSecret (length); } diff --git a/Logic/Swarm/PaymentCode.cs b/Logic/Swarm/PaymentCode.cs index 462ca924..338bd7cb 100644 --- a/Logic/Swarm/PaymentCode.cs +++ b/Logic/Swarm/PaymentCode.cs @@ -78,7 +78,7 @@ namespace Swarmops.Logic.Swarm private static string CreateRandomCode (int length) { - return Authentication.CreateRandomPassword (length); + return Authentication.CreateWeakSecret (length); } } } \ No newline at end of file diff --git a/Site5/Pages/v5/Public/Initialize.aspx.cs b/Site5/Pages/v5/Public/Initialize.aspx.cs index a32579a4..1d037729 100644 --- a/Site5/Pages/v5/Public/Initialize.aspx.cs +++ b/Site5/Pages/v5/Public/Initialize.aspx.cs @@ -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",