Пример #1
0
 public static VelocityContext PrepareContext(UserActivity userActivity, UserInfo user)
 {
     var velocitycontext = new VelocityContext();
     velocitycontext.Put("activity", userActivity);
     velocitycontext.Put("url", CommonLinkUtility.GetFullAbsolutePath(userActivity.URL));
     velocitycontext.Put("user", user);
     velocitycontext.Put("displayName", user.DisplayUserName());
     velocitycontext.Put("userLink", CommonLinkUtility.GetFullAbsolutePath(CommonLinkUtility.GetUserProfile(user.ID, userActivity.ProductID)));
     velocitycontext.Put("moduleName", GetModuleName(userActivity));
     velocitycontext.Put("productName", GetProductName(userActivity));
     velocitycontext.Put("additionalData", userActivity.AdditionalData);
     return velocitycontext;
 }
Пример #2
0
 public void UserInfoAddedAfterInvite(UserInfo newUserInfo, string password)
 {
     if (CoreContext.UserManager.UserExists(newUserInfo.ID))
     {
         client.SendNoticeToAsync(
             CoreContext.Configuration.Personal ? Constants.ActionAfterRegistrationPersonal1 : Constants.ActionYouAddedAfterInvite,
             null,
             RecipientFromEmail(new[] { newUserInfo.Email }, false),
             new[] { EMailSenderName },
             null,
             new TagValue(Constants.TagUserName, newUserInfo.DisplayUserName()),
             new TagValue(Constants.TagUserEmail, newUserInfo.Email),
             new TagValue(Constants.TagMyStaffLink, GetMyStaffLink()),
             new TagValue(Constants.TagPassword, password),
             Constants.TagMarkerStart,
             Constants.TagMarkerEnd,
             Constants.TagFrameStart,
             Constants.TagFrameEnd,
             Constants.TagHeaderStart,
             Constants.TagHeaderEnd,
             Constants.TagStrongStart,
             Constants.TagStrongEnd,
             Constants.TagSignatureStart,
             Constants.TagSignatureEnd,
             new TagValue(CommonTags.WithPhoto, CoreContext.Configuration.Personal ? "personal" : ""),
             new TagValue(CommonTags.IsPromoLetter, CoreContext.Configuration.Personal ? "true" : "false"),
             Constants.UnsubscribeLink);
     }
 }
Пример #3
0
 public void SendMsgMobilePhoneChange(UserInfo userInfo)
 {
     client.SendNoticeToAsync(
         Constants.ActionPhoneChange,
         null,
         RecipientFromEmail(new[] { userInfo.Email.ToLower() }, false),
         new[] { EMailSenderName },
         null,
         new TagValue(Constants.TagInviteLink, CommonLinkUtility.GetConfirmationUrl(userInfo.Email.ToLower(), ConfirmType.PhoneActivation)),
         new TagValue(Constants.TagUserDisplayName, userInfo.DisplayUserName()));
 }
Пример #4
0
 public void SendUserPassword(UserInfo ui, string password)
 {
     client.SendNoticeToAsync(
                 Constants.ActionSendPassword,
                 null,
                 new[] { ToRecipient(ui.ID) },
                 new[] { EMailSenderName },
                 null,
                 new TagValue(Constants.TagPassword, password),
                 new TagValue(Constants.TagUserName, ui.DisplayUserName()),
                 new TagValue(Constants.TagUserEmail, ui.Email),
                 new TagValue(Constants.TagMyStaffLink, GetMyStaffLink()),
                 new TagValue(Constants.TagAuthor, (HttpContext.Current != null) ? HttpContext.Current.Request.UserHostAddress : null));
 }
Пример #5
0
 public void SendUserWelcomePersonal(UserInfo newUserInfo)
 {
     client.SendNoticeToAsync(
         Constants.ActionAfterRegistrationPersonal1,
         null,
         RecipientFromEmail(new[] { newUserInfo.Email.ToLower() }, true),
         new[] { EMailSenderName },
         null,
         new TagValue(Constants.TagInviteLink, GenerateActivationConfirmUrl(newUserInfo)),
         new TagValue(Constants.TagUserName, newUserInfo.DisplayUserName()),
         new TagValue(Constants.TagBlogLink, "http://www.onlyoffice.com/blog/2013/12/teamlab-personal-christmas-gift-for-your-family-and-friends/"),
         Constants.TagTableTop(),
         Constants.TagTableItem(1),
         Constants.TagTableItem(2),
         Constants.TagTableItem(3),
         Constants.TagTableBottom(),
         Constants.TagMarkerStart,
         Constants.TagMarkerEnd,
         Constants.TagFrameStart,
         Constants.TagFrameEnd,
         Constants.TagHeaderStart,
         Constants.TagHeaderEnd,
         Constants.TagStrongStart,
         Constants.TagStrongEnd,
         Constants.TagSignatureStart,
         Constants.TagSignatureEnd,
         new TagValue(CommonTags.WithPhoto, "personal"),
         new TagValue(CommonTags.IsPromoLetter, "true"),
         Constants.UnsubscribeLink,
         CreateSendFromTag());
 }
