Exemplo n.º 1
0
        public bool ConfirmationLinkIsValid(string link, ConfirmType type)
        {
            Confirmationkey confirm = _awdwareCoreDbContext.UserConfirmations.First(
                x => (x.KeyString == link && x.ConfirmType == type));

            return(confirm.Expiration > DateTime.Now);
        }
Exemplo n.º 2
0
 public CemiLData(CemiMessageCode messageCode, IndividualAddress srcAddress, IAddress dstAddress, byte[] tpdu,
                  Priority priority, ConfirmType confirm)
     : this(messageCode, srcAddress, dstAddress, tpdu, priority, true, BroadcastType.Normal, false, 6)
 {
     //  overwrite controlField1 now including confirm
     _controlField1 = new ControlField1(_messageCode, false, priority, true, BroadcastType.Normal, false, confirm);
 }
Exemplo n.º 3
0
        private string GetConfirmLink(string email, ConfirmType confirmType)
        {
            var validationKey = EmailValidationKeyProvider.GetEmailKey(email.ToLower() + confirmType.ToString().ToLower());

            return(CommonLinkUtility.GetFullAbsolutePath("~/confirm.aspx") +
                   string.Format("?type={0}&email={1}&key={2}", confirmType.ToString().ToLower(), HttpUtility.UrlEncode(email), validationKey));;
        }
