Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetTitle("基本信息 ");
            SpaceAccount = CurrentAccount;

            long spaceId = SpaceAccount.Id;

            if (Request.QueryString["back"] != null)
            {
                back = Request.QueryString["back"];
            }
            if (spaceId != 0)
            {
                if (!IsPostBack)
                {
                    SpaceAccount = CY.UME.Core.Business.Account.Load(spaceId);

                    UserInfoBind(SpaceAccount);
                }
            }
            else
            {
                Response.Redirect("~/Login.aspx");
            }
        }
Example #2
0
        /// <summary>
        /// 注册
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void LBSubmint_Click(object sender, EventArgs e)
        {
            try
            {
                if (TxtEmail.Text.Length == 0)
                {
                    return;
                }
                log.Info("注册开始");
                if (Session["CaptchaImageText"] == null)
                {
                    ShowAlert("注册失败", "服务器忙,请稍后再试!");
                    return;
                }

                string validateCode = Session["CaptchaImageText"].ToString();
                if (TxtValidCode.Text != validateCode)
                {
                    ShowAlert("注册失败", "验证码错误!");
                    return;
                }
                if (string.IsNullOrEmpty(TxtSudentCode.Text))
                {
                    ShowAlert("注册失败", "学号不能为空");
                    return;
                }
                if (string.IsNullOrEmpty(TxtUserName.Text))
                {
                    ShowAlert("注册失败", "姓名不能为空");
                    return;
                }
                if (TxtUserPassword.Text.Length < 6 ||
                    TxtUserPassword.Text.Length > 20)
                {
                    ShowAlert("注册失败", "密码长度必须在6至20之间");
                    return;
                }
                String ZipRegex = @"/^\w{0,19}$/";
                if (System.Text.RegularExpressions.Regex.IsMatch(TxtUserPassword.Text, ZipRegex))
                {
                    ShowAlert("注册失败", "密码含有非法字符,只能输入数字、字母和\"_\"的组合。");
                    return;
                }
                if (String.Compare(TxtUserPassword.Text.Trim(), TxtUserPasswordAgain.Text.Trim()) != 0)
                {
                    ShowAlert("注册失败", "两次密码输入不一致,请重新输入。");
                    return;
                }
                if (!RBGenderFemale.Checked && !RBGenderMale.Checked)
                {
                    ShowAlert("注册失败", "性别不能为空");
                    return;
                }

                if (YearHF.Value == "0" && MonthHF.Value == "0" && DayHF.Value == "0")
                {
                    ;
                }
                else if ( YearHF.Value == "0" || MonthHF.Value == "0" || DayHF.Value == "0")
                {
                    ShowAlert("提示", "请完善您的生日信息!");
                    return;
                }

                Guid id = new Guid(Request.QueryString["id"]);
                CY.UME.Core.Business.AccountInviteInfo aii = CY.UME.Core.Business.AccountInviteInfo.Load(id);
                if (aii == null)
                {
                    ShowAlert("注册失败", "邀请已失效!");
                    return;
                }

                CY.Security.SecurityHelper sh = new CY.Security.SecurityHelper();

                CY.UME.Core.Business.Account account = new CY.UME.Core.Business.Account();
                account.Code = TxtSudentCode.Text;
                account.DateCreated = DateTime.Now;
                account.HasAvatar = false;
                account.IsTeacher = false;
                account.Name = TxtUserName.Text;
                account.NickName = string.Empty;
                account.ViewNumber = 0;
                account.Save();

                // extend info
                CY.UME.Core.Business.AccountExtend ae = CY.UME.Core.Business.AccountExtend.Load(account.Id);

                if (YearHF.Value == "0" && MonthHF.Value == "0" && DayHF.Value == "0")
                {
                    ae.Birthday = UME.Core.Global.MinDateTime;
                }
                else if (YearHF.Value == "0" || MonthHF.Value == "0" || DayHF.Value == "0")
                {
                    ShowAlert("提示", "请完善您的生日信息!");
                    return;
                }
                else
                {
                    int day = 0, month = 0, year = 0;
                    if (int.TryParse(DayHF.Value, out day))
                        ae.BirthDate = day;
                    if (int.TryParse(MonthHF.Value, out month))
                        ae.BirthMonth = month;
                    if (int.TryParse(YearHF.Value, out year))
                        ae.BirthYear = year;

                    ae.Birthday = new DateTime(year, month, day);//生日
                }
                ae.Email = TxtEmail.Text;
                ae.Gender = RBGenderMale.Checked ? 1 : 0;
                ae.IsEmailChecked = true;
                //ae.LibUserId = 0;
                ae.Password = sh.ComputeMD5Hash(TxtUserPassword.Text);
                ae.UniversityId = CY.Utility.Common.ConvertUtility.ConvertToInt(selUniversity.Value, -1);// 学校
                ae.CollegeId = CY.Utility.Common.ConvertUtility.ConvertToInt(selCollege.Value, -1);// 学院
                ae.GradeId = int.Parse(DDLGrades.SelectedValue);
                ae.Save();

                // add friendship
                CY.UME.Core.Business.Friendship fs = new CY.UME.Core.Business.Friendship();
                fs.AccountId = aii.InviterId;
                fs.DateCreated = DateTime.Now;
                fs.CommunicateNum = 0;
                fs.FriendId = account.Id;
                fs.IsChecked = true;
                fs.Remark = string.Empty;
                fs.Save();

                fs = new CY.UME.Core.Business.Friendship();
                fs.AccountId = account.Id;
                fs.CommunicateNum = 0;
                fs.DateCreated = DateTime.Now;
                fs.FriendId = aii.InviterId;
                fs.IsChecked = true;
                fs.Remark = string.Empty;
                fs.Save();

                aii.IsAccepted = true;
                aii.Save();

                #region 更新邀请人的积分

                int inviteFriendCredit;
                if (CY.UME.Core.Business.SystemSetting.TryLoadInt32Setting("CreditInviteAccount", out inviteFriendCredit) &&
                    (inviteFriendCredit != 0))
                {
                    CY.UME.Core.Business.Account invitor = CY.UME.Core.Business.Account.Load(aii.InviterId);
                    if (invitor != null)
                    {
                        int orgCredit = invitor.Credit;
                        int modifiedCredit = orgCredit + inviteFriendCredit;

                        invitor.Credit = modifiedCredit;
                        invitor.Save();

                        CreditHistory ch = new CreditHistory();
                        ch.AccountId = invitor.Id;
                        ch.DateCreated = DateTime.Now;
                        ch.Id = Guid.NewGuid();
                        ch.InstanceId = aii.Id.ToString();
                        ch.Original = orgCredit;
                        ch.Modified = modifiedCredit;
                        ch.Variation = inviteFriendCredit;
                        ch.Type = "invitefriend";
                        ch.Description = "成功邀请用户 " + account.Name;
                        ch.Save();

                        // 邀请层级效应
                        CY.UME.Core.Business.Account invitor2 = invitor.GetInviter();
                        if (invitor2 != null)
                        {
                            int inviteFriendCredit2;
                            if (CY.UME.Core.Business.SystemSetting.TryLoadInt32Setting("CreditInviteAccount2", out inviteFriendCredit2) &&
                                (inviteFriendCredit2 != 0))
                            {
                                orgCredit = invitor2.Credit;
                                modifiedCredit = orgCredit + inviteFriendCredit2;
                                invitor2.Credit = modifiedCredit;
                                invitor2.Save();

                                ch = new CreditHistory();
                                ch.AccountId = invitor2.Id;
                                ch.DateCreated = DateTime.Now;
                                ch.Id = Guid.NewGuid();
                                ch.InstanceId = aii.Id.ToString();
                                ch.Original = orgCredit;
                                ch.Modified = modifiedCredit;
                                ch.Variation = inviteFriendCredit2;
                                ch.Type = "invitefriend";
                                ch.Description = "所邀请用户 " + invitor.Name + " 成功邀请了 " + account.Name;
                                ch.Save();
                            }
                        }
                    }
                }

                #endregion
                log.Info("注册结束");

                if (Session["user"] != null)
                {
                    Session["user"] = account.Id.ToString();
                }
                else
                {
                    Session.Add("user", account.Id.ToString());
                }

                ShowAlert("注册成功", "恭喜您已经成功注册UME账号,现在系统将引导您至完善个人信息页面");
                ExecuteClientScript("setTimeout(function(){window.location.href='UploadAvatar.aspx?type=firstNum'}, 2000)");
            }
            catch (Exception ex)
            {
                log.Error("用户注册失败:" + ex.Message);
            }
        }