Пример #6
0
        public static string RenderCustomProfileLink(this UserInfo userInfo, String containerCssClass, String linkCssClass)
        {
            var containerCss = string.IsNullOrEmpty(containerCssClass) ? "userLink" : "userLink " + containerCssClass;
            var linkCss      = string.IsNullOrEmpty(linkCssClass) ? "" : linkCssClass;
            var sb           = new StringBuilder();

            if (userInfo == null || !CoreContext.UserManager.UserExists(userInfo.ID))
            {
                sb.AppendFormat("<span class='{0}'>", containerCss);
                sb.Append(Resource.ProfileRemoved);
                sb.Append("</span>");
            }
            else if (Array.Exists(Configuration.Constants.SystemAccounts, a => a.ID == userInfo.ID))
            {
                sb.AppendFormat("<span class='{0}'>", containerCss);
                sb.Append(userInfo.LastName);
                sb.Append("</span>");
            }
            else
            {
                sb.AppendFormat("<span class=\"{0}\" id=\"{1}\" data-uid=\"{2}\" >", containerCss, Guid.NewGuid(), userInfo.ID);
                sb.AppendFormat("<a class='{0}' href=\"{1}\">{2}</a>", linkCss, userInfo.GetUserProfilePageURL(), userInfo.DisplayUserName());
                sb.Append("</span>");
            }
            return(sb.ToString());
        }
Пример #7
0
 protected string GetEmployeeName(UserInfo ui)
 {
     return ui.DisplayUserName();
 }
Пример #8
0
        public void SendMsgMobilePhoneChange(UserInfo userInfo)
        {
            var inviteUrl = GenerateConfirmUrl(userInfo.Email.ToLower(), ConfirmType.PhoneChange);

            client.SendNoticeToAsync(
                Constants.ActionPhoneChange,
                null,
                RecipientFromEmail(new [] { userInfo.Email.ToLower() }, false),
                new[] { ASC.Core.Configuration.Constants.NotifyEMailSenderSysName },
                null,
                new TagValue(Constants.TagInviteLink, inviteUrl),
                new TagValue(new Tag("UserDisplayName"), userInfo.DisplayUserName())
                );
        }
 public void UserPasswordChange(UserInfo userInfo)
 {
     var hash = Hasher.Base64Hash(CoreContext.Authentication.GetUserPasswordHash(userInfo.ID));
     client.SendNoticeToAsync(
                 Constants.ActionPasswordChange,
                 null,
                 RecipientFromEmail(new[] { userInfo.Email }, false),
                 new[] { EMailSenderName },
                 null,
                 new TagValue(Constants.TagUserName, SecurityContext.IsAuthenticated ? DisplayUserSettings.GetFullUserName(SecurityContext.CurrentAccount.ID) : ((HttpContext.Current != null) ? HttpContext.Current.Request.UserHostAddress : null)),
                 new TagValue(Constants.TagInviteLink, CommonLinkUtility.GetConfirmationUrl(userInfo.Email, ConfirmType.PasswordChange, hash)),
                 new TagValue(Constants.TagBody, string.Empty),
                 new TagValue("UserDisplayName", userInfo.DisplayUserName()));
 }
Пример #10
0
        public static void Team(Project project, UserInfo userInfo, String actionText)
        {
            DropProjectActivitiesCache(project);

            var userProfileLink = VirtualPathUtility.ToAbsolute("~/userprofile.aspx") + String.Format("?uid={0}&pid={1}", userInfo.ID, ConfigurationManager.ProductID);

            UserActivityPublisher.Publish<TimeLinePublisher>(new TimeLineUserActivity(actionText, UserActivityConstants.ActivityActionType, UserActivityConstants.ImportantActivity)
            {
                ContentID = String.Empty,
                ContainerID = project.ID.ToString(),
                Title = userInfo.DisplayUserName(false),
                URL = userProfileLink,
                AdditionalData = String.Format(AdditionalDataPattern, EntityType.Team, String.Empty, project.Title),
                SecurityId = string.Format(SecurityDataPattern, EntityType.Team, string.Empty, project.ID),
            });
        }