Exemplo n.º 4
0
        private bool ConfirmSave(ConfirmType type)
        {
            string msg = string.Empty;

            switch (type)
            {
            case ConfirmType.Close:
                msg = "Save configuration prior to closing form?";
                break;

            case ConfirmType.Run:
                msg = "Save configuration prior to closing form and running build?";
                break;

            case ConfirmType.CommandLine:
                msg = "Save configuration prior to constructing Command Line?";
                break;
            }
            DialogResult result = MessageBox.Show(msg, "Save Configuration", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                saveConfigurationToolStripMenuItem_Click(null, EventArgs.Empty);
            }
            if (result == DialogResult.Cancel)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Exemplo n.º 5
0
        public bool AddConfirmationKey(WebUser user, string key, ConfirmType type, DateTime?expiration = null)
        {
            if (user == null || string.IsNullOrEmpty(key))
            {
                return(false);
            }
            Confirmationkey confirm = new Confirmationkey
            {
                UserId      = user.UserId,
                KeyString   = key,
                ConfirmType = type,
                Expiration  = expiration
            };

            if (_awdwareCoreDbContext.UserConfirmations.Any(x => (x.UserId == confirm.UserId && x.ConfirmType == confirm.ConfirmType)))
            {
                throw new InvalidOperationException("The confirm key already exists");
            }
            else
            {
                _awdwareCoreDbContext.UserConfirmations.Add(confirm);
            }

            _awdwareCoreDbContext.SaveChanges();
            return(true);
        }
Exemplo n.º 6
0
    /// <summary>
    /// 提供两种样式确认面板的方法
    /// </summary>
    public void ShowConfirmPanel(string confirmQuestion, ConfirmType ct, UnityAction yes, UnityAction no = null)
    {
        string panelName;

        switch (ct)
        {
        case ConfirmType.OneBtn:
            panelName = "oneBtnTipPanel";
            break;

        case ConfirmType.TwoBtn:
            panelName = "twoBtnTipPanel";
            break;

        default:
            panelName = null;
            break;
        }
        PlayerStatus.Instance.InputEnable = false;
        ShowPanel <BasePanel>(panelName, E_UI_Layer.system, (p) =>
        {
            switch (ct)
            {
            case ConfirmType.OneBtn:
                p.GetComponent <OneBtnTipPanel>().InitInfo(confirmQuestion, no);
                break;

            case ConfirmType.TwoBtn:
                p.GetComponent <TwoBtnTipPanel>().InitInfo(confirmQuestion, yes, no);
                break;
            }
        });
    }
        protected void Page_Load(object sender, EventArgs e)
        {
            var email = (Request["email"] ?? "").Trim();
            if (string.IsNullOrEmpty(email))
            {
                ShowError(Resources.Resource.ErrorNotCorrectEmail);
                return;
            }

            var type = typeof(ConfirmType).TryParseEnum(Request["type"] ?? "", ConfirmType.EmpInvite);
            Type = type;//Save to viewstate
            
            User = CoreContext.UserManager.GetUserByEmail(email);
            if (User.ID.Equals(Constants.LostUser.ID))
            {
                //Error. User doesn't exists.
                ShowError(string.Format(Resources.Resource.ErrorUserNotFoundByEmail, email));
                return;
            }
           
            Page.Title = HeaderStringHelper.GetPageTitle(Resources.Resource.Authorization, null, null);
            if (type == ConfirmType.EmailChange && !IsPostBack)
            {
                //If it's email confirmation then just activate
                emailChange.Visible = true;
                ActivateUser(User);
                AjaxPro.Utility.RegisterTypeForAjax(typeof(EmailOperationService));
                //RegisterRedirect();
            }
            else if (type == ConfirmType.PasswordChange)
            {
                passwordSetter.Visible = true;
            }
        }
Exemplo n.º 8
0
    /// <summary>
    /// 用于创建提示不同的提示框
    /// </summary>
    /// <param name="type">使用哪一个提示类型</param>
    /// <param name="AllowCallBack">确定之后的回调</param>
    /// <param name="CancelCallBack">取消之后的回调</param>
    public static IEnumerator PromptUI(ConfirmType type = ConfirmType.Cancel_OK_Btn)
    {
        using (DownLoadPromptUI ui = new DownLoadPromptUI(type))
        {
            bool isAllow = false;
            if (type == ConfirmType.Cancel_OK_Btn)
            {
                ui.AllowCallBack  = () => { isAllow = true; };
                ui.CancelCallBack = () => {
#if !UNITY_EDITOR
                    Application.Quit();
#endif
                };
            }
            else
            {
                ui.CenterAllowCallBack = () => {
#if !UNITY_EDITOR
                    Application.Quit();
#endif
                };
            }

            while (!isAllow)
            {
                yield return(null);
            }
        }
    }
Exemplo n.º 9
0
        public ConfirmKeyUsageResult TryUseConfirmationLink(string key, ConfirmType type)
        {
            var res        = new ConfirmKeyUsageResult();
            var confirmKey = _awdwareCoreDbContext.UserConfirmations.FirstOrDefault(x => (x.KeyString == key && x.ConfirmType == type));

            if (confirmKey == null)
            {
                res.Success = ConfirmKeyUsageSuccess.UnknownError;
                return(res);
            }

            _awdwareCoreDbContext.UserConfirmations.Remove(confirmKey);
            _awdwareCoreDbContext.SaveChanges();

            if (confirmKey.Expiration > DateTime.Now)
            {
                res.Success = ConfirmKeyUsageSuccess.Success;
                res.WebUser = GetUserById(confirmKey.UserId);
                return(res);
            }
            else
            {
                res.Success = ConfirmKeyUsageSuccess.ExpiredKey;
                return(res);
            }
        }
Exemplo n.º 10
0
        internal static string GenerateConfirmUrl(string email, ConfirmType confirmType)
        {
            var validationKey = EmailValidationKeyProvider.GetEmailKey(
                email + confirmType.ToString().ToLower());
            var inviteUrl = CommonLinkUtility.GetFullAbsolutePath(String.Format("~/confirm.aspx?type={2}&email={0}&key={1}",
                                                                                HttpUtility.UrlEncode(email), validationKey,
                                                                                confirmType.ToString().ToLower()));

            return(inviteUrl);
        }
Exemplo n.º 11
0
        protected override void OnPreInit(EventArgs e)
        {
            _type = typeof(ConfirmType).TryParseEnum(Request["type"] ?? "", ConfirmType.EmpInvite);

            base.OnPreInit(e);

            if (!SecurityContext.IsAuthenticated && CoreContext.Configuration.Personal)
            {
                SetLanguage();
            }
        }
Exemplo n.º 12
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="mc"></param>
 /// <param name="prio"></param>
 /// <param name="repeat"></param>
 /// <param name="broadcast"></param>
 /// <param name="ack"></param>
 /// <param name="confirm"></param>
 public ControlField1(CemiMessageCode mc, bool extendedFrame = false, Priority prio = Priority.Normal, bool repeat = true, BroadcastType broadcast = BroadcastType.Normal, bool ack = true, ConfirmType confirm = ConfirmType.NoError)
 {
     _messageCode        = mc;
     _extendedFrame      = extendedFrame;
     _repeat             = repeat;
     _broadcast          = broadcast;
     _priority           = prio;
     _acknowledgeRequest = ack;
     _confirm            = confirm;
     ToByte();
 }
Exemplo n.º 13
0
        // GET: Confirmation
        public ActionResult Index(ConfirmSorting sortOrder = ConfirmSorting.date_desc,
                                  ConfirmType ConfirmType  = ConfirmType.All,
                                  int PageIndex            = 1)
        {
            // Set sorting params
            ViewBag.CurrentSort  = sortOrder;
            ViewBag.TypeSortParm = sortOrder == ConfirmSorting.type ? ConfirmSorting.type_desc : ConfirmSorting.type;
            ViewBag.DateSortParm = sortOrder == ConfirmSorting.date ? ConfirmSorting.date_desc : ConfirmSorting.date;
            ViewBag.SelectedType = ConfirmType;
            List <ConfirmType> ConfirmTypes = new List <ConfirmType>();

            if (ConfirmType == ConfirmType.All)
            {
                if (User.IsInRole("SystemAdmin"))
                {
                    ConfirmTypes = null;
                }
                if (User.IsInRole("AdminProfile"))
                {
                    ConfirmTypes.Add(ConfirmType.NewArtist);
                    ConfirmTypes.Add(ConfirmType.UpdateArtist);
                }
                if (User.IsInRole("AdminFinance"))
                {
                    ConfirmTypes.Add(ConfirmType.PhonePurchase);
                }
                if (User.IsInRole("AdminMusicEditor") || User.IsInRole("AdminLabel"))
                {
                    ConfirmTypes.Add(ConfirmType.NewMusic);
                    ConfirmTypes.Add(ConfirmType.UpdateMusic);
                }
            }
            else
            {
                ConfirmTypes.Add(ConfirmType);
            }

            var res = service.GetBySearch(ConfirmTypes, new PagingRequest(PageIndex, RES_IN_PAGE), sortOrder);

            if (!res.Success)
            {
                return(Json(res.Message, JsonRequestBehavior.AllowGet));
            }

            ViewBag.Page       = PageIndex;
            ViewBag.TotalPages = res.TotalPages;
            return(View(new ConfirmationViewModel()
            {
                Confirmations = res.Entities, ConfirmType = ConfirmType
            }));
        }
Exemplo n.º 14
0
        protected override void OnPreInit(EventArgs e)
        {
            _type = typeof(ConfirmType).TryParseEnum(Request["type"] ?? "", ConfirmType.EmpInvite);

            base.OnPreInit(e);

            if (!SecurityContext.IsAuthenticated && CoreContext.Configuration.Personal)
            {
                if (Request["campaign"] == "personal")
                {
                    Session["campaign"] = "personal";
                }
                SetLanguage();
            }
        }
Exemplo n.º 15
0
    // 初始化UI和获取UI的GameObjects,Components
    void CreateUI(ConfirmType type = ConfirmType.Cancel_OK_Btn)
    {
        PromptUIObj = GameObject.Instantiate(Resources.Load(PromptUIPath)) as GameObject;

        GameObject contentLabel = GameObjectUtils.DirectFind("ConfirmBox/ContentLabel", PromptUIObj);
        GameObject cancelBtn    = GameObjectUtils.DirectFind("ConfirmBox/CancelBtn", PromptUIObj);
        GameObject cancelLabel  = GameObjectUtils.DirectFind("ConfirmBox/CancelBtn/Label", PromptUIObj);
        GameObject allowBtn     = GameObjectUtils.DirectFind("ConfirmBox/ConfirmBtn", PromptUIObj);
        GameObject allowLabel   = GameObjectUtils.DirectFind("ConfirmBox/ConfirmBtn/Label", PromptUIObj);
        GameObject centerBtn    = GameObjectUtils.DirectFind("ConfirmBox/CenterBtn", PromptUIObj);
        GameObject centerLabel  = GameObjectUtils.DirectFind("ConfirmBox/CenterBtn/Label", PromptUIObj);

        ContentLabelTxt = contentLabel != null?contentLabel.GetComponent <UILabel>() : null;

        CancelLabelTxt = cancelLabel != null?cancelLabel.GetComponent <UILabel>() : null;

        AllowLabelTxt = allowLabel != null?allowLabel.GetComponent <UILabel>() : null;

        CenterLabelTxt = centerLabel != null?centerLabel.GetComponent <UILabel>() : null;

        CancelBtnListen = cancelBtn != null?cancelBtn.GetComponent <UIEventListener>() : null;

        AllowBtnListen = allowBtn != null?allowBtn.GetComponent <UIEventListener>() : null;

        CenterAllowBtnListen = centerBtn != null?centerBtn.GetComponent <UIEventListener>() : null;

        // 这里初始化不同的确认框类型
        // 这里其实可以写成 cancelBtn.SetActive(type == ConfirmType.Cancel_OK_Btn)
        if (type == ConfirmType.Cancel_OK_Btn)
        {
            cancelBtn.SetActive(true);
            allowBtn.SetActive(true);
            centerBtn.SetActive(false);
        }
        else if (type == ConfirmType.Single_OK_Btn)
        {
            cancelBtn.SetActive(false);
            allowBtn.SetActive(false);
            centerBtn.SetActive(true);
        }
        else
        {
            // none
            cancelBtn.SetActive(true);
            allowBtn.SetActive(true);
            centerBtn.SetActive(false);
        }
    }
Exemplo n.º 16
0
        public static string GetConfirmationUrlRelative(int tenantId, string email, ConfirmType confirmType, object postfix = null, Guid userId = default(Guid))
        {
            var validationKey = EmailValidationKeyProvider.GetEmailKey(tenantId, email + confirmType + (postfix ?? ""));

            var link = string.Format("confirm.aspx?type={0}&key={1}", confirmType, validationKey);

            if (!string.IsNullOrEmpty(email))
            {
                link += "&email=" + HttpUtility.UrlEncode(email);
            }

            if (userId != default(Guid))
            {
                link += "&uid=" + userId;
            }

            return(link);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            ButtonEmailAndPasswordOK.Text = Resources.Resource.EmailAndPasswordOK;
            btChangeEmail.Text            = Resources.Resource.ChangeEmail;

            var email = (Request["email"] ?? "").Trim();

            if (string.IsNullOrEmpty(email))
            {
                ShowError(Resources.Resource.ErrorNotCorrectEmail);
                return;
            }

            var type = typeof(ConfirmType).TryParseEnum(Request["type"] ?? "", ConfirmType.EmpInvite);

            Type = type;//Save to viewstate

            User = CoreContext.UserManager.GetUserByEmail(email);
            if (User.ID.Equals(Constants.LostUser.ID))
            {
                //Error. User doesn't exists.
                ShowError(string.Format(Resources.Resource.ErrorUserNotFoundByEmail, email));
                return;
            }

            Page.Title = HeaderStringHelper.GetPageTitle(Resources.Resource.Authorization);
            if (type == ConfirmType.EmailChange && !IsPostBack)
            {
                //If it's email confirmation then just activate
                emailChange.Visible = true;
                ActivateUser(User);
                AjaxPro.Utility.RegisterTypeForAjax(typeof(EmailOperationService));
                //RegisterRedirect();
            }
            else if (type == ConfirmType.PasswordChange)
            {
                passwordSetter.Visible = true;
            }

            RegisterScript();
        }
Exemplo n.º 18
0
    /// <summary>
    /// MenuConfirm
    /// </summary>
    /// <param name="hitTrans"></param>
    /// <param name="type"></param>
    /// <param name="player"></param>
    public void MenuConfirm(Transform hitTrans, ConfirmType type, Transform player = null) // confirmed by Menu panel
    {
        switch (type)                                                                      // do something by param's type
        {
        case ConfirmType.Scene:
            LoadScene(hitTrans, player);
            break;

        case ConfirmType.Pos:
            ChangePos(hitTrans, player);
            break;

        case ConfirmType.Model:
            LoadModel(hitTrans, player);
            break;

        case ConfirmType.Active:
            ActiveComponent(hitTrans, player);
            break;
        }
    }
Exemplo n.º 19
0
        /// <summary>
        /// Parse the byte and set the properties accordingly
        /// </summary>
        private void ParseData()
        {
            _broadcast          = (_rawData & 0x10) == 0x10 ? BroadcastType.Normal : BroadcastType.System;
            _confirm            = (_rawData & 0x01) == 0 ? ConfirmType.NoError : ConfirmType.Error;
            _extendedFrame      = (_rawData & 0x80) == 0;
            _acknowledgeRequest = (_rawData & 0x02) != 0;

            if (_messageCode == CemiMessageCode.LDATA_IND)
            {
                // ind: flag 0 = repeated frame, 1 = not repeated
                _repeat = (_rawData & 0x20) == 0;
            }
            else
            {
                // req, (con): flag 0 = do not repeat, 1 = default behavior
                _repeat = (_rawData & 0x20) == 0x20;
            }

            var bits = _rawData >> 2 & 0x03;

            _priority = (Priority)bits;
        }
        public static string GetConfirmationUrlRelative(int tenantId, string email, ConfirmType confirmType, object postfix = null, Guid userId = default)
        {
            var validationKey = EmailValidationKeyProvider.GetEmailKey(tenantId, email + confirmType + (postfix ?? ""));

            var link = $"confirm/{confirmType}?key={validationKey}";

            if (!string.IsNullOrEmpty(email))
            {
                link += $"&email={HttpUtility.UrlEncode(email)}";
            }

            if (userId != default)
            {
                link += $"&uid={userId}";
            }

            if (postfix != null)
            {
                link += "&p=1";
            }

            return(link);
        }
Exemplo n.º 21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Title = HeaderStringHelper.GetPageTitle(Resource.AccountControlPageTitle);

            Master.DisabledSidePanel = true;
            Master.TopStudioPanel.DisableProductNavigation = true;
            Master.TopStudioPanel.DisableUserInfo          = true;
            Master.TopStudioPanel.DisableSearch            = true;
            Master.TopStudioPanel.DisableSettings          = true;
            Master.TopStudioPanel.DisableVideo             = true;
            Master.TopStudioPanel.DisableTariff            = true;

            _tenantInfoSettings = SettingsManager.Instance.LoadSettings <TenantInfoSettings>(TenantProvider.CurrentTenantID);

            _email = Request["email"] ?? "";
            _type  = typeof(ConfirmType).TryParseEnum(Request["type"] ?? "", ConfirmType.EmpInvite);

            var tenant = CoreContext.TenantManager.GetCurrentTenant();

            if (tenant.Status != TenantStatus.Active && _type != ConfirmType.PortalContinue)
            {
                Response.Redirect(SetupInfo.NoTenantRedirectURL, true);
            }

            if (_type == ConfirmType.PhoneActivation && SecurityContext.IsAuthenticated)
            {
                Master.TopStudioPanel.DisableUserInfo = false;
            }

            if (!CheckValidationKey())
            {
                return;
            }

            LoadControls();
        }
 public static string GetConfirmationUrl(int tenantId, string email, ConfirmType confirmType, object postfix = null, Guid userId = default)
 {
     return(GetFullAbsolutePath(GetConfirmationUrlRelative(tenantId, email, confirmType, postfix, userId)));
 }