Example #3
0
        /// <summary>
        /// 注册
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void LB_Next_Click(object sender, EventArgs e)
        {
            if (TxtEmail.Text.Length == 0)
            {
                return;
            }

            CY.UME.Core.Business.SystemLog.SaveLog("Info", "注册开始");

            if (Session["CaptchaImageText"] == null)// 验证码
            {
                ShowAlert("注册失败", "服务器忙,请稍后再试!");
                return;
            }

            string validateCode = Session["CaptchaImageText"].ToString();

            if (TxtValidCode.Text != validateCode)
            {
                ShowAlert("注册失败", "验证码错误!");
                return;
            }
            if (string.IsNullOrEmpty(TxtSudentCode.Text))
            {
                ShowAlert("注册失败", "学号不能为空");
                return;
            }
            if (string.IsNullOrEmpty(TxtUserName.Text))
            {
                ShowAlert("注册失败", "姓名不能为空");
                return;
            }
            if (TxtUserPassword.Text.Length < 6 ||
                TxtUserPassword.Text.Length > 20)
            {
                ShowAlert("注册失败", "密码长度必须在6至20之间");
                return;
            }
            String ZipRegex = @"/^\w{0,19}$/";
            if (System.Text.RegularExpressions.Regex.IsMatch(TxtUserPassword.Text, ZipRegex))
            {
                ShowAlert("注册失败", "密码含有非法字符,只能输入数字、字母和\"_\"的组合。");
                return;
            }
            if (String.Compare(TxtUserPassword.Text.Trim(), TxtUserPasswordAgain.Text.Trim()) != 0)
            {
                ShowAlert("注册失败", "两次密码输入不一致,请重新输入。");
                return;
            }
            if (!RBGenderFemale.Checked && !RBGenderMale.Checked)
            {
                ShowAlert("注册失败", "性别不能为空");
                return;
            }

            if (YearHF.Value == "0" && MonthHF.Value == "0" && DayHF.Value == "0")
            {
                ;
            }
            else if (YearHF.Value == "0" || MonthHF.Value == "0" || DayHF.Value == "0")
            {
                ShowAlert("提示", "请完善您的生日信息!");
                return;
            }

            CY.UME.Core.Business.AccountExtend aeTemp = CY.UME.Core.Business.AccountExtend.Load(TxtEmail.Text.Trim());
            if (aeTemp != null)
            {
                ShowAlert("提示", "该邮箱已被使用!");
                return;
            }

            CY.Security.SecurityHelper sh = new CY.Security.SecurityHelper();

            CY.UME.Core.Business.Account account = new CY.UME.Core.Business.Account();
            account.Code = TxtSudentCode.Text;
            account.DateCreated = DateTime.Now;
            account.HasAvatar = false;
            account.IsTeacher = false;
            account.Name = TxtUserName.Text;
            account.NickName = string.Empty;
            account.ViewNumber = 0;
            account.Save();

            // extend info
            CY.UME.Core.Business.AccountExtend ae = CY.UME.Core.Business.AccountExtend.Load(account.Id);

            if (YearHF.Value == "0" && MonthHF.Value == "0" && DayHF.Value == "0")
            {
                ae.Birthday = UME.Core.Global.MinDateTime;
            }
            else
            {
                int day = 0, month = 0, year = 0;
                if (int.TryParse(DayHF.Value, out day))
                    ae.BirthDate = day;
                if (int.TryParse(MonthHF.Value, out month))
                    ae.BirthMonth = month;
                if (int.TryParse(YearHF.Value, out year))
                    ae.BirthYear = year;

                ae.Birthday = new DateTime(year, month, day);//生日
            }
            ae.Email = TxtEmail.Text.Trim();
            ae.Gender = RBGenderMale.Checked ? 1 : 0;
            ae.IsEmailChecked = true;
            //ae.LibUserId = 0;
            ae.Password = sh.ComputeMD5Hash(TxtUserPassword.Text);
            ae.UniversityId = CY.Utility.Common.ConvertUtility.ConvertToInt(HFUniversity.Value, -1);// 学校
            ae.CollegeId = CY.Utility.Common.ConvertUtility.ConvertToInt(HFCollege.Value, -1);// 学院
            ae.GradeId = int.Parse(DDLGrades.SelectedValue);
            ae.IsShow = 0;
            ae.Save();

            try
            {
                /**************************************************废除的代码/*************************************************/
                /************************MySQL数据库同步开始*************************
                CY.UME.Core.Business.Ask_members members = new CY.UME.Core.Business.Ask_members();
                members.Id = account.Id;
                members.Username = ae.Email;
                members.Password = ae.Password;
                //members.Secques = "";
                members.Save();

                CY.UME.Core.Business.Ask_memberfields memberfields = new CY.UME.Core.Business.Ask_memberfields();
                memberfields.Id = account.Id;
                memberfields.Username = ae.Email;
                memberfields.Email = ae.Email;
                memberfields.Nickname = account.NickName;
                memberfields.Realname = account.Name;//HFURLEncodeName.Value;
                memberfields.Gender = ae.Gender;
                memberfields.Birthday = 0;
                memberfields.Score = 200;//后面去改
                memberfields.Save();
                /************************MySQL数据库同步结束*************************/
            }
            catch (Exception ex)
            {
                CY.UME.Core.Business.SystemLog.SaveLog("Error", "用户同步失败:" + ex.Message);
            }

            CY.UME.Core.Business.SystemLog.SaveLog("Info", account.Name + "注册成功");

            if (Session["user"] != null)
            {
                Session["user"] = account.Id.ToString();
            }
            else
            {
                Session.Add("user", account.Id.ToString());
            }
            try
            {
                if (!string.IsNullOrEmpty(Request.QueryString["inviterId"]))
                {
                    long inviterId = CY.Utility.Common.ConvertUtility.ConvertToLong(Request.QueryString["inviterId"], -1);

                    if (inviterId != -1)
                    {
                        Core.Business.Account InviteFriendAccount = Core.Business.Account.Load(inviterId);

                        if (InviteFriendAccount != null)
                        {//邀请用户须存在
                            AccountInviteInfo ai = new AccountInviteInfo();
                            ai.Id = Guid.NewGuid();
                            ai.InviterId = inviterId;
                            ai.InviteeEmail = ae.Email;
                            ai.DateCreated = account.DateCreated;
                            ai.IsAccepted = true;
                            ai.Remark = "从活动过来的";
                            ai.Save();

                            CY.UME.Core.Business.Friendship fs = new Friendship();

                            fs.AccountId = account.Id;
                            fs.DateCreated = DateTime.Now;
                            fs.FriendId = InviteFriendAccount.Id;
                            fs.IsChecked = true;
                            fs.Remark = "活动邀请";
                            fs.Save();

                            CY.UME.Core.Business.Friendship fs2 = new Friendship();

                            fs2.AccountId = InviteFriendAccount.Id;
                            fs2.FriendId = account.Id;
                            fs2.DateCreated = DateTime.Now;
                            fs2.IsChecked = true;
                            fs2.Remark = "活动邀请";
                            fs2.Save();
                        }
                    }
                }
                if (!string.IsNullOrEmpty(Request.QueryString["invId"]))
                {
                    long invId = CY.Utility.Common.ConvertUtility.ConvertToLong(Request.QueryString["invId"], -1);

                    if (invId != -1)
                    {
                        Core.Business.AccountInviteInfo InviteAccount = new AccountInviteInfo();
                        InviteAccount.Id = Guid.NewGuid();
                        InviteAccount.InviterId = invId;
                        InviteAccount.DateCreated = DateTime.Now;
                        InviteAccount.InviteeEmail = ae.Email;
                        InviteAccount.IsAccepted = true;
                        InviteAccount.Save();

                        #region 更新邀请人的积分

                        int inviteFriendCredit;
                        if (CY.UME.Core.Business.SystemSetting.TryLoadInt32Setting("CreditInviteAccount", out inviteFriendCredit) &&
                            (inviteFriendCredit != 0))
                        {
                            CY.UME.Core.Business.Account invitor = CY.UME.Core.Business.Account.Load(invId);
                            if (invitor != null)
                            {
                                CY.UME.Core.Business.Friendship fs = new Friendship();

                                fs.AccountId = account.Id;
                                fs.DateCreated = DateTime.Now;
                                fs.FriendId = invitor.Id;
                                fs.IsChecked = true;
                                fs.Remark = "被链接邀请";
                                fs.Save();

                                CY.UME.Core.Business.Friendship fs2 = new Friendship();

                                fs2.AccountId = invitor.Id;
                                fs2.FriendId = account.Id;
                                fs2.DateCreated = DateTime.Now;
                                fs2.IsChecked = true;
                                fs2.Remark = "链接邀请";
                                fs2.Save();

                                int orgCredit = invitor.Credit;
                                int modifiedCredit = orgCredit + inviteFriendCredit;

                                invitor.Credit = modifiedCredit;
                                invitor.Save();

                                CreditHistory ch = new CreditHistory();
                                ch.AccountId = invitor.Id;
                                ch.DateCreated = DateTime.Now;
                                ch.Id = Guid.NewGuid();
                                ch.InstanceId = invId.ToString();
                                ch.Original = orgCredit;
                                ch.Modified = modifiedCredit;
                                ch.Variation = inviteFriendCredit;
                                ch.Type = "invitefriend";
                                ch.Description = "成功邀请用户 " + account.Name;
                                ch.AssistAccountId = account.Id;
                                ch.Save();

                                // 邀请层级效应
                                CY.UME.Core.Business.Account invitor2 = invitor.GetInviter();
                                if (invitor2 != null)
                                {
                                    int inviteFriendCredit2;
                                    if (CY.UME.Core.Business.SystemSetting.TryLoadInt32Setting("CreditInviteAccount2", out inviteFriendCredit2) &&
                                        (inviteFriendCredit2 != 0))
                                    {
                                        orgCredit = invitor2.Credit;
                                        modifiedCredit = orgCredit + inviteFriendCredit2;
                                        invitor2.Credit = modifiedCredit;
                                        invitor2.Save();

                                        ch = new CreditHistory();
                                        ch.AccountId = invitor2.Id;
                                        ch.DateCreated = DateTime.Now;
                                        ch.Id = Guid.NewGuid();
                                        ch.InstanceId = invId.ToString();
                                        ch.Original = orgCredit;
                                        ch.Modified = modifiedCredit;
                                        ch.Variation = inviteFriendCredit2;
                                        ch.Type = "invitefriend";
                                        ch.Description = "所邀请用户 " + invitor.Name + " 成功邀请了 " + account.Name;
                                        ch.Save();
                                    }
                                }
                            }
                        }

                        #endregion
                    }
                }

            }
            catch (Exception)
            { }

            //ShowAlert("注册成功", "恭喜您已经成功注册UME账号,现在系统将引导您至完善个人信息页面");
            //ExecuteClientScript("setTimeout(function(){window.location.href='UploadAvatar.aspx?type=firstNum'}, 1000)")
            SaveAccountCookie(TxtEmail.Text.Trim(), sh.ComputeMD5Hash(TxtUserPassword.Text));//保存Cookie用于问问吧登录
            Server.Transfer("UploadAvatar.aspx?type=firstNum");
        }