Пример #11
0
        public MyUserProfile(Guid id)
        {
            Id = id;

            var userGroups = CoreContext.UserManager.GetUserGroups(Id);
            userInfo = CoreContext.UserManager.GetUsers(Id);

            UserName = userInfo.UserName;
            DisplayName = userInfo.DisplayUserName(true);
            FirstName = userInfo.FirstName;
            LastName = userInfo.LastName;
            GroupId = userGroups.Any() ? userGroups.First().ID.ToString() : String.Empty;
            Group = HttpUtility.HtmlEncode(userInfo.Department);
            Title = HttpUtility.HtmlEncode(userInfo.Title);
            Email = HttpUtility.HtmlEncode(userInfo.Email);
            Phone = HttpUtility.HtmlEncode(userInfo.MobilePhone);
            Gender = userInfo.Sex != null ? userInfo.Sex == true ? Resources.Resource.MaleSexStatus : Resources.Resource.FemaleSexStatus : String.Empty;
            Sex = userInfo.Sex;
            RegDate = userInfo.WorkFromDate;
            RegDateValue = userInfo.WorkFromDate.HasValue ? userInfo.WorkFromDate.Value.ToShortDateString() : String.Empty;
            BirthDate = userInfo.BirthDate;
            BirthDateValue = userInfo.BirthDate.HasValue ? userInfo.BirthDate.Value.ToShortDateString() : String.Empty;
            Place = HttpUtility.HtmlEncode(userInfo.Location);
            Comment = HttpUtility.HtmlEncode(userInfo.Notes);
            Status = userInfo.Status;

            Phones = GetPhones(userInfo.Contacts);
            Emails = GetEmails(userInfo.Contacts);
            Messengers = GetMessengers(userInfo.Contacts);
            Contacts = GetSocialContacts(userInfo.Contacts);            
        }
        private static void ActivateMail(UserInfo user)
        {
            if (user.ActivationStatus == EmployeeActivationStatus.Activated) return;

            user.ActivationStatus = EmployeeActivationStatus.Activated;
            CoreContext.UserManager.SaveUserInfo(user);

            MessageService.Send(HttpContext.Current.Request,
                                user.IsVisitor() ? MessageAction.GuestActivated : MessageAction.UserActivated,
                                user.DisplayUserName(false));
        }
 private void ActivateUser(UserInfo user, string newPwd)
 {
     try
     {
         //Set status to activated
         user.ActivationStatus = EmployeeActivationStatus.Activated;
         SecurityContext.AuthenticateMe(ASC.Core.Configuration.Constants.CoreSystem);
         CoreContext.UserManager.SaveUserInfo(user);
         if (!string.IsNullOrEmpty(newPwd))
         {
             //set password if it's specified
             SecurityContext.SetUserPassword(user.ID, newPwd);
         }
     }
     catch (Exception ex)
     {
         ShowError(ex.Message);
     }
     finally
     {
         SecurityContext.Logout(); //Logout from core system
     }
     //Login user
     try
     {
         var cookiesKey = SecurityContext.AuthenticateMe(user.ID);
         CookiesManager.SetCookies(CookiesType.AuthKey, cookiesKey);
         
         if (newPwd != null)
         {
             MessageService.Send(HttpContext.Current.Request, MessageAction.UserUpdatedPassword);
             MessageService.Send(HttpContext.Current.Request, MessageAction.LoginSuccess, user.DisplayUserName(false));
         }
     }
     catch (Exception exception)
     {
         ShowError(exception.Message);
     }
 }
Пример #14
0
 public void SendCongratulations(UserInfo u)
 {
     client.SendNoticeToAsync(
         Constants.ActionCongratulations,
         null,
         RecipientFromEmail(new[] { u.Email.ToLower() }, false),
         new[] { EMailSenderName },
         null,
         new TagValue(Constants.TagUserName, u.DisplayUserName()),
         new TagValue(Constants.TagUserEmail, u.Email),
         new TagValue(Constants.TagMyStaffLink, GetMyStaffLink()));
 }
Пример #15
0
        public void UserInfoActivation(UserInfo newUserInfo)
        {
            if (newUserInfo.IsActive)
            {
                throw new ArgumentException("User is already activated!");
            }

            client.SendNoticeToAsync(
                Constants.ActionActivateUsers,
                null,
                RecipientFromEmail(new[] { newUserInfo.Email.ToLower() }, false),
                new[] { EMailSenderName },
                null,
                new TagValue(Constants.TagInviteLink, GenerateActivationConfirmUrl(newUserInfo)),
                new TagValue(Constants.TagUserName, newUserInfo.DisplayUserName()),
                new TagValue(Constants.TagBlogLink, "http://www.onlyoffice.com/blog/2013/12/teamlab-personal-christmas-gift-for-your-family-and-friends/"),
                Constants.TagTableTop(),
                Constants.TagTableItem(1),
                Constants.TagTableItem(2),
                Constants.TagTableItem(3),
                Constants.TagTableBottom(),
                Constants.TagMarkerStart,
                Constants.TagMarkerEnd,
                Constants.TagFrameStart,
                Constants.TagFrameEnd,
                Constants.TagHeaderStart,
                Constants.TagHeaderEnd,
                Constants.TagStrongStart,
                Constants.TagStrongEnd,
                Constants.TagSignatureStart,
                Constants.TagSignatureEnd,
                new TagValue(CommonTags.WithPhoto, "links"),
                new TagValue(CommonTags.IsPromoLetter, "false"),
                CreateSendFromTag());
        }