Exemplo n.º 23
0
 public bool ConfirmationLinkExists(string link, ConfirmType type)
 {
     return(_awdwareCoreDbContext.UserConfirmations.Any(
                x => (x.KeyString == link && x.ConfirmType == type)));
 }
Exemplo n.º 24
0
        private string GetConfirmLink(string email, ConfirmType confirmType)
        {
            var validationKey = EmailValidationKeyProvider.GetEmailKey(email + confirmType.ToString());

            return CommonLinkUtility.GetFullAbsolutePath("~/confirm.aspx") +
                string.Format("?type={0}&email={1}&key={2}", confirmType.ToString(), HttpUtility.UrlEncode(email), validationKey);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            var dns = Request["dns"];
            var alias = Request["alias"];

            _type = GetConfirmType();
            switch (_type)
            {
                case ConfirmType.PortalContinue:
                    _buttonTitle = Resources.Resource.ReactivatePortalButton;
                    _title = Resources.Resource.ConfirmReactivatePortalTitle;
                    break;
                case ConfirmType.PortalRemove:
                    _buttonTitle = Resources.Resource.DeletePortalButton;
                    _title = Resources.Resource.ConfirmDeletePortalTitle;
                    AjaxPro.Utility.RegisterTypeForAjax(GetType());
                    break;

                case ConfirmType.PortalSuspend:
                    _buttonTitle = Resources.Resource.DeactivatePortalButton;
                    _title = Resources.Resource.ConfirmDeactivatePortalTitle;
                    break;

                case ConfirmType.DnsChange:
                    _buttonTitle = Resources.Resource.SaveButton;
                    var portalAddress = GenerateLink(GetTenantBasePath(alias));
                    if (!string.IsNullOrEmpty(dns))
                    {
                        portalAddress += string.Format(" ({0})", GenerateLink(dns));
                    }
                    _title = string.Format(Resources.Resource.ConfirmDnsUpdateTitle, portalAddress);
                    break;
            }


            if (IsPostBack && _type != ConfirmType.PortalRemove)
            {
                _successMessage = "";

                var curTenant = CoreContext.TenantManager.GetCurrentTenant();
                var updatedFlag = false;

                var messageAction = MessageAction.None;
                switch (_type)
                {
                    case ConfirmType.PortalContinue:
                        curTenant.SetStatus(TenantStatus.Active);
                        _successMessage = string.Format(Resources.Resource.ReactivatePortalSuccessMessage, "<br/>", "<a href=\"{0}\">", "</a>");
                        break;

                    case ConfirmType.PortalSuspend:
                        curTenant.SetStatus(TenantStatus.Suspended);
                        _successMessage = string.Format(Resources.Resource.DeactivatePortalSuccessMessage, "<br/>", "<a href=\"{0}\">", "</a>");
                        messageAction = MessageAction.PortalDeactivated;
                        break;

                    case ConfirmType.DnsChange:
                        if (!string.IsNullOrEmpty(dns))
                        {
                            dns = dns.Trim().TrimEnd('/', '\\');
                        }
                        if (curTenant.MappedDomain != dns)
                        {
                            updatedFlag = true;
                        }
                        curTenant.MappedDomain = dns;
                        if (!string.IsNullOrEmpty(alias))
                        {
                            if (curTenant.TenantAlias != alias)
                            {
                                updatedFlag = true;
                            }
                            curTenant.TenantAlias = alias;
                        }
                        _successMessage = string.Format(Resources.Resource.DeactivatePortalSuccessMessage, "<br/>", "<a href=\"{0}\">", "</a>");
                        break;
                }

                bool authed = false;
                try
                {
                    if (!SecurityContext.IsAuthenticated)
                    {
                        SecurityContext.AuthenticateMe(ASC.Core.Configuration.Constants.CoreSystem);
                        authed = true;
                    }

                    #region Alias or dns update

                    if (IsChangeDnsMode)
                    {
                        if (updatedFlag)
                        {
                            CoreContext.TenantManager.SaveTenant(curTenant);
                        }
                        var redirectUrl = dns;
                        if (string.IsNullOrEmpty(redirectUrl))
                        {
                            redirectUrl = GetTenantBasePath(curTenant);
                        }
                        Response.Redirect(AddHttpToUrl(redirectUrl));
                        return;
                    }

                    #endregion


                    CoreContext.TenantManager.SaveTenant(curTenant);   
                    if (messageAction != MessageAction.None)
                    {
                        MessageService.Send(HttpContext.Current.Request, messageAction);
                    }
                }
                finally
                {
                    if (authed) SecurityContext.Logout();
                }

                var redirectLink = CommonLinkUtility.GetDefault();
                _successMessage = string.Format(_successMessage, redirectLink);

                _messageHolder.Visible = true;
                _confirmContentHolder.Visible = false;
            }
            else
            {
                _messageHolder.Visible = false;
                _confirmContentHolder.Visible = true;

                if (_type == ConfirmType.PortalRemove)
                    _messageHolderPortalRemove.Visible = true;
                else
                    _messageHolderPortalRemove.Visible = false;
            }
        }
