private static string CreateReference(HttpRequest request, string tenantDomain, int tenantId, string email)
 {
     return(String.Format("{0}{1}{2}/{3}",
                          request != null && request.UrlReferrer != null ? request.UrlReferrer.Scheme : Uri.UriSchemeHttp,
                          Uri.SchemeDelimiter,
                          tenantDomain,
                          CommonLinkUtility.GetConfirmationUrlRelative(tenantId, email, ConfirmType.Auth)
                          ));
 }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.RegisterStyle(FilesLinkUtility.FilesBaseAbsolutePath + "controls/desktop/desktop.css");
            Page.RegisterBodyScripts("~/products/files/controls/desktop/desktop.js");

            desktopWelcomeDialog.Options.IsPopup = true;
            Setting = AdditionalWhiteLabelSettings.Instance;

            AuthLink = CommonLinkUtility.GetConfirmationUrlRelative(TenantProvider.CurrentTenantID, CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID).Email, ConfirmType.Auth);
        }
Exemplo n.º 3
0
        public string CreateReference(string requestUriScheme, string tenantDomain, string email, bool first = false, string module = "", bool sms = false)
        {
            return(string.Format("{0}{1}{2}/{3}{4}{5}{6}",
                                 requestUriScheme,
                                 Uri.SchemeDelimiter,
                                 tenantDomain,
                                 CommonLinkUtility.GetConfirmationUrlRelative(email, ConfirmType.Auth, (first ? "true" : "") + module + (sms ? "true" : "")),
                                 first ? "&first=true" : "",
                                 string.IsNullOrEmpty(module) ? "" : "&module=" + module,
                                 sms ? "&sms=true" : ""

                                 ));
        }
        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());
                }
            }
        }