Пример #16
0
 public void SendCongratulations(UserInfo u)
 {
     var tariff = CoreContext.TenantManager.GetTenantQuota(CoreContext.TenantManager.GetCurrentTenant().TenantId);
     client.SendNoticeToAsync(
         tariff != null && tariff.Trial ? Constants.ActionCongratulations : Constants.ActionCongratulationsNoTrial,
         null,
         RecipientFromEmail(new[] { u.Email.ToLower() }, false),
         new[] { EMailSenderName },
         null,
         new TagValue(Constants.TagUserName, u.DisplayUserName()),
         new TagValue(Constants.TagUserEmail, u.Email),
         new TagValue(Constants.TagMyStaffLink, GetMyStaffLink()),
         new TagValue(Constants.TagSettingsLink, CommonLinkUtility.GetAdministration(ManagementType.General)),
         new TagValue(Constants.TagInviteLink, CommonLinkUtility.GetConfirmationUrl(u.Email, ConfirmType.EmailActivation)),
         Constants.TagNoteStart,
         Constants.TagNoteEnd,
         new TagValue(CommonTags.WithPhoto, "links"));
 }
        public void UserInfoActivation(UserInfo newUserInfo)
        {
            if (newUserInfo.IsActive)
            {
                throw new ArgumentException("User is already activated!");
            }

            client.SendNoticeToAsync(
                CoreContext.Configuration.Personal ? Constants.ActionActivateUsersPersonal : Constants.ActionActivateUsers,
                null,
                RecipientFromEmail(new[] { newUserInfo.Email.ToLower() }, false),
                new[] { EMailSenderName },
                null,
                new TagValue(Constants.TagInviteLink, GenerateActivationConfirmUrl(newUserInfo)),
                new TagValue(Constants.TagUserName, newUserInfo.DisplayUserName()),
                new TagValue("TagBlogLink", "http://www.onlyoffice.com/blog/2013/12/teamlab-personal-christmas-gift-for-your-family-and-friends/"),
                Constants.TagTableTop(),
                Constants.TagTableItem(1),
                Constants.TagTableItem(2),
                Constants.TagTableItem(3),
                Constants.TagTableBottom(),
                new TagValue("WithPhoto", CoreContext.Configuration.Personal ? "" : "photo"),
                CreateSendFromTag());
        }
Пример #18
0
        public static string RenderProfileLinkBase(this UserInfo userInfo, Guid productID)
        {
            var sb = new StringBuilder();

            //check for removed users
            if (userInfo == null || !CoreContext.UserManager.UserExists(userInfo.ID))
            {
                sb.Append("<span class='userLink textMediumDescribe' style='white-space:nowrap;'>profile removed</span>");
            }
            else
            {
                var popupID = Guid.NewGuid();
                sb.Append("<span class=\"userLink\" style='white-space:nowrap;' id='" + popupID + "'>");
                sb.Append("<a class='linkDescribe' href=\"" + userInfo.GetUserProfilePageURLGeneral(productID) + "\">" + userInfo.DisplayUserName() + "</a>");
                sb.Append("</span>");

                sb.Append("<script language='javascript'> StudioUserProfileInfo.RegistryElement('" + popupID + "','\"" + userInfo.ID + "\",\"" + productID + "\"'); </script>");
            }
            return(sb.ToString());
        }
        public void UserPasswordChange(UserInfo userInfo)
        {
            var email = userInfo.Email;
            var validationKey = EmailValidationKeyProvider.GetEmailKey(email + ConfirmType.PasswordChange.ToString());
            var inviteUrl = CommonLinkUtility.GetFullAbsolutePath(string.Format("~/confirm.aspx?type={2}&email={0}&key={1}",
                HttpUtility.UrlEncode(email),
                validationKey,
                ConfirmType.PasswordChange.ToString()));

            client.SendNoticeToAsync(
                        Constants.ActionPasswordChange,
                        null,
                        RecipientFromEmail(new[] { email }, false),
                        new[] { EMailSenderName },
                        null,
                        new TagValue(Constants.TagUserName, SecurityContext.IsAuthenticated ? DisplayUserSettings.GetFullUserName(SecurityContext.CurrentAccount.ID) : ((HttpContext.Current != null) ? HttpContext.Current.Request.UserHostAddress : null)),
                        new TagValue(Constants.TagInviteLink, inviteUrl),
                        new TagValue(Constants.TagBody, string.Empty),
                        new TagValue("UserDisplayName", userInfo.DisplayUserName()));
        }