Exemplo n.º 26
0
        private static string GenerateDnsChangeConfirmUrl(string email, string dnsName, string tenantAlias, ConfirmType confirmType)
        {
            var postfix = string.Join(string.Empty, new[] { dnsName, tenantAlias });

            var sb = new StringBuilder();

            sb.Append(CommonLinkUtility.GetConfirmationUrl(email, confirmType, postfix));
            if (!string.IsNullOrEmpty(dnsName))
            {
                sb.AppendFormat("&dns={0}", dnsName);
            }
            if (!string.IsNullOrEmpty(tenantAlias))
            {
                sb.AppendFormat("&alias={0}", tenantAlias);
            }
            return(sb.ToString());
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            var dns = Request["dns"];
            var alias = Request["alias"];

            _type = GetConfirmType();
            switch (_type)
            {
                case ConfirmType.PortalContinue:
                    _buttonTitle = Resources.Resource.ReactivatePortalButton;
                    _title = Resources.Resource.ConfirmReactivatePortalTitle;
                    break;
                case ConfirmType.PortalRemove:
                    _buttonTitle = Resources.Resource.DeletePortalButton;
                    _title = Resources.Resource.ConfirmDeletePortalTitle;
                    break;

                case ConfirmType.PortalSuspend:
                    _buttonTitle = Resources.Resource.DeactivatePortalButton;
                    _title = Resources.Resource.ConfirmDeactivatePortalTitle;
                    break;

                case ConfirmType.DnsChange:
                    _buttonTitle = Resources.Resource.SaveButton;
                    var portalAddress = GenerateLink(GetTenantBasePath(alias));
                    if (!string.IsNullOrEmpty(dns))
                    {
                        portalAddress += string.Format(" ({0})", GenerateLink(dns));
                    }
                    _title = string.Format(Resources.Resource.ConfirmDnsUpdateTitle, portalAddress);
                    break;
            }

            if (IsPostBack)
            {
                _successMessage = "";
                var curTenant = CoreContext.TenantManager.GetCurrentTenant();
                var updatedFlag = false;
                switch (_type)
                {
                    case ConfirmType.PortalContinue:
                        curTenant.SetStatus(TenantStatus.Active);
                        _successMessage = string.Format(Resources.Resource.ReactivatePortalSuccessMessage, "<br/>", "<a href=\"{0}\">", "</a>");
                        break;

                    case ConfirmType.PortalRemove:
                        curTenant.SetStatus(TenantStatus.RemovePending);
                        _successMessage = string.Format(Resources.Resource.DeletePortalSuccessMessage, "<br/>", "<a href=\"{0}\">", "</a>");
                        break;

                    case ConfirmType.PortalSuspend:
                        curTenant.SetStatus(TenantStatus.Suspended);
                        _successMessage = string.Format(Resources.Resource.DeactivatePortalSuccessMessage, "<br/>", "<a href=\"{0}\">", "</a>");
                        break;

                    case ConfirmType.DnsChange:
                        if (!string.IsNullOrEmpty(dns))
                        {
                            dns = dns.Trim().TrimEnd('/', '\\');
                        }
                        if (curTenant.MappedDomain != dns)
                        {
                            updatedFlag = true;
                        }
                        curTenant.MappedDomain = dns;
                        if (!string.IsNullOrEmpty(alias))
                        {
                            if (curTenant.TenantAlias != alias)
                            {
                                updatedFlag = true;
                            }
                            curTenant.TenantAlias = alias;
                        }
                        _successMessage = string.Format(Resources.Resource.DeactivatePortalSuccessMessage, "<br/>", "<a href=\"{0}\">", "</a>");
                        break;
                }

                bool authed = false;
                try
                {
                    if (!SecurityContext.IsAuthenticated)
                    {
                        SecurityContext.AuthenticateMe(ASC.Core.Configuration.Constants.CoreSystem);
                        authed = true;
                    }

                    #region Alias or dns update
                    if (IsChangeDnsMode)
                    {
                        if (updatedFlag)
                        {
                            CoreContext.TenantManager.SaveTenant(curTenant);
                        }
                        var redirectUrl = dns;
                        if (string.IsNullOrEmpty(redirectUrl))
                        {
                            redirectUrl = GetTenantBasePath(curTenant);
                        }
                        Response.Redirect(AddHttpToUrl(redirectUrl));
                        return;
                    }
                    #endregion

                    CoreContext.TenantManager.SaveTenant(curTenant);
                }
                finally
                {
                    if (authed) SecurityContext.Logout();
                }
                var redirectLink = CommonLinkUtility.GetDefault();

                if (_type == ConfirmType.PortalRemove)
                { 
                     var currentUser = CoreContext.UserManager.GetUsers(CoreContext.TenantManager.GetCurrentTenant().OwnerId);
                     redirectLink = SetupInfo.TeamlabSiteRedirect + "/remove-portal-feedback-form.aspx#" + 
                            Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes("{\"firstname\":\"" + currentUser.FirstName + 
                            "\",\"lastname\":\"" + currentUser.LastName +  
                            "\",\"alias\":\"" + alias + 
                            "\",\"email\":\"" + currentUser.Email +"\"}"));
                }
                _successMessage = string.Format(_successMessage, redirectLink);

                _messageHolder.Visible = true;
                _confirmContentHolder.Visible = false;
            }
            else
            {
                _messageHolder.Visible = false;
                _confirmContentHolder.Visible = true;
            }
        }