Example #4
0
        protected void Save_OnClick(object sender, EventArgs e)
        {
            if (TbxAccountName.Text.Trim().Length == 0)
            {
                Response.Write("<script language='javascript'>alert('请输入用户姓名!');</script>");
                return;
            }

            CY.UME.Core.Business.Account account = CY.UME.Core.Business.Account.Load(SpaceAccount.Id);
            CY.UME.Core.Business.AccountExtend accountExtend = account.ExtendInfo;
            int originalInfoIntegrity = account.GetInfoIntegrity();

            account.Name = TbxAccountName.Text.Trim();//姓名
            account.NickName = TBXNickName.Text.Trim();//昵称

            if (YearHF.Value == "0" && MonthHF.Value == "0" && DayHF.Value == "0")
            {
                accountExtend.Birthday = UME.Core.Global.MinDateTime;
            }
            else if (YearHF.Value == "0" || MonthHF.Value == "0" || DayHF.Value == "0")
            {
                Response.Write("<script language='javascript'>alert('请完善您的生日信息!');</script>");
                return;
            }
            else
            {
                int day = 0, month = 0, year = 0;
                if (int.TryParse(DayHF.Value, out day))
                    accountExtend.BirthDate = day;
                if (int.TryParse(MonthHF.Value, out month))
                    accountExtend.BirthMonth = month;
                if (int.TryParse(YearHF.Value, out year))
                    accountExtend.BirthYear = year;

                accountExtend.Birthday = new DateTime(year, month, day);//生日
            }
            if (RBLGenderMan.Checked)//性别
            {
                accountExtend.Gender = 1;
            }
            else if (RBLGenderWoman.Checked)
            {
                accountExtend.Gender = 0;
            }
            else
            {
                accountExtend.Gender = -1;
            }

            accountExtend.HometownProvinceId = provinceCityHome.ProvinceId;//家乡城市
            accountExtend.HometownCityId = provinceCityHome.CityId;//家乡省份
            accountExtend.ResideCityId = provinceCityAddress.CityId;//所在地城市
            accountExtend.ResideProvinceId = provinceCityAddress.ProvinceId;//所在地省份
            accountExtend.BloodType = DDLBloodType.SelectedValue;//血型

            try
            {
                account.Save();
                accountExtend.Save();

                if (originalInfoIntegrity < 90)
                {
                    int currentInfoIntegrity = account.GetInfoIntegrity();
                    if (currentInfoIntegrity >= 90)
                    {
                        #region 首次完善个人资料,赠送积分

                        int editProfileCredit;
                        if (CY.UME.Core.Business.SystemSetting.TryLoadInt32Setting("CreditAddInfo", out editProfileCredit) &&
                            (editProfileCredit != 0))
                        {
                            int creditHistoriesCount = CreditHistory.GetCreditHistoryCount(
                                "editeprofile",
                                account.Id,
                                new long?(),
                                string.Empty,
                                new DateTime?(),
                                new DateTime?()
                            ); // 由完善资料而获得的积分次数

                            if (creditHistoriesCount == 0)
                            {
                                int orgCredit = account.Credit;
                                int modifiedCredit = orgCredit + editProfileCredit;
                                account.Credit = modifiedCredit;
                                account.Save();

                                CreditHistory ch = new CreditHistory();
                                ch.AccountId = account.Id;
                                ch.DateCreated = DateTime.Now;
                                ch.Id = Guid.NewGuid();
                                ch.InstanceId = "";
                                ch.Original = orgCredit;
                                ch.Modified = modifiedCredit;
                                ch.Variation = editProfileCredit;
                                ch.Type = "editeprofile";
                                ch.Description = "完善个人资料";
                                ch.Save();
                            }
                        }

                        #endregion

                    }
                }

                //Response.Write("<script language='javascript'>alert('您的基本信息更新成功!');</script>");
                LblFinish.Text = "<span style='color:#ff0000;'>你的基本信息更新成功!</span>";
                UserInfoBind(account);
                SpaceAccount = account;
            }
            catch
            {
                throw new Exception("保存失败");
            }
            if (back == "guide")
            {
                Response.Redirect("Guide2.aspx");
            }
        }