Пример #20
0
        public static string RenderProfileLink(this UserInfo userInfo, Guid productID)
        {
            var sb = new StringBuilder();

            if (userInfo == null || !CoreContext.UserManager.UserExists(userInfo.ID))
            {
                sb.Append("<span class='userLink text-medium-describe'>");
                sb.Append(Resource.ProfileRemoved);
                sb.Append("</span>");
            }
            else if (Array.Exists(Configuration.Constants.SystemAccounts, a => a.ID == userInfo.ID))
            {
                sb.Append("<span class='userLink text-medium-describe'>");
                sb.Append(userInfo.LastName);
                sb.Append("</span>");
            }
            else
            {
                sb.AppendFormat("<span class=\"userLink\" id=\"{0}\" data-uid=\"{1}\" data-pid=\"{2}\">", Guid.NewGuid(), userInfo.ID, productID);
                sb.AppendFormat("<a class='linkDescribe' href=\"{0}\">{1}</a>", userInfo.GetUserProfilePageURL(), userInfo.DisplayUserName());
                sb.Append("</span>");
            }
            return(sb.ToString());
        }
        public void UserInfoUpdated(UserInfo prevUser, UserInfo newUser, string password)
        {
            var author = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);
            ISendInterceptor interceptor = null;
            if (!ASC.Core.Users.Constants.LostUser.Equals(author))
            {
                interceptor = new InitiatorInterceptor(new[] { ToRecipient(author.ID) });
                client.AddInterceptor(interceptor);
            }

            client.SendNoticeToAsync(
                           Constants.ActionYourProfileUpdated,
                           null,
                           new[] { ToRecipient(newUser.ID) },
                           AllSenderNames,
                           null,
                           new TagValue(Constants.TagProfileChanges, GetUserInfoChanges(prevUser, newUser)),
                           new TagValue(Constants.TagUserName, newUser.DisplayUserName()),
                           new TagValue(Constants.TagMyStaffLink, GetMyStaffLink()),
                           new TagValue(Constants.TagPassword, password),
                           new TagValue(Constants.TagIsPasswordChange, password != null));

            if (interceptor != null)
            {
                client.RemoveInterceptor(interceptor.Name);
            }
        }
Пример #22
0
            public void RunJob()
            {
                Status = (int)Operation.Success;
                CoreContext.TenantManager.SetCurrentTenant((int)Id);
                SecurityContext.AuthenticateMe(UserId);

                if (!SecurityContext.CheckPermissions(Constants.Action_AddRemoveUser))
                {
                    Error = Resources.Resource.ErrorAccessDenied;
                    IsCompleted = true;
                    return;
                }

                try
                {
                    var jsSerializer = new System.Web.Script.Serialization.JavaScriptSerializer();
                    var ruleObj = jsSerializer.Deserialize<List<UserData>>(userList);
                    var error = 0;

                    var percentStep = 100.0 / ruleObj.Count;
                    foreach (var userData in ruleObj)
                    {
                        var validateEmail = UserManagerWrapper.ValidateEmail(userData.Email);
                        if (!validateEmail || String.IsNullOrEmpty(userData.FirstName) || String.IsNullOrEmpty(userData.LastName))
                        {
                            Data.Add(new UserResults
                                {
                                    Email = userData.Email,
                                    Result = Resources.Resource.ImportContactsIncorrectFields,
                                    Class = !validateEmail ? "error3" : "error1"
                                });
                            error++;
                            Percentage += percentStep;
                            continue;
                        }

                        var us = CoreContext.UserManager.GetUserByEmail(userData.Email);

                        if (us.ID != Constants.LostUser.ID)
                        {
                            Data.Add(new UserResults
                                {
                                    Email = userData.Email,
                                    Result = Resources.Resource.ImportContactsAlreadyExists,
                                    Class = "error2"
                                });
                            error++;
                            Percentage += percentStep;
                            continue;
                        }

                        if (!importUsersAsCollaborators && TenantStatisticsProvider.GetUsersCount() >= TenantExtra.GetTenantQuota().ActiveUsers)
                        {
                            importUsersAsCollaborators = true;
                        }

                        var userInfo = new UserInfo
                            {
                                Email = userData.Email,
                                FirstName = userData.FirstName,
                                LastName = userData.LastName
                            };
                        UserManagerWrapper.AddUser(userInfo, UserManagerWrapper.GeneratePassword(), false, true, importUsersAsCollaborators);

                        var messageAction = importUsersAsCollaborators ? MessageAction.GuestImported : MessageAction.UserImported;
                        MessageService.Send(httpHeaders, messageAction, userInfo.DisplayUserName(false));

                        Data.Add(new UserResults { Email = userData.Email, Result = String.Empty });
                        Percentage += percentStep;
                    }
                }
                catch(Exception ex)
                {
                    Status = (int)Operation.Error;
                    Error = ex.Message;
                }

                IsCompleted = true;
            }
 public void SendEmailActivationInstructions(UserInfo user, string email)
 {
     client.SendNoticeToAsync(
                 Constants.ActionActivateEmail,
                 null,
                 RecipientFromEmail(new[] { email }, false),
                 new[] { EMailSenderName },
                 null,
                 new TagValue(Constants.TagUserName, SecurityContext.IsAuthenticated ? DisplayUserSettings.GetFullUserName(SecurityContext.CurrentAccount.ID) : ((HttpContext.Current != null) ? HttpContext.Current.Request.UserHostAddress : null)),
                 new TagValue(Constants.TagInviteLink, GenerateConfirmUrl(email, ConfirmType.EmailActivation)),
                 new TagValue(Constants.TagBody, string.Empty),
                 new TagValue("UserDisplayName", (user.DisplayUserName() ?? string.Empty).Trim()));
 }
