Exemplo n.º 1
0
        public override void doResponse(OperationRequest operationRequest, SendParameters sendParameters, MyClientPeer peer)
        {
            //信息提取
            Dictionary <byte, object> parameter = operationRequest.Parameters;
            String userName = (String)DictionaryUtils.getValue <byte, object>(parameter, (byte)ParameterCode.UserName);
            String password = (String)DictionaryUtils.getValue <byte, object>(parameter, (byte)ParameterCode.Password);

            Application.logger.Info("===================" + userName + " " + password + "尝试登录===========================");

            //检查注册结果
            Dictionary <byte, object> responseParameter = new Dictionary <byte, object>();
            int result = UserInfoServices.register(userName, password);

            if (result == 0)
            {
                responseParameter.Add((byte)ParameterCode.RegisterResult, 0);
                Application.logger.Info("===================" + userName + " " + password + "注册失败===========================");
            }
            else if (result == 1)
            {
                responseParameter.Add((byte)ParameterCode.RegisterResult, 1);
                Application.logger.Info("===================" + userName + " " + password + "注册成功===========================");
            }
            else
            {
                responseParameter.Add((byte)ParameterCode.RegisterResult, 2);
                Application.logger.Info("===================" + userName + " " + password + "注册失败===========================");
            }

            //响应客户端
            OperationResponse operationResponse = new OperationResponse((byte)OPCode.Register, responseParameter);

            peer.SendOperationResponse(operationResponse, sendParameters);
        }
Exemplo n.º 2
0
        //验证并绑定邮箱
        public ActionResult binDingEmail(string uid, string code)
        {
            UserInfo user = UserInfoServices.LoadEntities(u => u.Uid == uid && u.IsValid == vaildNo && u.EmailCode == code).FirstOrDefault();

            DateTime sendEmail = (DateTime)user.SendEmailTime;

            int hours = DateTime.Now.Hour - sendEmail.Hour;

            if (user == null || hours >= 24)
            {
                return(Redirect("/others/ShowMsg?OldUrl=/Account/BinDingEmailByUidAndEmail&NewUrl=/Account/Register&PointMsg=+" + Server.UrlEncode("邮箱验证码已过期,请重新绑定邮箱") + "&NewTitle=" + Server.UrlEncode("绑定邮箱界面")));
            }

            user.DelFalg   = deleteNo;
            user.IsValid   = vaildYes;
            user.EmailCode = "";

            //if (UserInfoServices.Update(user))
            //{

            UserInfoServices.Update(user);
            Session["model"] = user;
            return(Redirect("/OrderCenter/Home"));
            //}
            //else
            //{
            //    return Redirect("/others/ShowMsg?OldUrl=/Account/Register&NewUrl=/Account/Register&PointMsg=+" + Server.UrlEncode("邮箱验证码已过期,请重新绑定邮箱") + "&NewTitle=" + Server.UrlEncode("绑定邮箱界面"));
            //}
        }
Exemplo n.º 3
0
 /// <summary>
 /// 更新当前用户是否启用Channel关联,用于UserManagement-OpenChannel的操作
 /// Author:Lee,Date:2013年11月2日12:12:27
 /// </summary>
 /// <param name="User_Guid"></param>
 /// <param name="IsChannelControl"></param>
 /// <returns></returns>
 public ActionResult UpdateUserChannelControl(Guid User_Guid, bool IsChannelControl)
 {
     try
     {
         var uSvr = new UserInfoServices();
         if (uSvr.UpdateUserChannelControl(User_Guid, IsChannelControl))
         {
             return(Json(new NBCMSResultJson
             {
                 Status = StatusType.OK,
                 Data = "OK"
             }));
         }
         return(Json(new NBCMSResultJson
         {
             Status = StatusType.Error,
             Data = "fail to update this item!"
         }));
     }
     catch (Exception ex)
     {
         NBCMSLoggerManager.Error(ex.Message);
         NBCMSLoggerManager.Error(ex.Source);
         NBCMSLoggerManager.Error(ex.StackTrace);
         NBCMSLoggerManager.Error("");
         return(Json(new NBCMSResultJson
         {
             Status = StatusType.Exception,
             Data = ex.Message
         }));
     }
 }