Exemplo n.º 28
0
        public static string GetConfirmationUrlRelative(int tenantId, string email, ConfirmType confirmType, object postfix = null, Guid userId = default(Guid))
        {
            var validationKey = EmailValidationKeyProvider.GetEmailKey(tenantId, email + confirmType + (postfix ?? ""));

            var link = string.Format("confirm.aspx?type={0}&key={1}", confirmType, validationKey);

            if (!string.IsNullOrEmpty(email))
            {
                link += "&email=" + HttpUtility.UrlEncode(email);
            }

            if (userId != default (Guid))
            {
                link += "&uid=" + userId;
            }

            if (postfix != null)
            {
                link += "&p=1";
            }

            return link;
        }
Exemplo n.º 29
0
 public static string GetConfirmationUrl(string email, ConfirmType confirmType, object postfix = null, Guid userId = default(Guid))
 {
     return(GetFullAbsolutePath(GetConfirmationUrlRelative(CoreContext.TenantManager.GetCurrentTenant().TenantId, email, confirmType, postfix, userId)));
 }
        private static string GenerateDnsChangeConfirmUrl(string email, string dnsName, string tenantAlias, ConfirmType confirmType)
        {
            var postfix = string.Join(string.Empty, new[] {dnsName, tenantAlias});

            var sb = new StringBuilder();
            sb.Append(CommonLinkUtility.GetConfirmationUrl(email, confirmType, postfix));
            if (!string.IsNullOrEmpty(dnsName))
            {
                sb.AppendFormat("&dns={0}", dnsName);
            }
            if (!string.IsNullOrEmpty(tenantAlias))
            {
                sb.AppendFormat("&alias={0}", tenantAlias);
            }
            return sb.ToString();
        }
