예제 #1
0
        //[HttpPost]
        public string UpdateLoginPwd(string email, string pwd)
        {
            //根据邮箱获得用户
            if (Session["emailSet"] != null)
            {
                if (Session["emailSet"].ToString() == email)
                {
                    var User = adb.Users.Where(a => a.Email == email).FirstOrDefault();
                    if (pwd == User.TradePwd)
                    {
                        return("交易密码和登陆密码不能相同!");
                    }
                    var             result = UserManager.CreateAsync(User, pwd);//密码转码准备添加
                    ApplicationUser u      = new ApplicationUser
                    {
                        Id                   = User.Id,
                        IdNumber             = User.IdNumber,//身份证号
                        IsAllowToTrade       = User.IsAllowToTrade,
                        RegisterTime         = User.RegisterTime,
                        TradePwd             = User.TradePwd,     //交易密码
                        Email                = email,             //邮箱
                        EmailConfirmed       = User.EmailConfirmed,
                        PasswordHash         = User.PasswordHash, //登录密码
                        SecurityStamp        = User.SecurityStamp,
                        PhoneNumber          = User.PhoneNumber,  //手机号
                        PhoneNumberConfirmed = User.PhoneNumberConfirmed,
                        TwoFactorEnabled     = User.TwoFactorEnabled,
                        LockoutEnabled       = User.LockoutEnabled,
                        AccessFailedCount    = User.AccessFailedCount,
                        UserName             = User.UserName,
                        IdNumberType         = User.IdNumberType, //证件类型
                        RealityName          = User.RealityName,  //真实姓名
                        IdentiTime           = User.IdentiTime    //认证时间
                    };

                    bool r = dbm.UpdateUser(u);
                    if (r == true)
                    {
                        return("1");
                    }
                    else
                    {
                        return("0");
                    }
                    //if (r.ToString() == "True" || r == true)
                    //{
                    //    return RedirectToAction("Login");
                    //}
                    //return View();
                }
                else
                {
                    return("0");
                }
            }
            else
            {
                return("0");
            }
        }
예제 #2
0
        //async Task<IdentityResult> Ctrate(ApplicationUser u, string Lnpwd)
        //{

        //    return result;
        //}

        //公用的修改
        bool DefaultUpdate(ApplicationUser User, string tpwd, string email, string lpwd, string phone, string idenNumType, string idenNum, string Realityname, string rzTime, string tcount)
        {
            ApplicationUser u = new ApplicationUser
            {
                Id                   = User.Id,
                IdNumber             = idenNum,//身份证号
                IsAllowToTrade       = User.IsAllowToTrade,
                RegisterTime         = User.RegisterTime,
                TradePwd             = tpwd,  //交易密码
                Email                = email, //邮箱
                EmailConfirmed       = User.EmailConfirmed,
                PasswordHash         = lpwd,  //登录密码
                SecurityStamp        = User.SecurityStamp,
                PhoneNumber          = phone, //手机号
                PhoneNumberConfirmed = User.PhoneNumberConfirmed,
                TwoFactorEnabled     = User.TwoFactorEnabled,
                LockoutEnabled       = User.LockoutEnabled,
                AccessFailedCount    = User.AccessFailedCount,
                UserName             = User.UserName,
                IdNumberType         = idenNumType, //证件类型
                RealityName          = Realityname, //真实姓名
                IdentiTime           = rzTime,      //认证时间
                tradePwdCount        = tcount,
                Uiden                = User.Uiden,
                InviteBonusSum       = User.InviteBonusSum,
                InviteCount          = User.InviteCount,
                InviteFeeSum         = User.InviteFeeSum,
                InvitorFeeRatio      = User.InvitorFeeRatio,
                InvitorId            = User.InvitorId,
                IsInvitor            = User.IsInvitor,
                LastTransferFeeTime  = User.LastTransferFeeTime
            };
            bool r = dbm.UpdateUser(u);

            return(r);
        }