Exemplo n.º 4
0
        public ActionResult ReGetPwd(string uid, string Pwd1, string Pwd2, string code)
        {
            if (string.IsNullOrEmpty(Pwd1))
            {
                return(Content("请输入密码"));
            }

            if (Pwd1 != Pwd2)
            {
                return(Content("两次密码输入不一致"));
            }

            if (Session["ValidateCode"].ToString() != code)
            {
                return(Content("验证码输入不一致"));
            }

            UserInfo user = UserInfoServices.LoadEntities(u => u.Uid == uid && u.IsValid == vaildYes && u.DelFalg == deleteNo).FirstOrDefault();

            if (user == null)
            {
                return(Content("重置密码失败"));
            }

            user.Pwd       = CommonHelper.GetStringMD5(Pwd1.ToLower());
            user.EmailCode = "";
            UserInfoServices.Update(user);

            Session["model"] = user;

            return(Content("ok"));
        }
Exemplo n.º 5
0
 /// <summary>
 /// 更新当前用户对于的Channel信息,用户User Management模块的Channel Setting
 /// Author:Lee Date:2013年11月1日18:06:15
 /// </summary>
 /// <param name="User_Guid"></param>
 /// <param name="ArrChannels"></param>
 /// <returns></returns>
 public ActionResult UpdateUserChannel(Guid User_Guid, IEnumerable <int> ArrChannels)
 {
     try
     {
         var uSvr      = new UserInfoServices();
         var isPudated = uSvr.UpdateUserChannel(User_Guid, ArrChannels);
         return(Json(new NBCMSResultJson
         {
             Status = isPudated? StatusType.OK:StatusType.Error,
             Data = isPudated?"Current user have been associated channels successfully":"failed to update"
         }));
     }
     catch (Exception ex)
     {
         NBCMSLoggerManager.Error(ex.Message);
         NBCMSLoggerManager.Error(ex.Source);
         NBCMSLoggerManager.Error(ex.StackTrace);
         NBCMSLoggerManager.Error("");
         return(Json(new NBCMSResultJson
         {
             Status = StatusType.Exception,
             Data = ex.Message
         }));
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// Get Role List by User
 /// </summary>
 /// <returns></returns>
 public ActionResult GetRoleInUser(String user_guid)
 {
     try {
         if (string.IsNullOrEmpty(user_guid))
         {
             return(Json(new NBCMSResultJson {
                 Status = StatusType.Error,
                 Data = "Request is illegal!"
             }));
         }
         var cookis      = Request[ConfigurationManager.AppSettings["userInfoCookiesKey"]];
         var serializer  = new JavaScriptSerializer();
         var decCookies  = CryptTools.Decrypt(cookis);
         var curUserInfo = serializer.Deserialize(decCookies, typeof(User_Profile_Model)) as User_Profile_Model;
         var uiSvr       = new UserInfoServices();
         var list        = uiSvr.GetAllRolesWithUser(new Guid(user_guid));
         return(Json(new NBCMSResultJson {
             Status = StatusType.OK,
             Data = list
         }));
     }
     catch (Exception ex) {
         NBCMSLoggerManager.Fatal(ex.Message);
         NBCMSLoggerManager.Fatal(ex.StackTrace);
         NBCMSLoggerManager.Error("");
         return(Json(new NBCMSResultJson {
             Status = StatusType.Exception,
             Data = ex.Message
         }));
     }
 }
Exemplo n.º 7
0
        /// <summary>
        /// Get User Info List
        /// </summary>
        /// <param name="queryModel"></param>
        /// <returns></returns>
        public ActionResult GetUserList(User_Profile_QueryModel queryModel)
        {
            try
            {
                var uiSvg = new UserInfoServices();

                var count = 0;
                var list  = uiSvg.GetUserList(queryModel, out count);
                return(Json(new NBCMSResultJson
                {
                    Status = StatusType.OK,
                    Data = new
                    {
                        total = count,
                        rows = list
                    }
                }));
            }
            catch (Exception ex)
            {
                NBCMSLoggerManager.Fatal(ex.Message);
                NBCMSLoggerManager.Fatal(ex.StackTrace);
                NBCMSLoggerManager.Error("");
                return(Json(new NBCMSResultJson
                {
                    Status = StatusType.Exception,
                    Data = ex.Message
                }));
            }
        }
Exemplo n.º 8
0
        public ActionResult RefuseOpenShops(int id)
        {
            ListShops shops = ListShopsServices.LoadEntities(u => u.Id == id).FirstOrDefault();

            if (shops.IsShenHe == 1)
            {
                ViewData["alert"] = "已有其他管理员操作";
                return(View());
            }

            shops.IsShenHe = 1;

            shops.Status = refuse;
            ListShopsServices.Update(shops);

            #region 更新验证码
            var dbUser = UserInfoServices.LoadEntities(u => u.Id == shops.UserInfoId).FirstOrDefault();
            dbUser.EmailCode = "";

            UserInfoServices.Update(dbUser);

            #endregion

            MyNews news = new MyNews();
            news.IsSee      = noSeeMyNews;
            news.SubTime    = DateTime.Now;
            news.Title      = "您的店铺申请失败,请认真核查您的信息,进行重新申请操作";
            news.UserInfoId = shops.UserInfoId;

            MyNewsServices.Add(news);

            ViewData["alert"] = "拒绝开店成功";

            return(View());
        }
Exemplo n.º 9
0
        public ActionResult GetCodeByEmail(int?id)
        {
            if (id == null)
            {
                return(Content("请进行登录之后在进行操作"));
            }
            UserInfo user = UserInfoServices.LoadEntities(u => u.Id == id).FirstOrDefault();

            if (user == null)
            {
                return(Content("请进行登陆之后在进行操作"));
            }


            string code = CommonHelper.GetStringMD5(Guid.NewGuid().ToString());


            MyEmail email = new MyEmail();

            email.Content   = "亲爱的青职二货街用户,您好:您的验证码为" + code + "本邮件是系统自动发出的,请勿回复。祝您使用愉快!";
            email.Subject   = "青职二货街";
            email.Title     = "青职二货街用户验证码";
            email.SendEmail = user.Email;

            EmailHelper.SendMail(email);

            user.EmailCode = code;

            UserInfoServices.Update(user);

            return(Content("发送验证码成功!请查收!"));
        }
Exemplo n.º 10
0
 public ActionResult GetMenuTrees()
 {
     try
     {
         User_Profile_Model         model = new CommonController().GetCurrentUserbyCookie(Request[ConfigurationManager.AppSettings["userInfoCookiesKey"]]);
         UserInfoServices           uiSvs = new UserInfoServices();
         List <Menu_Resource_Model> list  = uiSvs.GetMenuResourceByUserInfo(model);
         return(Json(new NBCMSResultJson
         {
             Status = StatusType.OK,
             Data = list.ToArray()
         }));
     }
     catch (Exception ex)
     {
         NBCMSLoggerManager.Error("");
         NBCMSLoggerManager.Error(ex.Message);
         NBCMSLoggerManager.Error(ex.StackTrace);
         NBCMSLoggerManager.Error("");
         return(Json(new NBCMSResultJson
         {
             Status = StatusType.Exception,
             Data = ex.Message
         }));
     }
 }
Exemplo n.º 11
0
        public ActionResult Edit(UserInfo user)
        {
            user.Pwd = CommonHelper.GetStringMD5(user.Pwd);

            UserInfoServices.Update(user);

            return(Redirect("/Admin/ListUser"));
        }
Exemplo n.º 12
0
        /// <summary>
        /// Add New User
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ActionResult AddUser(User_Profile_Model model)
        {
            try {
                if (model == null)
                {
                    return(Json(new NBCMSResultJson {
                        Status = StatusType.Error,
                        Data = "Request is illegal!"
                    }));
                }

                if (model.User_Account == null)
                {
                    return(Json(new NBCMSResultJson {
                        Status = StatusType.Error,
                        Data = "Request paramter is null!"
                    }));
                }

                var cookis      = Request[ConfigurationManager.AppSettings["userInfoCookiesKey"]];
                var serializer  = new JavaScriptSerializer();
                var decCookies  = CryptTools.Decrypt(cookis);
                var curUserInfo = serializer.Deserialize(decCookies, typeof(User_Profile_Model)) as User_Profile_Model;
                var uiSvr       = new UserInfoServices();
                //user is exiting
                if (uiSvr.IsExistUser(model.User_Account))
                {
                    return(Json(new NBCMSResultJson {
                        Status = StatusType.Error,
                        Data = "user account is exiting"
                    }));
                }

                if (uiSvr.AddUser(model, curUserInfo.User_Account))
                {
                    return(Json(new NBCMSResultJson {
                        Status = StatusType.OK,
                        Data = "Successfully add user"
                    }));
                }
                return(Json(new NBCMSResultJson {
                    Status = StatusType.Error,
                    Data = "faile to add new user"
                }));
            }
            catch (Exception ex) {
                NBCMSLoggerManager.Fatal(ex.Message);
                NBCMSLoggerManager.Fatal(ex.StackTrace);
                NBCMSLoggerManager.Error("");
                return(Json(new NBCMSResultJson {
                    Status = StatusType.Exception,
                    Data = ex.Message
                }));
            }
        }
Exemplo n.º 13
0
        public ActionResult DeleteUser(int id)
        {
            var user = UserInfoServices.LoadEntities(u => u.Id == id).FirstOrDefault();

            user.DelFalg = 0;
            user.IsValid = 0;

            UserInfoServices.Update(user);

            return(Redirect("/Admin/ListUser"));
        }
Exemplo n.º 14
0
        //修改邮箱
        public ActionResult AlterUserEmail()
        {
            string userNameSession = Session["UserName"].ToString();
            string userEmail       = Request["userEmail"];

            BLL.UserInfoServices userInfoService = new UserInfoServices();
            var model = userInfoService.LoadEntities(o => o.UserName == userNameSession).FirstOrDefault();

            model.UserEmail = userEmail;
            userInfoService.EditEntity(model);
            return(Json("ok", JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 15
0
        /// <summary>
        /// 判断邮箱是否绑定
        /// </summary>
        /// <param name="email"></param>
        /// <returns></returns>
        public string CheckEmail(string email)
        {
            UserInfo user = UserInfoServices.LoadEntities(u => u.Email == email && u.IsValid == vaildYes).FirstOrDefault();

            if (user == null)
            {
                return("0");
            }
            else
            {
                return("1");
            }
        }
Exemplo n.º 16
0
        public string CheckIsExistUid(string uid)
        {
            UserInfo user = UserInfoServices.LoadEntities(u => u.Uid == uid && u.IsValid == vaildYes && u.DelFalg == deleteYes).FirstOrDefault();

            if (user == null)
            {
                return("0");
            }
            else
            {
                return("1");
            }
        }
Exemplo n.º 17
0
        //比较验证码
        public ActionResult CompareCode(int?id, string code)
        {
            UserInfo user = UserInfoServices.LoadEntities(u => u.Id == id).FirstOrDefault();

            if (code == user.EmailCode)
            {
                return(Content("1"));
            }
            else
            {
                return(Content("0"));
            }
        }
Exemplo n.º 18
0
        public ActionResult Login(string txtUserName, string txtPassWord, string Remeber, string oldurl)
        {
            if (string.IsNullOrEmpty(txtPassWord) && string.IsNullOrEmpty(txtPassWord))
            {
                return(Content("请输入用户名或者密码"));
            }

            //密码加密
            txtPassWord = CommonHelper.GetStringMD5(txtPassWord);

            //用户名不区分大小写
            txtUserName = txtUserName.ToLower();

            UserInfo model = UserInfoServices.LoadEntities(u => (u.Uid == txtUserName || u.Email == txtUserName) && u.Pwd == txtPassWord && u.DelFalg == deleteNo).FirstOrDefault();

            if (model == null)
            {
                return(Content("用户名或者密码错误"));
            }
            else
            {
                if (model.IsValid == vaildNo)
                {
                    return(Content("302"));
                }

                Session["model"] = model;

                #region Cookie
                HttpCookie cookie = new HttpCookie("uid", txtUserName);
                if (Remeber == null)
                {
                    cookie.Expires = DateTime.Now.AddDays(-10);
                }
                else
                {
                    cookie.Expires = DateTime.Now.AddDays(10);
                }
                Response.Cookies.Add(cookie);
                #endregion

                if (string.IsNullOrEmpty(oldurl))
                {
                    return(Content("ok|/OrderCenter/Home"));
                }
                else
                {
                    return(Content("ok|" + oldurl));
                }
            }
        }
Exemplo n.º 19
0
        /// <summary>
        /// 触发CMS和WebPO的账号进行数据同步。由于一开始CMS设置了自己的用户信息,并且使用GUID进行关联。
        /// 后来要求用户统一在WEBPO进行设置,而WebPO采用自增长而非GUID的方式记录数据。因此需要采取一种
        /// 同步机制而不是简单的View视图关联....
        ///
        /// Author:Lee Date:2013年10月22日11:56:03
        /// </summary>
        /// <returns></returns>
        public ActionResult UserSynchWithWebPo()
        {
            try
            {
                var cookis      = Request[ConfigurationManager.AppSettings["userInfoCookiesKey"]];
                var serializer  = new JavaScriptSerializer();
                var decCookies  = CryptTools.Decrypt(cookis);
                var curUserInfo = serializer.Deserialize(decCookies, typeof(User_Profile_Model)) as User_Profile_Model;

                var uSvr         = new UserInfoServices();
                var affectedRows = 0;
                if (curUserInfo != null)
                {
                    uSvr.UserSynchWithWebPO(curUserInfo.User_Account, out affectedRows);
                }
                return(Json(new NBCMSResultJson
                {
                    Status = StatusType.OK,
                    Data = "Synchronizing Successfully"
                }));
                //if (retVal > 0)
                //{
                //    return Json(new NBCMSResultJson
                //    {
                //        Status = StatusType.OK,
                //        Data = "Synchronizing Successfully"
                //    });
                //}
                //else
                //{
                //    return Json(new NBCMSResultJson
                //    {
                //        Status = StatusType.Error,
                //        Data = "There is no data need to synchronizes"
                //    });
                //}
            }
            catch (Exception ex)//如果存储过程内部发生错,就跳到这里来了。。。。无数据返回-1
            {
                NBCMSLoggerManager.Fatal(ex.Message);
                NBCMSLoggerManager.Fatal(ex.StackTrace);
                NBCMSLoggerManager.Fatal(ex.Source);
                NBCMSLoggerManager.Error("");
                return(Json(new NBCMSResultJson
                {
                    Status = StatusType.Exception,
                    Data = ex.Message
                }));
            }
        }
Exemplo n.º 20
0
        public ActionResult forget(string UserName, string Email, string code)
        {
            if (code != Session["ValidateCode"].ToString())
            {
                return(Content("验证码不正确"));
            }

            UserInfo user = UserInfoServices.LoadEntities(u => u.IsValid == vaildYes && u.DelFalg == deleteNo && u.Uid == UserName && u.Email == Email).FirstOrDefault();

            if (user == null)
            {
                return(Content("用户名和邮箱不匹配,请重新输入"));
            }
            return(Content("ok"));
        }
Exemplo n.º 21
0
        public ActionResult ReFindEmail(string emailurl, string Uid)
        {
            #region 验证用户名邮箱是否正确
            UserInfo user = UserInfoServices.LoadEntities(u => u.Email == emailurl && u.Uid == Uid && u.IsValid == vaildYes).FirstOrDefault();
            if (user == null)
            {
                return(Content("0"));
            }
            #endregion

            MyEmail email = new MyEmail();
            email.SendEmail = emailurl;
            email.Title     = "青职二货街忘记密码提示";
            email.Subject   = "青职二货街";

            string vaildCode = Guid.NewGuid().ToString();
            vaildCode = CommonHelper.GetStringMD5(vaildCode);

            //生成验证连接
            string website = CommonHelper.GetWebSite();
            string href    = website + "/account/ReGetPwd?uid=" + Uid + "&code=" + vaildCode;
            //生成发送邮箱模版
            string html = System.IO.File.ReadAllText(Server.MapPath("/EmailTemp/forgettemp.html"));
            html = html.Replace("@username", Uid).Replace("@link", href).Replace("@website", website);

            email.Content = html;

            try
            {
                EmailHelper.SendMail(email);

                #region 邮件发送成功之后进行存储数据
                user.SendEmailTime = DateTime.Now;
                user.EmailCode     = vaildCode;
                UserInfoServices.Update(user);

                return(Content("1"));

                #endregion
            }
            catch (Exception)
            {
                return(Content("0"));
            }
        }
Exemplo n.º 22
0
        //验证邮箱跳转进入发送邮件界面
        public ActionResult EmailVaild(string email, string uid, string state)
        {
            UserInfo user = UserInfoServices.LoadEntities(u => u.Email == email && u.Uid == uid).FirstOrDefault();

            if (user == null)
            {
                return(Redirect("/others/ShowMsg?OldUrl=/Account/Register&NewUrl=/Account/BinDingEmailByUidAndEmail&PointMsg=+" + Server.UrlEncode("邮箱验证码已过期,请重新绑定邮箱") + "&NewTitle=" + Server.UrlEncode("绑定邮箱界面")));
            }
            ViewData["state"]   = state;
            ViewData["Uid"]     = uid;
            ViewData["myemail"] = email;

            Match  match = Regex.Match(email, "^([-a-zA-z0-9_.]+@([-a-zA-Z0-9_]+(.[a-zA-Z0-9.]+)+))$");
            string url   = "http://mail." + match.Groups[2].Value;

            ViewData["email"] = url;

            return(View());
        }
Exemplo n.º 23
0
        public ActionResult BinDingEmailByUidAndEmail(string UserName, string Email, string code)
        {
            if (Session["ValidateCode"].ToString() != code)
            {
                return(Content("验证码输入不正确"));
            }

            UserName = UserName.ToLower();
            Email    = Email.ToLower();

            UserInfo user = UserInfoServices.LoadEntities(u => u.Uid == UserName && u.Email == Email && u.DelFalg == deleteNo).FirstOrDefault();

            if (user == null)
            {
                return(Content("用户名或者邮箱输入错误,请核对后重新输入"));
            }

            return(Content("ok"));
        }
        public ActionResult SetSee(int id)
        {
            var myNews = MyNewsServices.LoadEntities(u => u.Id == id).FirstOrDefault();

            myNews.IsSee = yesSeeMyNews;

            try
            {
                MyNewsServices.Update(myNews);

                Session["model"] = UserInfoServices.LoadEntities(u => u.Id == CurrentLoginUser.Id).FirstOrDefault();

                return(Content("设置成功"));
            }
            catch (Exception)
            {
                return(Content("数据库错误,请联系管理员"));
            }
        }
Exemplo n.º 25
0
        /// <summary>
        /// Delete a user by guid
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ActionResult DeleteUser(User_Profile_Model model)
        {
            try {
                if (model == null)
                {
                    return(Json(new NBCMSResultJson {
                        Status = StatusType.Error,
                        Data = "Request is illegal!"
                    }));
                }

                var cookis     = Request[ConfigurationManager.AppSettings["userInfoCookiesKey"]];
                var serializer = new JavaScriptSerializer();
                var decCookies = CryptTools.Decrypt(cookis);
                var uiSvr      = new UserInfoServices();

                if (uiSvr.DeleteUser(model))
                {
                    return(Json(new NBCMSResultJson {
                        Status = StatusType.OK,
                        Data = "Successfully delete user"
                    }));
                }
                else
                {
                    return(Json(new NBCMSResultJson {
                        Status = StatusType.Error,
                        Data = "faile to delete user"
                    }));
                }
            }
            catch (Exception ex) {
                NBCMSLoggerManager.Fatal(ex.Message);
                NBCMSLoggerManager.Fatal(ex.StackTrace);
                NBCMSLoggerManager.Error("");
                return(Json(new NBCMSResultJson {
                    Status = StatusType.Exception,
                    Data = ex.Message
                }));
            }
        }
Exemplo n.º 26
0
        public ActionResult ReGetPwd(string uid, string code)
        {
            UserInfo user = UserInfoServices.LoadEntities(u => u.Uid == uid && u.EmailCode == code && u.DelFalg == deleteNo && u.IsValid == vaildYes).FirstOrDefault();


            if (user == null)
            {
                return(Redirect("/others/ShowMsg?OldUrl=/Account/forget&NewUrl=/Account/forget&PointMsg=+" + Server.UrlEncode("邮箱验证码已过期,请重新进行找回密码操作") + "&NewTitle=" + Server.UrlEncode("找回密码界面")));
            }
            int spantime = 5;

            spantime = DateTime.Now.Hour - ((DateTime)user.SendEmailTime).Hour;

            if (spantime >= 2)
            {
                return(Redirect("/others/ShowMsg?OldUrl=/Account/forget&NewUrl=/Account/forget&PointMsg=+" + Server.UrlEncode("邮箱验证码已过期,请重新进行找回密码操作") + "&NewTitle=" + Server.UrlEncode("找回密码界面")));
            }

            ViewData["UserName"] = uid;
            return(View());
        }
Exemplo n.º 27
0
        public ActionResult Create(UserInfo user)
        {
            user.Pwd = CommonHelper.GetStringMD5(user.Pwd);

            UserInfoServices.Add(user);

            UserInfoExt ext = new UserInfoExt();

            ext.Address    = "";
            ext.Birthday   = DateTime.Now;
            ext.Gender     = 1;
            ext.NickName   = "小二";
            ext.RealName   = "";
            ext.TouXiang   = "/Upload/default/default.jpg";
            ext.UserInfoId = user.Id;

            UserInfoExtServices.Add(ext);


            return(Redirect("/Admin/ListUser"));
        }
Exemplo n.º 28
0
        public ActionResult UpdateUserStats(short Status, Guid User_Guid)
        {
            try
            {
                //string cookis = Request[ConfigurationManager.AppSettings["userInfoCookiesKey"]];
                //var serializer = new JavaScriptSerializer();
                //string decCookies = CryptTools.Decrypt(cookis);
                //User_Profile_Model curUserInfo = serializer.Deserialize(decCookies, typeof(User_Profile_Model)) as User_Profile_Model;

                var uSvr = new UserInfoServices();
                if (uSvr.UpdateUserStats(Status, User_Guid))
                {
                    return(Json(new NBCMSResultJson
                    {
                        Status = StatusType.OK,
                        Data = "Current user allowe to login CMS system"
                    }));
                }
                else
                {
                    return(Json(new NBCMSResultJson
                    {
                        Status = StatusType.Error,
                        Data = "fail to update this item!"
                    }));
                }
            }
            catch (Exception ex)
            {
                NBCMSLoggerManager.Error(ex.Message);
                NBCMSLoggerManager.Error(ex.Source);
                NBCMSLoggerManager.Error(ex.StackTrace);
                NBCMSLoggerManager.Error("");
                return(Json(new NBCMSResultJson
                {
                    Status = StatusType.Exception,
                    Data = ex.Message
                }));
            }
        }
Exemplo n.º 29
0
        public ActionResult AllowOpenShops(int id)
        {
            ListShops shops = ListShopsServices.LoadEntities(u => u.Id == id).FirstOrDefault();

            if (shops.IsShenHe == 1)
            {
                ViewData["alert"] = "已有其他管理员操作";
                return(View());
            }

            shops.IsShenHe = 1;

            shops.SheHeAdminId = ((AdminUser)Session["adminlogin"]).Id;

            shops.Status = allow;
            ListShopsServices.Update(shops);

            #region 更新验证码
            var dbUser = UserInfoServices.LoadEntities(u => u.Id == shops.UserInfoId).FirstOrDefault();
            dbUser.EmailCode = "";

            UserInfoServices.Update(dbUser);

            #endregion

            MyNews news = new MyNews();
            news.IsSee      = noSeeMyNews;
            news.SubTime    = DateTime.Now;
            news.Title      = "您的店铺申请成功,开启您的二手市场之旅吧";
            news.UserInfoId = shops.UserInfoId;

            MyNewsServices.Add(news);

            ViewData["alert"] = "允许开店成功";

            return(View());
        }
Exemplo n.º 30
0
        public ActionResult UserLogout()
        {
            try
            {
                string cookiName  = ConfigurationManager.AppSettings["userInfoCookiesKey"];
                string cookis     = Request[cookiName];
                var    serializer = new JavaScriptSerializer();
                string decCookies = CryptTools.Decrypt(cookis);

                User_Profile_Model userInfo    = serializer.Deserialize(decCookies, typeof(User_Profile_Model)) as User_Profile_Model;
                UserInfoServices   userInfoSvr = new UserInfoServices();
                //userInfoSvr.UpdateUserStats("1", userInfo.User_Account);

                //remove方法只是不让服务器向客户机发送那个被删除的cookie,与此cookie留不留在客户机里无关
                Response.Cookies.Remove(cookiName);
                Response.Cookies[cookiName].Expires = DateTime.Now.AddDays(-1);
                //FormsAuthentication.SignOut();

                // HttpContext.Response.Redirect("~/Login/Index");
                return(Json(new NBCMSResultJson
                {
                    Status = StatusType.OK,
                    Data = "User Logout successfully!"
                }));
            }
            catch (Exception ex)
            {
                NBCMSLoggerManager.Error(ex.Message);
                NBCMSLoggerManager.Error(ex.Source);
                return(Json(new NBCMSResultJson
                {
                    Status = StatusType.Exception,
                    Data = ex.Message
                }));
            }
        }