Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AjaxPro.Utility.RegisterTypeForAjax(GetType());
            Page.RegisterBodyScripts("~/usercontrols/Management/SmsControls/js/SmsValidation.js");

            SmsEnable = StudioSmsNotificationSettings.IsVisibleSettings && SmsProviderManager.Enabled();

            HelpLink = CommonLinkUtility.GetHelpLink();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            AjaxPro.Utility.RegisterTypeForAjax(GetType());
            Page.RegisterBodyScripts("~/UserControls/Management/SmsControls/js/smsvalidation.js");

            SmsVisible        = StudioSmsNotificationSettings.IsVisibleSettings;
            SmsAvailable      = StudioSmsNotificationSettings.IsAvailableSettings;
            SmsEnable         = SmsAvailable && SmsProviderManager.Enabled();
            TfaAppEnable      = TfaAppAuthSettings.IsVisibleSettings;
            ThirdPartyVisible = SetupInfo.IsVisibleSettings(ManagementType.ThirdPartyAuthorization.ToString());

            HelpLink = CommonLinkUtility.GetHelpLink();
        }
Ejemplo n.º 3
0
        public bool SmsSettings(bool enable)
        {
            SecurityContext.DemandPermissions(SecutiryConstants.EditPortalSettings);

            if (!StudioSmsNotificationSettings.IsVisibleSettings)
            {
                throw new Exception(Resource.SmsNotAvailable);
            }

            if (enable && !SmsProviderManager.Enabled())
            {
                throw new MethodAccessException();
            }

            StudioSmsNotificationSettings.Enable = enable;

            MessageService.Send(Request, MessageAction.TwoFactorAuthenticationSettingsUpdated);

            return(StudioSmsNotificationSettings.Enable);
        }
        public bool TfaSettings(TfaModel model)
        {
            SecurityContext.DemandPermissions(Tenant, SecutiryConstants.EditPortalSettings);

            var result = false;

            MessageAction action;

            switch (model.Type)
            {
            case "sms":
                if (!StudioSmsNotificationSettings.IsVisibleSettings)
                {
                    throw new Exception(Resource.SmsNotAvailable);
                }

                if (!SmsProviderManager.Enabled())
                {
                    throw new MethodAccessException();
                }

                StudioSmsNotificationSettings.Enable = true;
                action = MessageAction.TwoFactorAuthenticationEnabledBySms;

                if (TfaAppAuthSettings.Enable)
                {
                    TfaAppAuthSettings.Enable = false;
                }

                result = true;

                break;

            case "app":
                if (!TfaAppAuthSettings.IsVisibleSettings)
                {
                    throw new Exception(Resource.TfaAppNotAvailable);
                }

                TfaAppAuthSettings.Enable = true;
                action = MessageAction.TwoFactorAuthenticationEnabledByTfaApp;

                if (StudioSmsNotificationSettings.IsVisibleSettings && StudioSmsNotificationSettings.Enable)
                {
                    StudioSmsNotificationSettings.Enable = false;
                }

                result = true;

                break;

            default:
                if (TfaAppAuthSettings.Enable)
                {
                    TfaAppAuthSettings.Enable = false;
                }

                if (StudioSmsNotificationSettings.IsVisibleSettings && StudioSmsNotificationSettings.Enable)
                {
                    StudioSmsNotificationSettings.Enable = false;
                }

                action = MessageAction.TwoFactorAuthenticationDisabled;

                break;
            }

            if (result)
            {
                CookiesManager.ResetTenantCookie(HttpContext);
            }

            MessageService.Send(action);
            return(result);
        }