Exemplo n.º 31
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var dns   = Request["dns"];
            var alias = Request["alias"];

            _type = GetConfirmType();
            switch (_type)
            {
            case ConfirmType.PortalContinue:
                _buttonTitle = Resources.Resource.ReactivatePortalButton;
                _title       = Resources.Resource.ConfirmReactivatePortalTitle;
                break;

            case ConfirmType.PortalRemove:
                _buttonTitle = Resources.Resource.DeletePortalButton;
                _title       = Resources.Resource.ConfirmDeletePortalTitle;
                AjaxPro.Utility.RegisterTypeForAjax(GetType());
                break;

            case ConfirmType.PortalSuspend:
                _buttonTitle = Resources.Resource.DeactivatePortalButton;
                _title       = Resources.Resource.ConfirmDeactivatePortalTitle;
                break;

            case ConfirmType.DnsChange:
                _buttonTitle = Resources.Resource.SaveButton;
                var portalAddress = GenerateLink(GetTenantBasePath(alias));
                if (!string.IsNullOrEmpty(dns))
                {
                    portalAddress += string.Format(" ({0})", GenerateLink(dns));
                }
                _title = string.Format(Resources.Resource.ConfirmDnsUpdateTitle, portalAddress);
                break;
            }


            if (IsPostBack && _type != ConfirmType.PortalRemove)
            {
                _successMessage = "";

                var curTenant   = CoreContext.TenantManager.GetCurrentTenant();
                var updatedFlag = false;

                var messageAction = MessageAction.None;
                switch (_type)
                {
                case ConfirmType.PortalContinue:
                    curTenant.SetStatus(TenantStatus.Active);
                    _successMessage = string.Format(Resources.Resource.ReactivatePortalSuccessMessage, "<br/>", "<a href=\"{0}\">", "</a>");
                    break;

                case ConfirmType.PortalSuspend:
                    curTenant.SetStatus(TenantStatus.Suspended);
                    _successMessage = string.Format(Resources.Resource.DeactivatePortalSuccessMessage, "<br/>", "<a href=\"{0}\">", "</a>");
                    messageAction   = MessageAction.PortalDeactivated;
                    break;

                case ConfirmType.DnsChange:
                    if (!string.IsNullOrEmpty(dns))
                    {
                        dns = dns.Trim().TrimEnd('/', '\\');
                    }
                    if (curTenant.MappedDomain != dns)
                    {
                        updatedFlag = true;
                    }
                    curTenant.MappedDomain = dns;
                    if (!string.IsNullOrEmpty(alias))
                    {
                        if (curTenant.TenantAlias != alias)
                        {
                            updatedFlag = true;
                        }
                        curTenant.TenantAlias = alias;
                    }
                    _successMessage = string.Format(Resources.Resource.DeactivatePortalSuccessMessage, "<br/>", "<a href=\"{0}\">", "</a>");
                    break;
                }

                bool authed = false;
                try
                {
                    if (!SecurityContext.IsAuthenticated)
                    {
                        SecurityContext.AuthenticateMe(ASC.Core.Configuration.Constants.CoreSystem);
                        authed = true;
                    }

                    #region Alias or dns update

                    if (IsChangeDnsMode)
                    {
                        if (updatedFlag)
                        {
                            CoreContext.TenantManager.SaveTenant(curTenant);
                        }
                        var redirectUrl = dns;
                        if (string.IsNullOrEmpty(redirectUrl))
                        {
                            redirectUrl = GetTenantBasePath(curTenant);
                        }
                        Response.Redirect(AddHttpToUrl(redirectUrl));
                        return;
                    }

                    #endregion


                    CoreContext.TenantManager.SaveTenant(curTenant);
                    if (messageAction != MessageAction.None)
                    {
                        MessageService.Send(HttpContext.Current.Request, messageAction);
                    }
                }
                finally
                {
                    if (authed)
                    {
                        SecurityContext.Logout();
                    }
                }

                var redirectLink = CommonLinkUtility.GetDefault();
                _successMessage = string.Format(_successMessage, redirectLink);

                _messageHolder.Visible        = true;
                _confirmContentHolder.Visible = false;
            }
            else
            {
                _messageHolder.Visible        = false;
                _confirmContentHolder.Visible = true;

                if (_type == ConfirmType.PortalRemove)
                {
                    _messageHolderPortalRemove.Visible = true;
                }
                else
                {
                    _messageHolderPortalRemove.Visible = false;
                }
            }
        }