Пример #24
0
 public void UserPasswordChange(UserInfo userInfo)
 {
     var hash = Hasher.Base64Hash(CoreContext.Authentication.GetUserPasswordHash(userInfo.ID));
     client.SendNoticeToAsync(
         CoreContext.Configuration.Personal ? Constants.ActionPasswordChangePersonal : Constants.ActionPasswordChange,
                 null,
                 RecipientFromEmail(new[] { userInfo.Email }, false),
                 new[] { EMailSenderName },
                 null,
                 new TagValue(Constants.TagUserName, SecurityContext.IsAuthenticated ? DisplayUserSettings.GetFullUserName(SecurityContext.CurrentAccount.ID) : ((HttpContext.Current != null) ? HttpContext.Current.Request.UserHostAddress : null)),
                 new TagValue(Constants.TagInviteLink, CommonLinkUtility.GetConfirmationUrl(userInfo.Email, ConfirmType.PasswordChange, hash)),
                 new TagValue(Constants.TagBody, string.Empty),
                 new TagValue(Constants.TagUserDisplayName, userInfo.DisplayUserName()),
                 Constants.TagSignatureStart,
                 Constants.TagSignatureEnd,
                 new TagValue(CommonTags.WithPhoto, CoreContext.Configuration.Personal ? "personal" : ""),
                 new TagValue(CommonTags.IsPromoLetter, CoreContext.Configuration.Personal ? "true" : "false"),
                 Constants.UnsubscribeLink);
 }
        private void SendInvite(UserInfo user, string inviteMessage, bool join, EmployeeType emplType)
        {
            var email = user.Email;
            var validationKey = EmailValidationKeyProvider.GetEmailKey(email + ConfirmType.EmpInvite.ToString() + (int)emplType);
            var inviteUrl = String.Format("~/confirm.aspx?type={2}&email={0}&firstname={4}&lastname={5}&key={1}&emplType={3}&uid={6}",
                                            HttpUtility.UrlEncode(email),
                                            validationKey,
                                            ConfirmType.EmpInvite.ToString(),
                                            (int)emplType,
                                            HttpUtility.UrlEncode(user.FirstName),
                                            HttpUtility.UrlEncode(user.LastName),
                                            SecurityContext.CurrentAccount.ID);

            client.SendNoticeToAsync(
                        join ? Constants.ActionJoinUsers : Constants.ActionInviteUsers,
                        null,
                        RecipientFromEmail(new string[] { email }, join),/*if it's invite - don't check activation status*/
                        new[] { EMailSenderName },
                        null,
                        new TagValue(Constants.TagUserName, SecurityContext.IsAuthenticated ? DisplayUserSettings.GetFullUserName(SecurityContext.CurrentAccount.ID) : ((HttpContext.Current != null) ? HttpContext.Current.Request.UserHostAddress : null)),
                        new TagValue(Constants.TagInviteLink, CommonLinkUtility.GetFullAbsolutePath(inviteUrl)),
                        new TagValue(Constants.TagBody, inviteMessage ?? string.Empty),
                        Constants.TagTableTop(),
                        Constants.TagTableItem(1),
                        Constants.TagTableItem(2),
                        Constants.TagTableItem(3),
                        Constants.TagTableBottom(),
                        new TagValue("WithPhoto", "photo"),
                        new TagValue("UserDisplayName", (user.DisplayUserName() ?? "").Trim()),
                        CreateSendFromTag());
        }
Пример #26
0
 public void SendEmailActivationInstructions(UserInfo user, string email)
 {
     client.SendNoticeToAsync(
                 Constants.ActionActivateEmail,
                 null,
                 RecipientFromEmail(new[] { email }, false),
                 new[] { EMailSenderName },
                 null,
                 new TagValue(Constants.TagUserName, SecurityContext.IsAuthenticated ? DisplayUserSettings.GetFullUserName(SecurityContext.CurrentAccount.ID) : ((HttpContext.Current != null) ? HttpContext.Current.Request.UserHostAddress : null)),
                 new TagValue(Constants.TagInviteLink, CommonLinkUtility.GetConfirmationUrl(email, ConfirmType.EmailActivation)),
                 new TagValue(Constants.TagBody, string.Empty),
                 new TagValue(Constants.TagUserDisplayName, (user.DisplayUserName() ?? string.Empty).Trim()),
                 new TagValue(CommonTags.WithPhoto, CoreContext.Configuration.Personal ? "personal" : "links"),
                 new TagValue(CommonTags.IsPromoLetter, CoreContext.Configuration.Personal ? "true" : "false"),
                 Constants.UnsubscribeLink);
 }
        public void UserInfoActivation(UserInfo newUserInfo)
        {
            if (newUserInfo.IsActive)
            {
                throw new ArgumentException("User is already activated!");
            }

            client.SendNoticeToAsync(
                CoreContext.Configuration.YourDocsDemo ? Constants.ActionActivateUsersYourDocs : Constants.ActionActivateUsers,
                null,
                RecipientFromEmail(new[] { newUserInfo.Email.ToLower() }, false),
                new[] { EMailSenderName },
                null,
                new TagValue(Constants.TagInviteLink, GenerateActivationConfirmUrl(newUserInfo)),
                new TagValue(Constants.TagUserName, newUserInfo.DisplayUserName()),
                Constants.TagTableTop(),
                Constants.TagTableItem(1),
                Constants.TagTableItem(2),
                Constants.TagTableItem(3),
                Constants.TagTableBottom(),
                new TagValue("WithPhoto", "photo"),
                CreateSendFromTag());
        }
