diff --git a/Basic/Enums/ObjectOptionalDataType.cs b/Basic/Enums/ObjectOptionalDataType.cs index c50ab4d9..6ddc00ce 100644 --- a/Basic/Enums/ObjectOptionalDataType.cs +++ b/Basic/Enums/ObjectOptionalDataType.cs @@ -284,6 +284,11 @@ namespace Swarmops.Basic.Enums /// /// For a person, the BitId address they use to login /// - BitIdLoginAddress + BitIdLoginAddress, + + /// + /// For a person, the last logged-on organization id. Used to go back there on new login. + /// + LastLoginOrganizationId } } \ No newline at end of file diff --git a/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.Designer.cs b/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.Designer.cs index 27546213..b18cd4c8 100644 --- a/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.Designer.cs +++ b/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.Designer.cs @@ -111,7 +111,7 @@ namespace Swarmops.Logic.App_GlobalResources { } /// - /// Looks up a localized string similar to [OrganizationName] Cash Advance Paid: [CurrencyCode] [BudgetAmountFloat]. + /// Looks up a localized string similar to [[OrganizationName]] Cash Advance Paid: [CurrencyCode] [BudgetAmountFloat]. /// internal static string CashAdvance_PaidOut_Subject { get { @@ -131,7 +131,7 @@ namespace Swarmops.Logic.App_GlobalResources { } /// - /// Looks up a localized string similar to (ACTION ITEM) [OrganizationName] Cash Advance Requested: [CurrencyCode] [BudgetAmountFloat] - Attestation Needed. + /// Looks up a localized string similar to [[OrganizationName] - ACTION ITEM] Cash Advance Requested: [CurrencyCode] [BudgetAmountFloat] - Attestation Needed. /// internal static string CashAdvance_Requested_Subject { get { @@ -149,7 +149,7 @@ namespace Swarmops.Logic.App_GlobalResources { } /// - /// Looks up a localized string similar to [OrganizationName] Expense Claim Attested: [CurrencyCode] [BudgetAmountFloat]. + /// Looks up a localized string similar to [[OrganizationName]] Expense Claim Attested: [CurrencyCode] [BudgetAmountFloat]. /// internal static string ExpenseClaim_Attested_Subject { get { @@ -169,7 +169,7 @@ namespace Swarmops.Logic.App_GlobalResources { } /// - /// Looks up a localized string similar to (ACTION ITEM) [OrganizationName] Expense Claim Created: [CurrencyCode] [BudgetAmountFloat] - Attestation Needed. + /// Looks up a localized string similar to [[OrganizationName] - ACTION ITEM] Expense Claim Created: [CurrencyCode] [BudgetAmountFloat] - Attestation Needed. /// internal static string ExpenseClaim_Created_Subject { get { @@ -189,7 +189,7 @@ namespace Swarmops.Logic.App_GlobalResources { } /// - /// Looks up a localized string similar to [OrganizationName] Expense Claim DE-attested: [CurrencyCode] [BudgetAmountFloat]. + /// Looks up a localized string similar to [[OrganizationName]] Expense Claim DE-attested: [CurrencyCode] [BudgetAmountFloat]. /// internal static string ExpenseClaim_Deattested_Subject { get { @@ -207,7 +207,7 @@ namespace Swarmops.Logic.App_GlobalResources { } /// - /// Looks up a localized string similar to [OrganizationName] Expense Claim DENIED: [CurrencyCode] [BudgetAmountFloat]. + /// Looks up a localized string similar to [[OrganizationName]] Expense Claim DENIED: [CurrencyCode] [BudgetAmountFloat]. /// internal static string ExpenseClaim_Denied_Subject { get { @@ -227,7 +227,7 @@ namespace Swarmops.Logic.App_GlobalResources { } /// - /// Looks up a localized string similar to [OrganizationName] Expense Claim Receipts DE-validated: [CurrencyCode] [BudgetAmountFloat]. + /// Looks up a localized string similar to [[OrganizationName]] Expense Claim Receipts DE-validated: [CurrencyCode] [BudgetAmountFloat]. /// internal static string ExpenseClaim_Devalidated_Subject { get { @@ -247,7 +247,7 @@ namespace Swarmops.Logic.App_GlobalResources { } /// - /// Looks up a localized string similar to [OrganizationName] Expense Claim Paid: [CurrencyCode] [BudgetAmountFloat]. + /// Looks up a localized string similar to [[OrganizationName]] Expense Claim Paid: [CurrencyCode] [BudgetAmountFloat]. /// internal static string ExpenseClaim_PaidOut_Subject { get { @@ -267,7 +267,7 @@ namespace Swarmops.Logic.App_GlobalResources { } /// - /// Looks up a localized string similar to [OrganizationName] Expense Claim Receipts Validated: [CurrencyCode] [BudgetAmountFloat]. + /// Looks up a localized string similar to [[OrganizationName]] Expense Claim Receipts Validated: [CurrencyCode] [BudgetAmountFloat]. /// internal static string ExpenseClaim_Validated_Subject { get { @@ -287,7 +287,7 @@ namespace Swarmops.Logic.App_GlobalResources { } /// - /// Looks up a localized string similar to (ACTION ITEM) [OrganizationName] Invoice Filed: [CurrencyCode] [BudgetAmountFloat] - Attestation Needed. + /// Looks up a localized string similar to [[OrganizationName] - ACTION ITEM] Invoice Filed: [CurrencyCode] [BudgetAmountFloat] - Attestation Needed. /// internal static string InboundInvoice_Created_Subject { get { @@ -295,6 +295,89 @@ namespace Swarmops.Logic.App_GlobalResources { } } + /// + /// Looks up a localized string similar to A new [Regular] was manually added to [OrganizationName] within an area of yours.. + /// + internal static string Membership_New_Added_Body { + get { + return ResourceManager.GetString("Membership_New_Added_Body", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [[OrganizationName]] New [Regular]: [PersonName], [PersonGeography] [CountryCode] (manual). + /// + internal static string Membership_New_Added_Subject { + get { + return ResourceManager.GetString("Membership_New_Added_Subject", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to A new [Regular] has signed up for [OrganizationName] within an area of yours.. + /// + internal static string Membership_New_Selfsignup_Body { + get { + return ResourceManager.GetString("Membership_New_Selfsignup_Body", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [[OrganizationName]] New [Regular]: [PersonName], [PersonGeography] [CountryCode]. + /// + internal static string Membership_New_Selfsignup_Subject { + get { + return ResourceManager.GetString("Membership_New_Selfsignup_Subject", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [[OrganizationName]] [Regularship] renewed: [PersonName], [PersonGeography] [CountryCode] (manual). + /// + internal static string Membership_Renewed_Manual_Subject { + get { + return ResourceManager.GetString("Membership_Renewed_Manual_Subject", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Your message has been queued for delivery and the recipients have been resolved. Your mail will be sent to, or be attempted to sent to, [RecipientCount] people in [Geography] in [OrganizationName].. + /// + internal static string OutboundComm_Resolved_Body { + get { + return ResourceManager.GetString("OutboundComm_Resolved_Body", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [[OrganizationName]] Comm recipients determined for [GeographyName]: [RecipientCount]. + /// + internal static string OutboundComm_Resolved_Subject { + get { + return ResourceManager.GetString("OutboundComm_Resolved_Subject", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Your message to [GeographyName] has been sent to all scheduled recipients. Of the [RecipientCount] planned recipients, [RecipientsSuccess] succeeded from Swarmops' horizon. (These can fail later for a number of reasons, from broken computers to hospitalized recipients.) + /// + ///Time spent transmitting: [TransmissionTime].. + /// + internal static string OutboundComm_Sent_Body { + get { + return ResourceManager.GetString("OutboundComm_Sent_Body", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to [[OrganizationName]] Comms transmitted: [GeographyName]. + /// + internal static string OutboundComm_Sent_Subject { + get { + return ResourceManager.GetString("OutboundComm_Sent_Subject", resourceCulture); + } + } + /// /// Looks up a localized string similar to Receipts have been filed that need validation for their financial processes to continue. /// @@ -307,7 +390,7 @@ namespace Swarmops.Logic.App_GlobalResources { } /// - /// Looks up a localized string similar to (ACTION ITEM) [OrganizationName] Receipts Filed - Validation Needed. + /// Looks up a localized string similar to [[OrganizationName] - ACTION ITEM] Receipts Filed - Validation Needed. /// internal static string Receipts_Filed_Subject { get { diff --git a/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.resx b/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.resx index 81c75ad5..2a89b118 100644 --- a/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.resx +++ b/Logic/App_GlobalResources/Logic.Communications.Transmission.NotificationPayload.resx @@ -137,7 +137,7 @@ Expect more communication from the budget owner to follow on the matter. This means you should see the amount on your account shortly. - [OrganizationName] Cash Advance Paid: [CurrencyCode] [BudgetAmountFloat] + [[OrganizationName]] Cash Advance Paid: [CurrencyCode] [BudgetAmountFloat] [ConcernedPersonName] has requested a cash advance of [CurrencyCode] [BudgetAmountFloat] for the purpose of [RequestPurpose]. This money is part of your budget, [BudgetName]. @@ -146,14 +146,14 @@ Please log on to Swarmops at [SystemUrl] to attest or deny. This is sent to the budget owner(s) only. - (ACTION ITEM) [OrganizationName] Cash Advance Requested: [CurrencyCode] [BudgetAmountFloat] - Attestation Needed + [[OrganizationName] - ACTION ITEM] Cash Advance Requested: [CurrencyCode] [BudgetAmountFloat] - Attestation Needed Your expense claim with [OrganizationName] for [CurrencyCode] [BudgetAmountFloat], concerning [RequestPurpose], has been attested by the budget owner. It will be paid out to you when the receipts are confirmed valid. This is sent to the claimer. - [OrganizationName] Expense Claim Attested: [CurrencyCode] [BudgetAmountFloat] + [[OrganizationName]] Expense Claim Attested: [CurrencyCode] [BudgetAmountFloat] [ConcernedPersonName] has created an expense claim against the budget of [BudgetName] for the amount of [CurrencyCode] [BudgetAmountFloat]. The claim concerns [RequestPurpose]. You will need to attest this expense claim. @@ -162,7 +162,7 @@ Please log on to Swarmops at [SystemUrl] to attest or deny. This is sent to the budget owner(s)only. - (ACTION ITEM) [OrganizationName] Expense Claim Created: [CurrencyCode] [BudgetAmountFloat] - Attestation Needed + [[OrganizationName] - ACTION ITEM] Expense Claim Created: [CurrencyCode] [BudgetAmountFloat] - Attestation Needed ACTION ITEM should be translated. @@ -172,14 +172,14 @@ Expect more communication from the budget owner to follow on the matter. This is sent to the claimer. - [OrganizationName] Expense Claim DE-attested: [CurrencyCode] [BudgetAmountFloat] + [[OrganizationName]] Expense Claim DE-attested: [CurrencyCode] [BudgetAmountFloat] Your expense claim with [OrganizationName] for [CurrencyCode] [BudgetAmountFloat] concerning [RequestPurpose] has been denied. Expect more communications to follow on what you need to do to file a proper expense claim. This is sent to the claimer. - [OrganizationName] Expense Claim DENIED: [CurrencyCode] [BudgetAmountFloat] + [[OrganizationName]] Expense Claim DENIED: [CurrencyCode] [BudgetAmountFloat] The receipts for your expense claim with [OrganizationName] for [CurrencyCode] [BudgetAmountFloat], concerning [RequestPurpose], have been DE-validated by the financial record keepers of the organization. This usually indicates some sort of problem with the documentation of your expense claim. @@ -187,7 +187,7 @@ Expect more communication from the budget owner to follow on the matter. Expect more communication to follow on the matter. If you don't hear from record keepers in short time on this matter, do follow up with them. - [OrganizationName] Expense Claim Receipts DE-validated: [CurrencyCode] [BudgetAmountFloat] + [[OrganizationName]] Expense Claim Receipts DE-validated: [CurrencyCode] [BudgetAmountFloat] Your expense claim with [OrganizationName] for [CurrencyCode] [BudgetAmountFloat], concerning [RequestPurpose], has been marked as paid out by the organization's accountants. @@ -195,7 +195,7 @@ Expect more communication to follow on the matter. If you don't hear from record This means you should see the amount on your account shortly. - [OrganizationName] Expense Claim Paid: [CurrencyCode] [BudgetAmountFloat] + [[OrganizationName]] Expense Claim Paid: [CurrencyCode] [BudgetAmountFloat] The receipts for your expense claim with [OrganizationName] for [CurrencyCode] [BudgetAmountFloat], concerning [RequestPurpose], have been validated by people responsible for keeping the records in order. @@ -204,7 +204,7 @@ The claim will be paid out to you when the amount has also been attested by the This is sent to the claimer. - [OrganizationName] Expense Claim Receipts Validated: [CurrencyCode] [BudgetAmountFloat] + [[OrganizationName]] Expense Claim Receipts Validated: [CurrencyCode] [BudgetAmountFloat] An invoice from [Supplier], concerning [Description], has been filed against your budget of [BudgetName] for the amount of [CurrencyCode] [BudgetAmountFloat]. You must attest this invoice before it proceeds to payout. @@ -212,7 +212,36 @@ The claim will be paid out to you when the amount has also been attested by the Please log on to Swarmops at [SystemUrl] to attest or deny. - (ACTION ITEM) [OrganizationName] Invoice Filed: [CurrencyCode] [BudgetAmountFloat] - Attestation Needed + [[OrganizationName] - ACTION ITEM] Invoice Filed: [CurrencyCode] [BudgetAmountFloat] - Attestation Needed + + + A new [Regular] was manually added to [OrganizationName] within an area of yours. + + + [[OrganizationName]] New [Regular]: [PersonName], [PersonGeography] [CountryCode] (manual) + + + A new [Regular] has signed up for [OrganizationName] within an area of yours. + + + [[OrganizationName]] New [Regular]: [PersonName], [PersonGeography] [CountryCode] + + + [[OrganizationName]] [Regularship] renewed: [PersonName], [PersonGeography] [CountryCode] (manual) + + + Your message has been queued for delivery and the recipients have been resolved. Your mail will be sent to, or be attempted to sent to, [RecipientCount] people in [Geography] in [OrganizationName]. + + + [[OrganizationName]] Comm recipients determined for [GeographyName]: [RecipientCount] + + + Your message to [GeographyName] has been sent to all scheduled recipients. Of the [RecipientCount] planned recipients, [RecipientsSuccess] succeeded from Swarmops' horizon. (These can fail later for a number of reasons, from broken computers to hospitalized recipients.) + +Time spent transmitting: [TransmissionTime]. + + + [[OrganizationName]] Comms transmitted: [GeographyName] Receipts have been filed that need validation for their financial processes to continue. @@ -220,7 +249,7 @@ Please log on to Swarmops at [SystemUrl] to attest or deny. Please log on to Swarmops at [SystemUrl] to confirm or reject them. - (ACTION ITEM) [OrganizationName] Receipts Filed - Validation Needed + [[OrganizationName] - ACTION ITEM] Receipts Filed - Validation Needed Swarmops Backend [SwarmopsVersion] on host [HostName] has successfully upgraded the Swarmops database schema to revision [DbVersion]. diff --git a/Logic/Swarm/Person.cs b/Logic/Swarm/Person.cs index f36a934b..df2a9bd5 100644 --- a/Logic/Swarm/Person.cs +++ b/Logic/Swarm/Person.cs @@ -430,6 +430,12 @@ namespace Swarmops.Logic.Swarm } } + public int LastLogonOrganizationId + { + get { return OptionalData.GetOptionalDataInt (ObjectOptionalDataType.LastLoginOrganizationId); } + set { OptionalData.SetOptionalDataInt (ObjectOptionalDataType.LastLoginOrganizationId, value); } + } + public string PortraitPhotographer { get { return OptionalData.GetOptionalDataString (ObjectOptionalDataType.PortraitPhotographer); } diff --git a/Site5/Pages/v5/Init/Default.aspx b/Site5/Pages/v5/Init/Default.aspx index c9f9e31a..837535e6 100644 --- a/Site5/Pages/v5/Init/Default.aspx +++ b/Site5/Pages/v5/Init/Default.aspx @@ -486,7 +486,7 @@
-