Exemplo n.º 32
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var dns   = Request["dns"];
            var alias = Request["alias"];

            _type = GetConfirmType();
            switch (_type)
            {
            case ConfirmType.PortalContinue:
                _buttonTitle = Resources.Resource.ReactivatePortalButton;
                _title       = Resources.Resource.ConfirmReactivatePortalTitle;
                break;

            case ConfirmType.PortalRemove:
                _buttonTitle = Resources.Resource.DeletePortalButton;
                _title       = Resources.Resource.ConfirmDeletePortalTitle;
                break;

            case ConfirmType.PortalSuspend:
                _buttonTitle = Resources.Resource.DeactivatePortalButton;
                _title       = Resources.Resource.ConfirmDeactivatePortalTitle;
                break;

            case ConfirmType.DnsChange:
                _buttonTitle = Resources.Resource.SaveButton;
                var portalAddress = GenerateLink(GetTenantBasePath(alias));
                if (!string.IsNullOrEmpty(dns))
                {
                    portalAddress += string.Format(" ({0})", GenerateLink(dns));
                }
                _title = string.Format(Resources.Resource.ConfirmDnsUpdateTitle, portalAddress);
                break;
            }

            if (IsPostBack)
            {
                _successMessage = "";
                var curTenant   = CoreContext.TenantManager.GetCurrentTenant();
                var updatedFlag = false;

                var messageAction = MessageAction.None;
                switch (_type)
                {
                case ConfirmType.PortalContinue:
                    curTenant.SetStatus(TenantStatus.Active);
                    _successMessage = string.Format(Resources.Resource.ReactivatePortalSuccessMessage, "<br/>", "<a href=\"{0}\">", "</a>");
                    break;

                case ConfirmType.PortalRemove:
                    curTenant.SetStatus(TenantStatus.RemovePending);
                    _successMessage = string.Format(Resources.Resource.DeletePortalSuccessMessage, "<br/>", "<a href=\"{0}\">", "</a>");
                    messageAction   = MessageAction.PortalDeleted;
                    break;

                case ConfirmType.PortalSuspend:
                    curTenant.SetStatus(TenantStatus.Suspended);
                    _successMessage = string.Format(Resources.Resource.DeactivatePortalSuccessMessage, "<br/>", "<a href=\"{0}\">", "</a>");
                    messageAction   = MessageAction.PortalDeactivated;
                    break;

                case ConfirmType.DnsChange:
                    if (!string.IsNullOrEmpty(dns))
                    {
                        dns = dns.Trim().TrimEnd('/', '\\');
                    }
                    if (curTenant.MappedDomain != dns)
                    {
                        updatedFlag = true;
                    }
                    curTenant.MappedDomain = dns;
                    if (!string.IsNullOrEmpty(alias))
                    {
                        if (curTenant.TenantAlias != alias)
                        {
                            updatedFlag = true;
                        }
                        curTenant.TenantAlias = alias;
                    }
                    _successMessage = string.Format(Resources.Resource.DeactivatePortalSuccessMessage, "<br/>", "<a href=\"{0}\">", "</a>");
                    break;
                }

                bool authed = false;
                try
                {
                    if (!SecurityContext.IsAuthenticated)
                    {
                        SecurityContext.AuthenticateMe(ASC.Core.Configuration.Constants.CoreSystem);
                        authed = true;
                    }

                    #region Alias or dns update

                    if (IsChangeDnsMode)
                    {
                        if (updatedFlag)
                        {
                            CoreContext.TenantManager.SaveTenant(curTenant);
                        }
                        var redirectUrl = dns;
                        if (string.IsNullOrEmpty(redirectUrl))
                        {
                            redirectUrl = GetTenantBasePath(curTenant);
                        }
                        Response.Redirect(AddHttpToUrl(redirectUrl));
                        return;
                    }

                    #endregion

                    CoreContext.TenantManager.SaveTenant(curTenant);
                    if (messageAction != MessageAction.None)
                    {
                        MessageService.Send(HttpContext.Current.Request, messageAction);
                    }
                }
                finally
                {
                    if (authed)
                    {
                        SecurityContext.Logout();
                    }
                }
                var redirectLink = CommonLinkUtility.GetDefault();

                if (_type == ConfirmType.PortalRemove)
                {
                    var currentUser = CoreContext.UserManager.GetUsers(CoreContext.TenantManager.GetCurrentTenant().OwnerId);
                    redirectLink = SetupInfo.TeamlabSiteRedirect + "/remove-portal-feedback-form.aspx#" +
                                   Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes("{\"firstname\":\"" + currentUser.FirstName +
                                                                                             "\",\"lastname\":\"" + currentUser.LastName +
                                                                                             "\",\"alias\":\"" + alias +
                                                                                             "\",\"email\":\"" + currentUser.Email + "\"}"));
                    StudioNotifyService.Instance.SendMsgPortalDeletionSuccess(curTenant, redirectLink);
                }
                _successMessage = string.Format(_successMessage, redirectLink);


                _messageHolder.Visible        = true;
                _confirmContentHolder.Visible = false;
            }
            else
            {
                _messageHolder.Visible        = false;
                _confirmContentHolder.Visible = true;
            }
        }
Exemplo n.º 33
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Title = HeaderStringHelper.GetPageTitle(Resource.AccountControlPageTitle);

            Master.DisabledSidePanel = true;
            Master.TopStudioPanel.DisableProductNavigation = true;
            Master.TopStudioPanel.DisableUserInfo = true;
            Master.TopStudioPanel.DisableSearch = true;
            Master.TopStudioPanel.DisableSettings = true;
            Master.TopStudioPanel.DisableVideo = true;
            Master.TopStudioPanel.DisableTariff = true;

            _tenantInfoSettings = SettingsManager.Instance.LoadSettings<TenantInfoSettings>(TenantProvider.CurrentTenantID);

            _email = Request["email"] ?? "";
            _type = typeof(ConfirmType).TryParseEnum(Request["type"] ?? "", ConfirmType.EmpInvite);

            var tenant = CoreContext.TenantManager.GetCurrentTenant();
            if (tenant.Status != TenantStatus.Active && _type != ConfirmType.PortalContinue)
            {
                Response.Redirect(SetupInfo.NoTenantRedirectURL, true);
            }

            if (_type == ConfirmType.PhoneActivation && SecurityContext.IsAuthenticated)
            {
                Master.TopStudioPanel.DisableUserInfo = false;
            }

            if (!CheckValidationKey())
            {
                return;
            }

            LoadControls();
        }
