public void UserInfoAddedAfterInvite(UserInfo newUserInfo) { if (!CoreContext.UserManager.UserExists(newUserInfo.ID)) { return; } INotifyAction notifyAction; var footer = "social"; if (CoreContext.Configuration.Personal) { if (CoreContext.Configuration.CustomMode) { notifyAction = Actions.PersonalCustomModeAfterRegistration1; footer = "personalCustomMode"; } else { notifyAction = Actions.PersonalAfterRegistration1; footer = "personal"; } } else if (TenantExtra.Enterprise) { var defaultRebranding = MailWhiteLabelSettings.Instance.IsDefault; notifyAction = defaultRebranding ? Actions.EnterpriseUserWelcomeV10 : CoreContext.Configuration.CustomMode ? Actions.EnterpriseWhitelabelUserWelcomeCustomMode : Actions.EnterpriseWhitelabelUserWelcomeV10; footer = null; } else if (TenantExtra.Opensource) { notifyAction = Actions.OpensourceUserWelcomeV11; footer = "opensource"; } else { notifyAction = Actions.SaasUserWelcomeV115; } Func <string> greenButtonText = () => TenantExtra.Enterprise ? WebstudioNotifyPatternResource.ButtonAccessYourPortal : WebstudioNotifyPatternResource.ButtonAccessYouWebOffice; client.SendNoticeToAsync( notifyAction, null, StudioNotifyHelper.RecipientFromEmail(newUserInfo.Email, false), new[] { EMailSenderName }, null, new TagValue(Tags.UserName, newUserInfo.FirstName.HtmlEncode()), new TagValue(Tags.MyStaffLink, GetMyStaffLink()), TagValues.GreenButton(greenButtonText, CommonLinkUtility.GetFullAbsolutePath("~").TrimEnd('/')), new TagValue(CommonTags.Footer, footer), new TagValue(CommonTags.MasterTemplate, CoreContext.Configuration.Personal ? "HtmlMasterPersonal" : "HtmlMaster")); }
public void SendAdminWelcome(UserInfo newUserInfo) { if (!CoreContext.UserManager.UserExists(newUserInfo.ID)) { return; } if (!newUserInfo.IsActive) { throw new ArgumentException("User is not activated yet!"); } INotifyAction notifyAction; var tagValues = new List <ITagValue>(); if (TenantExtra.Enterprise) { var defaultRebranding = MailWhiteLabelSettings.Instance.IsDefault; notifyAction = defaultRebranding ? Actions.EnterpriseAdminWelcomeV10 : Actions.EnterpriseWhitelabelAdminWelcomeV10; tagValues.Add(TagValues.GreenButton(() => WebstudioNotifyPatternResource.ButtonAccessControlPanel, CommonLinkUtility.GetFullAbsolutePath("~" + SetupInfo.ControlPanelUrl))); } else { notifyAction = Actions.SaasAdminWelcomeV10; tagValues.Add(TagValues.GreenButton(() => WebstudioNotifyPatternResource.ButtonConfigureRightNow, CommonLinkUtility.GetFullAbsolutePath(CommonLinkUtility.GetAdministration(ManagementType.General)))); var tenant = CoreContext.TenantManager.GetCurrentTenant(); var analytics = StudioNotifyHelper.GetNotifyAnalytics(tenant.TenantId, notifyAction, false, true, false, false); tagValues.Add(new TagValue(CommonTags.Analytics, analytics)); tagValues.Add(TagValues.TableTop()); tagValues.Add(TagValues.TableItem(1, null, null, StudioNotifyHelper.GetNotificationImageUrl("tips-welcome-regional-50.png"), () => WebstudioNotifyPatternResource.pattern_saas_admin_welcome_v10_item_regional, null, null)); tagValues.Add(TagValues.TableItem(2, null, null, StudioNotifyHelper.GetNotificationImageUrl("tips-welcome-brand-50.png"), () => WebstudioNotifyPatternResource.pattern_saas_admin_welcome_v10_item_brand, null, null)); tagValues.Add(TagValues.TableItem(3, null, null, StudioNotifyHelper.GetNotificationImageUrl("tips-welcome-customize-50.png"), () => WebstudioNotifyPatternResource.pattern_saas_admin_welcome_v10_item_customize, null, null)); tagValues.Add(TagValues.TableItem(4, null, null, StudioNotifyHelper.GetNotificationImageUrl("tips-welcome-security-50.png"), () => WebstudioNotifyPatternResource.pattern_saas_admin_welcome_v10_item_security, null, null)); tagValues.Add(TagValues.TableItem(5, null, null, StudioNotifyHelper.GetNotificationImageUrl("tips-welcome-usertrack-50.png"), () => WebstudioNotifyPatternResource.pattern_saas_admin_welcome_v10_item_usertrack, null, null)); tagValues.Add(TagValues.TableItem(6, null, null, StudioNotifyHelper.GetNotificationImageUrl("tips-welcome-backup-50.png"), () => WebstudioNotifyPatternResource.pattern_saas_admin_welcome_v10_item_backup, null, null)); tagValues.Add(TagValues.TableItem(7, null, null, StudioNotifyHelper.GetNotificationImageUrl("tips-welcome-telephony-50.png"), () => WebstudioNotifyPatternResource.pattern_saas_admin_welcome_v10_item_telephony, null, null)); tagValues.Add(TagValues.TableBottom()); tagValues.Add(new TagValue(CommonTags.Footer, "common")); } tagValues.Add(new TagValue(Tags.UserName, newUserInfo.FirstName.HtmlEncode())); client.SendNoticeToAsync( notifyAction, null, StudioNotifyHelper.RecipientFromEmail(newUserInfo.Email, false), new[] { EMailSenderName }, null, tagValues.ToArray()); }
public void SendMsgPortalDeletionSuccess(UserInfo owner, string url) { Func <string> greenButtonText = () => WebstudioNotifyPatternResource.ButtonLeaveFeedback; client.SendNoticeToAsync( Actions.PortalDeleteSuccessV115, null, new IRecipient[] { owner }, new[] { EMailSenderName }, null, TagValues.GreenButton(greenButtonText, url), new TagValue(Tags.OwnerName, owner.DisplayUserName())); }
public void SendMsgConfirmChangeOwner(UserInfo owner, UserInfo newOwner, string confirmOwnerUpdateUrl) { Func <string> greenButtonText = () => WebstudioNotifyPatternResource.ButtonConfirmPortalOwnerUpdate; client.SendNoticeToAsync( Actions.ConfirmOwnerChange, null, new IRecipient[] { owner }, new[] { EMailSenderName }, null, TagValues.GreenButton(greenButtonText, confirmOwnerUpdateUrl), new TagValue(Tags.UserName, newOwner.DisplayUserName()), new TagValue(Tags.OwnerName, owner.DisplayUserName())); }
public void SendMsgTfaReset(UserInfo userInfo) { var confirmationUrl = CommonLinkUtility.GetConfirmationUrl(userInfo.Email.ToLower(), ConfirmType.TfaActivation); Func <string> greenButtonText = () => WebstudioNotifyPatternResource.ButtonChangeTfa; client.SendNoticeToAsync( Actions.TfaChange, null, StudioNotifyHelper.RecipientFromEmail(userInfo.Email, false), new[] { EMailSenderName }, null, TagValues.GreenButton(greenButtonText, confirmationUrl)); }
public void SendCongratulations(UserInfo u) { try { INotifyAction notifyAction; var footer = "common"; var analytics = string.Empty; if (TenantExtra.Enterprise) { var defaultRebranding = MailWhiteLabelSettings.Instance.IsDefault; notifyAction = defaultRebranding ? Actions.EnterpriseAdminActivationV10 : Actions.EnterpriseWhitelabelAdminActivationV10; footer = null; } else if (TenantExtra.Opensource) { notifyAction = Actions.OpensourceAdminActivation; footer = "opensource"; } else { notifyAction = Actions.SaasAdminActivationV10; var tenant = CoreContext.TenantManager.GetCurrentTenant(); analytics = StudioNotifyHelper.GetNotifyAnalytics(tenant.TenantId, notifyAction, false, true, false, false); } var confirmationUrl = CommonLinkUtility.GetConfirmationUrl(u.Email, ConfirmType.EmailActivation); confirmationUrl += "&first=true"; Func <string> greenButtonText = () => WebstudioNotifyPatternResource.ButtonConfirm; client.SendNoticeToAsync( notifyAction, null, StudioNotifyHelper.RecipientFromEmail(u.Email, false), new[] { EMailSenderName }, null, new TagValue(Tags.UserName, u.FirstName.HtmlEncode()), new TagValue(Tags.MyStaffLink, GetMyStaffLink()), TagValues.GreenButton(greenButtonText, confirmationUrl), new TagValue(CommonTags.Footer, footer), new TagValue(CommonTags.Analytics, analytics)); } catch (Exception error) { LogManager.GetLogger("ASC.Notify").Error(error); } }
public void SendJoinMsg(string email, EmployeeType emplType) { var inviteUrl = CommonLinkUtility.GetConfirmationUrl(email, ConfirmType.EmpInvite, (int)emplType) + String.Format("&emplType={0}", (int)emplType); Func <string> greenButtonText = () => WebstudioNotifyPatternResource.ButtonJoin; client.SendNoticeToAsync( Actions.JoinUsers, null, StudioNotifyHelper.RecipientFromEmail(email, true), new[] { EMailSenderName }, null, new TagValue(Tags.InviteLink, inviteUrl), TagValues.GreenButton(greenButtonText, inviteUrl)); }
public void SendEmailActivationInstructions(UserInfo user, string email) { var confirmationUrl = CommonLinkUtility.GetConfirmationUrl(email, ConfirmType.EmailActivation); Func <string> greenButtonText = () => WebstudioNotifyPatternResource.ButtonActivateEmail; client.SendNoticeToAsync( Actions.ActivateEmail, null, StudioNotifyHelper.RecipientFromEmail(email, false), new[] { EMailSenderName }, null, new TagValue(Tags.InviteLink, confirmationUrl), TagValues.GreenButton(greenButtonText, confirmationUrl), new TagValue(Tags.UserDisplayName, (user.DisplayUserName() ?? string.Empty).Trim())); }
public void SendMsgPortalDeletion(Tenant t, string url, bool showAutoRenewText) { var u = CoreContext.UserManager.GetUsers(t.OwnerId); Func <string> greenButtonText = () => WebstudioNotifyPatternResource.ButtonDeletePortal; client.SendNoticeToAsync( Actions.PortalDelete, null, new IRecipient[] { u }, new[] { EMailSenderName }, null, TagValues.GreenButton(greenButtonText, url), new TagValue(Tags.AutoRenew, showAutoRenewText.ToString()), new TagValue(Tags.OwnerName, u.DisplayUserName())); }
public void SendAdminWelcome(UserInfo newUserInfo) { if (!CoreContext.UserManager.UserExists(newUserInfo.ID)) { return; } if (!newUserInfo.IsActive) { throw new ArgumentException("User is not activated yet!"); } INotifyAction notifyAction; var tagValues = new List <ITagValue>(); if (TenantExtra.Enterprise) { var defaultRebranding = MailWhiteLabelSettings.Instance.IsDefault; notifyAction = defaultRebranding ? Actions.EnterpriseAdminWelcomeV10 : Actions.EnterpriseWhitelabelAdminWelcomeV10; tagValues.Add(TagValues.GreenButton(() => WebstudioNotifyPatternResource.ButtonAccessControlPanel, CommonLinkUtility.GetFullAbsolutePath(SetupInfo.ControlPanelUrl))); } else if (TenantExtra.Opensource) { notifyAction = Actions.OpensourceAdminWelcomeV11; tagValues.Add(new TagValue(CommonTags.Footer, "opensource")); tagValues.Add(new TagValue(Tags.ControlPanelUrl, CommonLinkUtility.GetFullAbsolutePath(SetupInfo.ControlPanelUrl).TrimEnd('/'))); } else { notifyAction = Actions.SaasAdminWelcomeV115; //tagValues.Add(TagValues.GreenButton(() => WebstudioNotifyPatternResource.ButtonConfigureRightNow, CommonLinkUtility.GetFullAbsolutePath(CommonLinkUtility.GetAdministration(ManagementType.General)))); tagValues.Add(new TagValue(CommonTags.Footer, "common")); } tagValues.Add(new TagValue(Tags.UserName, newUserInfo.FirstName.HtmlEncode())); client.SendNoticeToAsync( notifyAction, null, StudioNotifyHelper.RecipientFromEmail(newUserInfo.Email, false), new[] { EMailSenderName }, null, tagValues.ToArray()); }
public void SendMsgDnsChange(Tenant t, string confirmDnsUpdateUrl, string portalAddress, string portalDns) { var u = CoreContext.UserManager.GetUsers(t.OwnerId); Func <string> greenButtonText = () => WebstudioNotifyPatternResource.ButtonConfirmPortalAddressChange; client.SendNoticeToAsync( Actions.DnsChange, null, new IRecipient[] { u }, new[] { EMailSenderName }, null, new TagValue("ConfirmDnsUpdate", confirmDnsUpdateUrl), //TODO: Tag is deprecated and replaced by TagGreenButton TagValues.GreenButton(greenButtonText, confirmDnsUpdateUrl), new TagValue("PortalAddress", AddHttpToUrl(portalAddress)), new TagValue("PortalDns", AddHttpToUrl(portalDns ?? string.Empty)), new TagValue(Tags.OwnerName, u.DisplayUserName())); }
public void SendMsgProfileDeletion(UserInfo user) { var confirmationUrl = CommonLinkUtility.GetConfirmationUrl(user.Email, ConfirmType.ProfileRemove); Func <string> greenButtonText = () => CoreContext.Configuration.Personal ? WebstudioNotifyPatternResource.ButtonConfirmTermination : WebstudioNotifyPatternResource.ButtonRemoveProfile; var action = CoreContext.Configuration.Personal ? (CoreContext.Configuration.CustomMode ? Actions.PersonalCustomModeProfileDelete : Actions.PersonalProfileDelete) : Actions.ProfileDelete; client.SendNoticeToAsync( action, null, StudioNotifyHelper.RecipientFromEmail(user.Email, false), new[] { EMailSenderName }, null, TagValues.GreenButton(greenButtonText, confirmationUrl), new TagValue(CommonTags.Culture, user.GetCulture().Name)); }
public void SendEmailChangeInstructions(UserInfo user, string email) { var confirmationUrl = CommonLinkUtility.GetConfirmationUrl(email, ConfirmType.EmailChange, SecurityContext.CurrentAccount.ID); Func <string> greenButtonText = () => WebstudioNotifyPatternResource.ButtonChangeEmail; var action = CoreContext.Configuration.Personal ? (CoreContext.Configuration.CustomMode ? Actions.PersonalCustomModeEmailChangeV115 : Actions.PersonalEmailChangeV115) : Actions.EmailChangeV115; client.SendNoticeToAsync( action, null, StudioNotifyHelper.RecipientFromEmail(email, false), new[] { EMailSenderName }, null, TagValues.GreenButton(greenButtonText, confirmationUrl), new TagValue(CommonTags.Culture, user.GetCulture().Name)); }
public void UserPasswordChange(UserInfo userInfo) { var hash = CoreContext.Authentication.GetUserPasswordStamp(userInfo.ID).ToString("s"); var confirmationUrl = CommonLinkUtility.GetConfirmationUrl(userInfo.Email, ConfirmType.PasswordChange, hash); Func <string> greenButtonText = () => WebstudioNotifyPatternResource.ButtonChangePassword; var action = CoreContext.Configuration.Personal ? (CoreContext.Configuration.CustomMode ? Actions.PersonalCustomModePasswordChange : Actions.PersonalPasswordChange) : Actions.PasswordChange; client.SendNoticeToAsync( action, null, StudioNotifyHelper.RecipientFromEmail(userInfo.Email, false), new[] { EMailSenderName }, null, TagValues.GreenButton(greenButtonText, confirmationUrl)); }
private void MigrationNotify(INotifyAction action, string region, string url, bool notify, int?toTenantId = null) { var users = CoreContext.UserManager.GetUsers() .Where(u => notify ? u.ActivationStatus.HasFlag(EmployeeActivationStatus.Activated) : u.IsOwner()); if (users.Any()) { var args = CreateArgs(region, url); if (action == Actions.MigrationPortalSuccessV115) { foreach (var user in users) { var currentArgs = new List <ITagValue>(args); var newTenantId = toTenantId.HasValue ? toTenantId.Value : CoreContext.TenantManager.GetCurrentTenant().TenantId; var hash = CoreContext.Authentication.GetUserPasswordStamp(user.ID).ToString("s"); var confirmationUrl = url + "/" + CommonLinkUtility.GetConfirmationUrlRelative(newTenantId, user.Email, ConfirmType.PasswordChange, hash); Func <string> greenButtonText = () => WebstudioNotifyPatternResource.ButtonSetPassword; currentArgs.Add(TagValues.GreenButton(greenButtonText, confirmationUrl)); client.SendNoticeToAsync( action, null, new IRecipient[] { user }, new[] { EMailSenderName }, null, currentArgs.ToArray()); } } else { client.SendNoticeToAsync( action, null, users.Select(u => StudioNotifyHelper.ToRecipient(u.ID)).ToArray(), new[] { EMailSenderName }, null, args.ToArray()); } } }
public void GuestInfoActivation(UserInfo newUserInfo) { if (newUserInfo.IsActive) { throw new ArgumentException("User is already activated!"); } INotifyAction notifyAction; var footer = "social"; if (TenantExtra.Enterprise) { var defaultRebranding = MailWhiteLabelSettings.Instance.IsDefault; notifyAction = defaultRebranding ? Actions.EnterpriseGuestActivationV10 : Actions.EnterpriseWhitelabelGuestActivationV10; footer = null; } else if (TenantExtra.Opensource) { notifyAction = Actions.OpensourceGuestActivationV11; footer = "opensource"; } else { notifyAction = Actions.SaasGuestActivationV115; } var confirmationUrl = GenerateActivationConfirmUrl(newUserInfo); Func <string> greenButtonText = () => WebstudioNotifyPatternResource.ButtonAccept; client.SendNoticeToAsync( notifyAction, null, StudioNotifyHelper.RecipientFromEmail(newUserInfo.Email, false), new[] { EMailSenderName }, null, new TagValue(Tags.ActivateUrl, confirmationUrl), TagValues.GreenButton(greenButtonText, confirmationUrl), new TagValue(Tags.UserName, newUserInfo.FirstName.HtmlEncode()), new TagValue(CommonTags.Footer, footer)); }
public void GuestInfoAddedAfterInvite(UserInfo newUserInfo) { if (!CoreContext.UserManager.UserExists(newUserInfo.ID)) { return; } INotifyAction notifyAction; var analytics = string.Empty; var footer = "social"; if (TenantExtra.Enterprise) { var defaultRebranding = MailWhiteLabelSettings.Instance.IsDefault; notifyAction = defaultRebranding ? Actions.EnterpriseGuestWelcomeV10 : Actions.EnterpriseWhitelabelGuestWelcomeV10; footer = null; } else { notifyAction = Actions.SaasGuestWelcomeV10; var tenant = CoreContext.TenantManager.GetCurrentTenant(); analytics = StudioNotifyHelper.GetNotifyAnalytics(tenant.TenantId, notifyAction, false, false, false, true); } Func <string> greenButtonText = () => TenantExtra.Enterprise ? WebstudioNotifyPatternResource.ButtonAccessYourPortal : WebstudioNotifyPatternResource.ButtonAccessYouWebOffice; client.SendNoticeToAsync( notifyAction, null, StudioNotifyHelper.RecipientFromEmail(newUserInfo.Email, false), new[] { EMailSenderName }, null, new TagValue(Tags.UserName, newUserInfo.FirstName.HtmlEncode()), new TagValue(Tags.MyStaffLink, GetMyStaffLink()), TagValues.GreenButton(greenButtonText, CommonLinkUtility.GetFullAbsolutePath("~").TrimEnd('/')), new TagValue(CommonTags.Footer, footer), new TagValue(CommonTags.Analytics, analytics)); }
public void UserInfoActivation(UserInfo newUserInfo) { if (newUserInfo.IsActive) { throw new ArgumentException("User is already activated!"); } INotifyAction notifyAction; var analytics = string.Empty; var footer = "social"; if (TenantExtra.Enterprise) { var defaultRebranding = MailWhiteLabelSettings.Instance.IsDefault; notifyAction = defaultRebranding ? Actions.EnterpriseUserActivationV10 : Actions.EnterpriseWhitelabelUserActivationV10; footer = null; } else { notifyAction = Actions.SaasUserActivationV10; var tenant = CoreContext.TenantManager.GetCurrentTenant(); analytics = StudioNotifyHelper.GetNotifyAnalytics(tenant.TenantId, notifyAction, false, false, true, false); } var confirmationUrl = GenerateActivationConfirmUrl(newUserInfo); Func <string> greenButtonText = () => WebstudioNotifyPatternResource.ButtonAccept; client.SendNoticeToAsync( notifyAction, null, StudioNotifyHelper.RecipientFromEmail(newUserInfo.Email, false), new[] { EMailSenderName }, null, TagValues.GreenButton(greenButtonText, confirmationUrl), new TagValue(Tags.UserName, newUserInfo.FirstName.HtmlEncode()), new TagValue(CommonTags.Footer, footer), new TagValue(CommonTags.Analytics, analytics)); }
public void SendMsgRestoreCompleted(bool notifyAllUsers) { var users = notifyAllUsers ? CoreContext.UserManager.GetUsers(EmployeeStatus.Active) : new[] { CoreContext.UserManager.GetUsers(CoreContext.TenantManager.GetCurrentTenant().OwnerId) }; foreach (var user in users) { var hash = CoreContext.Authentication.GetUserPasswordStamp(user.ID).ToString("s"); var confirmationUrl = CommonLinkUtility.GetConfirmationUrl(user.Email, ConfirmType.PasswordChange, hash); Func <string> greenButtonText = () => WebstudioNotifyPatternResource.ButtonSetPassword; client.SendNoticeToAsync( Actions.RestoreCompletedV115, null, new IRecipient[] { user }, new[] { EMailSenderName }, null, TagValues.GreenButton(greenButtonText, confirmationUrl)); } }