Пример #28
0
        private void SendInvite(UserInfo user, string inviteMessage, bool join, EmployeeType emplType)
        {
            var inviteUrl = CommonLinkUtility.GetConfirmationUrl(user.Email, ConfirmType.EmpInvite, (int)emplType, SecurityContext.CurrentAccount.ID)
                            + String.Format("&firstname={0}&lastname={1}&emplType={2}",
                                            HttpUtility.UrlEncode(user.FirstName),
                                            HttpUtility.UrlEncode(user.LastName),
                                            (int)emplType);

            client.SendNoticeToAsync(
                        join ? Constants.ActionJoinUsers : Constants.ActionInviteUsers,
                        null,
                        RecipientFromEmail(new string[] { user.Email }, join),/*if it's invite - don't check activation status*/
                        new[] { EMailSenderName },
                        null,
                        new TagValue(Constants.TagUserName, SecurityContext.IsAuthenticated ? DisplayUserSettings.GetFullUserName(SecurityContext.CurrentAccount.ID) : ((HttpContext.Current != null) ? HttpContext.Current.Request.UserHostAddress : null)),
                        new TagValue(Constants.TagInviteLink, inviteUrl),
                        new TagValue(Constants.TagBody, inviteMessage ?? string.Empty),
                        Constants.TagTableTop(),
                        Constants.TagTableItem(1),
                        Constants.TagTableItem(2),
                        Constants.TagTableItem(3),
                        Constants.TagTableBottom(),
                        new TagValue(CommonTags.WithPhoto, "links"),
                        new TagValue(Constants.TagUserDisplayName, (user.DisplayUserName() ?? "").Trim()),
                        CreateSendFromTag());
        }
 public void SendCongratulations(UserInfo u)
 {
     client.SendNoticeToAsync(
         Constants.ActionCongratulations,
         null,
         RecipientFromEmail(new[] { u.Email.ToLower() }, false),
         new[] { EMailSenderName },
         null,
         new TagValue(Constants.TagUserName, u.DisplayUserName()),
         new TagValue(Constants.TagUserEmail, u.Email),
         new TagValue(Constants.TagMyStaffLink, GetMyStaffLink()),
         new TagValue(Constants.TagSettingsLink, CommonLinkUtility.GetAdministration(ManagementType.General)),
         new TagValue(Constants.TagInviteLink, GenerateConfirmUrl(u.Email, ConfirmType.EmailActivation)),
         Constants.TagNoteStart,
         Constants.TagNoteEnd,
         new TagValue("WithPhoto", "photo"));
 }
Пример #30
0
 public void GuestInfoAddedAfterInvite(UserInfo newUserInfo, string password)
 {
     if (CoreContext.UserManager.UserExists(newUserInfo.ID))
     {
         client.SendNoticeToAsync(
                     Constants.ActionYouAddedLikeGuest,
                     null,
                     RecipientFromEmail(new[] { newUserInfo.Email }, false),
                     new[] { EMailSenderName },
                     null,
                     new TagValue(Constants.TagUserName, newUserInfo.DisplayUserName()),
                     new TagValue(Constants.TagUserEmail, newUserInfo.Email),
                     new TagValue(Constants.TagMyStaffLink, GetMyStaffLink()),
                     new TagValue(Constants.TagPassword, password));
     }
 }