Exemplo n.º 34
0
 public static string GenerateConfirmUrl(string email, ConfirmType confirmType)
 {
     var validationKey = EmailValidationKeyProvider.GetEmailKey(email + confirmType.ToString());
     return CommonLinkUtility.GetFullAbsolutePath(String.Format("~/confirm.aspx?type={2}&email={0}&key={1}", HttpUtility.UrlEncode(email), validationKey, confirmType.ToString()));
 }
Exemplo n.º 35
0
 public CemiLDataEx(CemiMessageCode messageCode, IndividualAddress srcAddress, IAddress dstAddress, byte[] tpdu,
                    Priority priority, ConfirmType confirm)
     : this(messageCode, srcAddress, dstAddress, tpdu, priority, true, BroadcastType.Normal, false, 6)
 {
 }
Exemplo n.º 36
0
 public static string GetConfirmationUrl(string email, ConfirmType confirmType, object postfix = null, Guid userId = default(Guid))
 {
     return GetFullAbsolutePath(GetConfirmationUrlRelative(CoreContext.TenantManager.GetCurrentTenant().TenantId, email, confirmType, postfix, userId));
 }
Exemplo n.º 37
0
 public static string GetConfirmationUrl(string email, ConfirmType confirmType, object postfix = null, Guid userId = default(Guid))
 {
     return GetFullAbsolutePath(GetConfirmationUrlRelative(email, confirmType, postfix, userId));
 }
Exemplo n.º 38
0
 // 创建UI
 public DownLoadPromptUI(ConfirmType type = ConfirmType.Cancel_OK_Btn)
 {
     CreateUI(type);
     AddEvts();
 }
Exemplo n.º 39
0
        private static string GenerateDnsChangeConfirmUrl(string email, string dnsName, string tenantAlias, ConfirmType confirmType)
        {
            var key           = string.Join(string.Empty, new[] { email, confirmType.ToString(), dnsName, tenantAlias });
            var validationKey = EmailValidationKeyProvider.GetEmailKey(key);

            var sb = new StringBuilder();

            sb.Append(CommonLinkUtility.GetFullAbsolutePath("~/confirm.aspx"));
            sb.AppendFormat("?email={0}&key={1}&type={2}", HttpUtility.UrlEncode(email), validationKey, confirmType.ToString());
            if (!string.IsNullOrEmpty(dnsName))
            {
                sb.AppendFormat("&dns={0}", dnsName);
            }
            if (!string.IsNullOrEmpty(tenantAlias))
            {
                sb.AppendFormat("&alias={0}", tenantAlias);
            }
            return(sb.ToString());
        }
Exemplo n.º 40
0
        private static string GenerateDnsChangeConfirmUrl(string email, string dnsName, string tenantAlias, ConfirmType confirmType)
        {
            var key = string.Join(string.Empty, new[] { email, confirmType.ToString(), dnsName, tenantAlias });
            var validationKey = EmailValidationKeyProvider.GetEmailKey(key);

            var sb = new StringBuilder();
            sb.Append(CommonLinkUtility.GetFullAbsolutePath("~/confirm.aspx"));
            sb.AppendFormat("?email={0}&key={1}&type={2}", HttpUtility.UrlEncode(email), validationKey, confirmType.ToString());
            if (!string.IsNullOrEmpty(dnsName))
            {
                sb.AppendFormat("&dns={0}", dnsName);
            }
            if (!string.IsNullOrEmpty(tenantAlias))
            {
                sb.AppendFormat("&alias={0}", tenantAlias);
            }
            return sb.ToString();
        }
Exemplo n.º 41
0
        public User ConfirmationVerify(IUnitOfWork unitOfWork, ConfirmType type, int userId, string code)
        {
            string operationName;
            switch (type)
            {
                case ConfirmType.NewUser:
                    operationName = "регистрации";
                    break;
                case ConfirmType.ResetPassword:
                    operationName = "восстановления пароля";
                    break;
                default:
                    throw new NotImplementedException();
            }

            User user = _securityUserService.GetUser(unitOfWork, userId);
            if (user == null)
            {
                throw new InvalidOperationException("Не найден пользователь");
            }
            if (user.ConfirmRequests == null || !user.ConfirmRequests.Any())
            {
                throw new InvalidOperationException(String.Format("Отсутствуют запросы {0} от пользователя {1}", operationName, user.Login));
            }

            UserConfirmRequest request = user.ConfirmRequests.FirstOrDefault(x => x.Code == code);

            if (request == null)
            {
                throw new InvalidOperationException(String.Format("Данный запрос {0} отсутствует в системе. Обратитесь к администратору.", operationName));
            }
            if (request.Used)
            {
                throw new InvalidOperationException(String.Format("Запрос {0} уже был выполнен ранее.", operationName));
            }
            if (request.ValidUntil < DateTime.Now.AddMinutes(5))
            {
                throw new InvalidOperationException(String.Format("Запрос просрочен. Воспользуйтесь функцией {0} еще раз.", operationName));
            }

            request.Used = true;
            request.UseTime = DateTime.Now;

            switch (type)
            {
                case ConfirmType.ResetPassword:
                    _ResetPasswordVerify(user);
                    break;

                case ConfirmType.NewUser:
                    _RegisterVerify(user);
                    break;
            }

            unitOfWork.SaveChanges();

            return user;
        }
Exemplo n.º 42
0
        public ActionResult VerifyConfirmation(ConfirmType type, int userId, string code)
        {
            using (var uow = _unitOfWorkFactory.Create())
            {
                try
                {
                    var user = _accountManager.ConfirmationVerify(uow, type, userId, code);
                    FormsAuthentication.SetAuthCookie(user.Login, true);

                    switch (type)
                    {
                        case ConfirmType.ResetPassword:
                            return RedirectToAction("ChangePasswordOnFirstLogon", "Account");

                        case ConfirmType.NewUser:
                            return RedirectToAction("GetViewModel", "Standart",
                                new { mnemonic = "ExtProfile", typeDialog = TypeDialog.Frame, id = user.ID });

                        default:
                            throw new NotImplementedException();
                    }
                }
                catch (Exception e)
                {
                    return View("Info", new AccountInfoModel { Title = type.GetDescription(), Message = e.Message });
                }
            }
        }