+
diff --git a/Site5/Pages/v5/Security/SetCurrentOrganization.aspx.cs b/Site5/Pages/v5/Security/SetCurrentOrganization.aspx.cs index 52911dcc..dccd0aa7 100644 --- a/Site5/Pages/v5/Security/SetCurrentOrganization.aspx.cs +++ b/Site5/Pages/v5/Security/SetCurrentOrganization.aspx.cs @@ -48,6 +48,8 @@ namespace Swarmops.Frontend.Pages.v5.Security suggestedOrganization.Identity.ToString (CultureInfo.InvariantCulture) + ",," + logonFlags; + CurrentUser.LastLogonOrganizationId = suggestedOrganization.Identity; + if (!string.IsNullOrEmpty (returnUrlString)) { FormsAuthentication.SetAuthCookie (userIdentityString, true); diff --git a/Site5/Security/Login.aspx b/Site5/Security/Login.aspx index c4890c07..08dbccf1 100644 --- a/Site5/Security/Login.aspx +++ b/Site5/Security/Login.aspx @@ -83,13 +83,15 @@ contentType: "application/json; charset=utf-8", dataType: "json", success: function(msg) { - if (msg.d) { - // alert(""); // Modal on Chrome, so need a shaded div instead + if (msg.d == "Success") { + // Good credentials. TODO: Add manual 2FA challenge if applicable. $('#TextLogin, #TextPass').css('background-image', "url('/Security/Images/iconshock-greentick-16px.png')").css('background-position', 'right center').css('background-repeat', 'no-repeat'); - } else { - // inform user of bad credentials by means of a red cross on _both_ boxes - $('#TextLogin, #TextPass').css('background-image', "url('/Security/Images/iconshock-cross-12px.png')").css('background-position', 'right center').css('background-repeat', 'no-repeat'); - } + } else if (msg.d == "Fail") { + // inform user of bad credentials by means of a red cross on _both_ boxes + $('#TextLogin, #TextPass').css('background-image', "url('/Security/Images/iconshock-cross-12px.png')").css('background-position', 'right center').css('background-repeat', 'no-repeat'); + } else { + // wut? + } }, error: function(msg) { // retry after a second diff --git a/Site5/Security/Login.aspx.cs b/Site5/Security/Login.aspx.cs index 660ba560..1cd811d1 100644 --- a/Site5/Security/Login.aspx.cs +++ b/Site5/Security/Login.aspx.cs @@ -12,6 +12,7 @@ using Resources; using Swarmops.Database; using Swarmops.Logic.Cache; using Swarmops.Logic.Security; +using Swarmops.Logic.Structure; using Swarmops.Logic.Support; using Swarmops.Logic.Swarm; @@ -234,7 +235,7 @@ namespace Swarmops.Pages.Security [WebMethod] // ReSharper disable once InconsistentNaming - public static bool TestCredentials (string credentialsLogin, string credentialsPass, string credentials2FA, + public static string TestCredentials (string credentialsLogin, string credentialsPass, string credentials2FA, string logonUriEncoded) { if (!string.IsNullOrEmpty (credentialsLogin.Trim()) && !string.IsNullOrEmpty (credentialsPass.Trim())) @@ -248,17 +249,32 @@ namespace Swarmops.Pages.Security // TODO: Determine last logged-on organization. Right now, log on to Sandbox. + int lastOrgId = authenticatedPerson.LastLogonOrganizationId; + + if (lastOrgId == 0) + { + lastOrgId = Organization.SandboxIdentity; + } + + if (!authenticatedPerson.MemberOfWithInherited (lastOrgId)) + { + // If the person doesn't have access to the last organization (anymore), log on to Sandbox + + lastOrgId = 1; + } + GuidCache.Set (logonUri + "-LoggedOn", - authenticatedPerson.Identity.ToString (CultureInfo.InvariantCulture) + ",1,,AuthPlain"); - return true; + authenticatedPerson.Identity.ToString (CultureInfo.InvariantCulture) + "," + lastOrgId.ToString(CultureInfo.InvariantCulture) + ",,AuthPlain"); + + return "Success"; // Prepare here for "2FARequired" return code } catch (UnauthorizedAccessException) { - return false; + return "Fail"; } } - return false; + return "Fail"; } @@ -281,7 +297,6 @@ namespace Swarmops.Pages.Security this.LiteralCredentialsUser.Text = Resources.Pages.Security.Login_Username; this.LiteralCredentialsPass.Text = Resources.Pages.Security.Login_Password; this.LiteralCredentials2FA.Text = Resources.Pages.Security.Login_GoogleAuthenticatorCode; - this.LiteralLoginSuccess.Text = Resources.Pages.Security.Login_LoggingIn; } diff --git a/Site5/Style/style-v5.css b/Site5/Style/style-v5.css index 30fa9d6b..d11aa10d 100644 --- a/Site5/Style/style-v5.css +++ b/Site5/Style/style-v5.css @@ -358,6 +358,12 @@ div.loginbox background-color: #E4ECFF; } + +input.InputManualCredentials { + border: solid 1px #A2BEFF; + padding: 2px; +} + span.loginalphabetasign { font-size: 24px;