Пример #31
0
        public EmployeeWraperFull AddMember(bool isVisitor, string email, string firstname, string lastname, Guid[] department, string title, string location, string sex, ApiDateTime birthday, ApiDateTime worksfrom, string comment, IEnumerable<Contact> contacts, string files)
        {
            SecurityContext.DemandPermissions(Core.Users.Constants.Action_AddRemoveUser);
            var password = UserManagerWrapper.GeneratePassword();
            var user = new UserInfo();

            //Validate email
            var address = new MailAddress(email);
            user.Email = address.Address;
            //Set common fields
            user.FirstName = firstname;
            user.LastName = lastname;
            user.Title = title;
            user.Location = location;
            user.Notes = comment;
            user.Sex = "male".Equals(sex, StringComparison.OrdinalIgnoreCase)
                           ? true
                           : ("female".Equals(sex, StringComparison.OrdinalIgnoreCase) ? (bool?)false : null);

            user.BirthDate = birthday != null ? TenantUtil.DateTimeFromUtc(Convert.ToDateTime(birthday)) : (DateTime?)null;
            user.WorkFromDate = worksfrom != null ? TenantUtil.DateTimeFromUtc(Convert.ToDateTime(worksfrom)) : DateTime.UtcNow.Date;

            UpdateContacts(contacts, user);

            user = UserManagerWrapper.AddUser(user, password, false, true, isVisitor);

            var messageAction = isVisitor ? MessageAction.GuestCreated : MessageAction.UserCreated;
            MessageService.Send(_context, messageAction, user.DisplayUserName(false));

            UpdateDepartments(department, user);

            if (files != UserPhotoManager.GetDefaultPhotoAbsoluteWebPath())
            {
                UpdatePhotoUrl(files, user);
            }

            return new EmployeeWraperFull(user);
        }
Пример #32
0
 public void GuestInfoActivation(UserInfo newUserInfo)
 {
     if (newUserInfo.IsActive)
     {
         throw new ArgumentException("User is already activated!");
     }
     client.SendNoticeToAsync(
         Constants.ActionActivateGuests,
         null,
         RecipientFromEmail(new[] { newUserInfo.Email.ToLower() }, false),
         new[] { EMailSenderName },
         null,
         new TagValue(Constants.TagInviteLink, GenerateActivationConfirmUrl(newUserInfo)),
         new TagValue(Constants.TagUserName, newUserInfo.DisplayUserName()),
         CreateSendFromTag());
 }
Пример #33
0
        public static string RenderProfileLinkBase(this UserInfo userInfo, UserManager userManager, CommonLinkUtility commonLinkUtility, DisplayUserSettingsHelper displayUserSettingsHelper)
        {
            var sb = new StringBuilder();

            //check for removed users
            if (userInfo == null || !userManager.UserExists(userInfo))
            {
                sb.Append("<span class='userLink text-medium-describe' style='white-space:nowrap;'>profile removed</span>");
            }
            else
            {
                var popupID = Guid.NewGuid();
                sb.AppendFormat("<span class=\"userLink\" style='white-space:nowrap;' id='{0}' data-uid='{1}'>", popupID, userInfo.ID);
                sb.AppendFormat("<a class='linkDescribe' href=\"{0}\">{1}</a>", userInfo.GetUserProfilePageURLGeneral(commonLinkUtility), userInfo.DisplayUserName(displayUserSettingsHelper));
                sb.Append("</span>");

                sb.AppendFormat("<script language='javascript'> StudioUserProfileInfo.RegistryElement('{0}','\"{1}\"); </script>", popupID, userInfo.ID);
            }
            return(sb.ToString());
        }
Пример #34
0
        public static string RenderProfileLinkBase(this UserInfo userInfo)
        {
            var sb = new StringBuilder();

            //check for removed users
            if (userInfo.ID == Constants.LostUser.ID)
            {
                sb.AppendFormat("<span class='userLink text-medium-describe' style='white-space:nowrap;'>{0}</span>", userInfo.DisplayUserName());
            }
            else
            {
                var popupID = Guid.NewGuid();
                sb.AppendFormat("<span class=\"userLink\" style='white-space:nowrap;' id='{0}' data-uid='{1}'>", popupID, userInfo.ID);
                sb.AppendFormat("<a class='linkDescribe' href=\"{0}\">{1}</a>", userInfo.GetUserProfilePageURLGeneral(), userInfo.DisplayUserName());
                sb.Append("</span>");

                sb.AppendFormat("<script language='javascript'> StudioUserProfileInfo.RegistryElement('{0}','\"{1}\"); </script>", popupID, userInfo.ID);
            }
            return(sb.ToString());
        }
Пример #35
0
        public void UserInfoActivation(UserInfo newUserInfo)
        {
            if (newUserInfo.IsActive)
                throw new ArgumentException("User is already activated!");

            var email = newUserInfo.Email.ToLower();
            var inviteUrl = GenerateActivationConfirmUrl(newUserInfo);

            client.SendNoticeToAsync(
                        Constants.ActionActivateUsers,
                        null,
                        RecipientFromEmail(new[] { email }, false),
                        new[] { EMailSenderName },
                        null,
                        new TagValue(Constants.TagUserName, SecurityContext.IsAuthenticated ? DisplayUserSettings.GetFullUserName(SecurityContext.CurrentAccount.ID) : ((HttpContext.Current != null) ? HttpContext.Current.Request.UserHostAddress : null)),
                        new TagValue(Constants.TagInviteLink, inviteUrl),
                        new TagValue(Constants.TagBody, ""),
                //User name tag
                        new TagValue(new Tag("UserDisplayName"), (newUserInfo.DisplayUserName() ?? "").Trim()),
                        CreateSendFromTag()
                    );
        }