Example #5
0
        void HandleAutoLogin()
        {
            CY.UME.Core.Business.Account account;

            account = CY.UME.Core.Global.GetCurrentAccount();

            if (account != null)
            {
                HF_AccountId.Value = account.Id.ToString();
                LBL_UserName.Text = account.Name;
                LBL_Email.Text = account.Email;

                LBL_Login.Text = "<a href='Home.aspx?uid=" + account.Id + "'>" + account.Name + "</a> | <a href='javascript:void(0);' id='logout'>退出</a>";

                //base.ExecuteClientScript("$('#logout').click(function(){if(confirm('你确定要退出吗?')){window.location.href='logout';}}).removeAttr('id');");
            }

            if (Request.Cookies["sid"] == null)
            {
                return;
            }

            String sid = Request.Cookies["sid"].Value;
            string[] sa = sid.Split(':');
            if (sa.Length == 4)
            {
                CY.Security.SecurityHelper sh = new CY.Security.SecurityHelper();

                try
                {
                    string email;
                    string password;
                    string ip;
                    string expectedIP = sh.ComputeMD5Hash(CY.Utility.Common.RequestUtility.ClientIP);
                    DateTime dateExpire;

                    email = sh.Decrypt(sa[0], CY.Security.EncryptionAlgorithm.TripleDes);
                    password = sh.Decrypt(sa[1], CY.Security.EncryptionAlgorithm.TripleDes);
                    string dt = sh.Decrypt(sa[2], CY.Security.EncryptionAlgorithm.TripleDes);
                    ip = sa[3];

                    if (expectedIP != ip)
                    {
                        return;
                    }

                    long tick;
                    if (long.TryParse(dt, out tick))
                    {
                        dateExpire = new DateTime(tick);
                        if (dateExpire > DateTime.Now)
                        {
                            bool valid = CY.UME.Core.Business.Account.IsLoginValid(email, password, out account);
                            if (valid)
                            {
                                Session.Add("user", account.Id.ToString());
                                SaveAccountCookie(email, password);//保存Cookie用于问问吧登录

                                AddLoginCredit(account);
                                int num = CY.UME.Core.Business.Friendship.GetFriendshipCount(account) + CY.UME.Core.Business.Friendship.GetRequestFriendShipCount(account);
                                if (num <= 1)
                                {
                                    Response.Redirect("~/Index.aspx");
                                    return;
                                }
                                else
                                {
                                    HttpCookie CurrentUrl = CY.Utility.Common.RequestUtility.GetCookie("CurrentUrl");
                                    if (CurrentUrl != null)
                                    {
                                        Response.Redirect(CurrentUrl.Value);//转到用户之前登录的页面
                                        return;
                                    }
                                    else
                                    {
                                        Response.Redirect("~/Index");
                                        return;
                                    }
                                }
                            }
                        }
                    }
                }
                catch { }
            }
        }