Example #1
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            try
            {
                var thirdLoginInfo = new ThirdLoginInfo();
                if (_thirdLoginId > 0)
                {
                    thirdLoginInfo = BaiRongDataProvider.ThirdLoginDao.GetThirdLoginInfo(_thirdLoginId);
                }

                thirdLoginInfo.ThirdLoginName = tbThirdLoginName.Text;

                var authInfo = new ThirdLoginAuthInfo(thirdLoginInfo.SettingsXml)
                {
                    AppKey    = tbLoginAuthAppKey.Text,
                    AppSercet = tbLoginAuthAppSercet.Text
                };
                ;
                authInfo.CallBackUrl = tbLoginAuthCallBackUrl.Text;;

                thirdLoginInfo.SettingsXml = authInfo.ToString();

                thirdLoginInfo.Description = breDescription.Text;
                thirdLoginInfo.IsEnabled   = true;//设置成功之后,启用

                if (_thirdLoginId > 0)
                {
                    BaiRongDataProvider.ThirdLoginDao.Update(thirdLoginInfo);
                }
                else
                {
                    BaiRongDataProvider.ThirdLoginDao.Insert(thirdLoginInfo);
                }

                SuccessMessage("配置登录方式成功!");

                AddWaitAndRedirectScript(PageThirdLogin.GetRedirectUrl());
            }
            catch (Exception ex)
            {
                FailMessage(ex, ex.Message);
            }
        }
Example #2
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            _thirdLoginId = Body.GetQueryInt("thirdLoginID");

            if (!IsPostBack)
            {
                BreadCrumbUser(AppManager.User.LeftMenu.UserConfiguration, "授权登录管理", AppManager.User.Permission.UserConfiguration);

                //var publishmentSystemUrl = AssetsUtils.GetUrl(PageUtils.GetApiUrl(), "iframe/authLogin.html");
                var publishmentSystemUrl = string.Empty;
                ltlLoginAuthCallBackUrl.Text = "<span style='color:red;'>" + publishmentSystemUrl + "</span>";
                tbLoginAuthCallBackUrl.Text  = publishmentSystemUrl;
                if (_thirdLoginId > 0)
                {
                    var thirdLoginInfo = BaiRongDataProvider.ThirdLoginDao.GetThirdLoginInfo(_thirdLoginId);
                    if (thirdLoginInfo != null)
                    {
                        tbThirdLoginName.Text  = thirdLoginInfo.ThirdLoginName;
                        ltlThirdLoginType.Text = EThirdLoginTypeUtils.GetText(thirdLoginInfo.ThirdLoginType);

                        var authInfo = new ThirdLoginAuthInfo(thirdLoginInfo.SettingsXml);

                        phLoginAuth.Visible         = true;
                        tbLoginAuthAppKey.Text      = authInfo.AppKey;
                        tbLoginAuthAppSercet.Text   = authInfo.AppSercet;
                        tbLoginAuthCallBackUrl.Text = authInfo.CallBackUrl;

                        breDescription.Text = thirdLoginInfo.Description;
                    }
                }
            }
        }
Example #3
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            if (Body.IsQueryExists("isInstall") && Body.IsQueryExists("thirdLoginType"))
            {
                var thirdLoginType = EThirdLoginTypeUtils.GetEnumType(Body.GetQueryString("thirdLoginType"));

                if (!BaiRongDataProvider.ThirdLoginDao.IsExists(thirdLoginType))
                {
                    //安装之后,默认不可用
                    var thirdLoginInfo = new ThirdLoginInfo(0, thirdLoginType, EThirdLoginTypeUtils.GetText(thirdLoginType), false, 0, EThirdLoginTypeUtils.GetDescription(thirdLoginType), string.Empty);

                    BaiRongDataProvider.ThirdLoginDao.Insert(thirdLoginInfo);
                    //安装之后,直接跳转到设置页面
                    Response.Redirect(PageThirdLoginConfiguration.GetRedirectUrl((int)thirdLoginType));
                    //base.SuccessMessage("登录方式安装成功");
                }
            }
            else if (Body.IsQueryExists("isDelete") && Body.IsQueryExists("thirdLoginID"))
            {
                var thirdLoginId = Body.GetQueryInt("thirdLoginID");
                if (thirdLoginId > 0)
                {
                    BaiRongDataProvider.ThirdLoginDao.Delete(thirdLoginId);
                    SuccessMessage("登录方式删除成功");
                }
            }
            else if (Body.IsQueryExists("isEnable") && Body.IsQueryExists("thirdLoginID"))
            {
                var thirdLoginId = Body.GetQueryInt("thirdLoginID");
                if (thirdLoginId > 0)
                {
                    var thirdLoginInfo = BaiRongDataProvider.ThirdLoginDao.GetThirdLoginInfo(thirdLoginId);
                    if (thirdLoginInfo != null)
                    {
                        var authInfo = new ThirdLoginAuthInfo(thirdLoginInfo.SettingsXml);
                        if (string.IsNullOrEmpty(authInfo.AppKey) || string.IsNullOrEmpty(authInfo.AppSercet) || string.IsNullOrEmpty(authInfo.CallBackUrl))
                        {
                            FailMessage("请先对第三方登录方式进行设置,设置之后才能启用!");
                        }
                        else
                        {
                            var action = thirdLoginInfo.IsEnabled ? "禁用" : "启用";
                            thirdLoginInfo.IsEnabled = !thirdLoginInfo.IsEnabled;
                            BaiRongDataProvider.ThirdLoginDao.Update(thirdLoginInfo);
                            SuccessMessage($"成功{action}登录方式");
                        }
                    }
                }
            }
            else if (Body.IsQueryExists("setTaxis"))
            {
                var thirdLoginId = Body.GetQueryInt("thirdLoginID");
                var direction    = Body.GetQueryString("direction");
                if (thirdLoginId > 0)
                {
                    switch (direction.ToUpper())
                    {
                    case "UP":
                        BaiRongDataProvider.ThirdLoginDao.UpdateTaxisToUp(thirdLoginId);
                        break;

                    case "DOWN":
                        BaiRongDataProvider.ThirdLoginDao.UpdateTaxisToDown(thirdLoginId);
                        break;
                    }
                    SuccessMessage("排序成功!");
                    AddWaitAndRedirectScript(GetRedirectUrl());
                }
            }

            if (!IsPostBack)
            {
                BreadCrumbUser(AppManager.User.LeftMenu.UserConfiguration, "授权登录管理", AppManager.User.Permission.UserConfiguration);

                _thirdLoginInfoList = BaiRongDataProvider.ThirdLoginDao.GetThirdLoginInfoList();

                rptInstalled.DataSource     = _thirdLoginInfoList;
                rptInstalled.ItemDataBound += rptInstalled_ItemDataBound;
                rptInstalled.DataBind();

                rptUnInstalled.DataSource     = EThirdLoginTypeUtils.GetEThirdLoginTypeList();
                rptUnInstalled.ItemDataBound += rptUnInstalled_ItemDataBound;
                rptUnInstalled.DataBind();
            }
        }