Exemplo n.º 1
0
        public ActionResult ChangePassword(BlockDataUserChangepwModel model)
        {
            Logging.WriteToLog(this.GetType().ToString() + "-changepw-submit()", LogType.Access);
            if (Session[this.SESSION_NAME_USERID] == null)
            {
                return(RedirectToAction("Logout", "Home"));
            }
            if (Session["IsAdmin"] is false)
            {
                return(RedirectToAction("Logout", "Home"));
            }
            this.SetCommonData();
            this.GetLanguage();
            BlockLangUserChangepwModel blockLang = new BlockLangUserChangepwModel();

            if (model.ConfirmPassword != model.Password)
            {
                Session["msg_text"] = blockLang.GetLangByPath("messages.block_user_changepw.not_equalto", this.LANGUAGE_OBJECT);
                Session["msg_code"] = 0;
                return(RedirectToAction("ChangePassword"));
            }
            //Session["msg_code"] = output;
            this.SetConnectionDB();

            UserServices services = new UserServices(this.DBConnection);

            model.UserId = (int)Session[this.SESSION_NAME_USERID];
            int output = services.ChangePw(model);

            this.ERRORS = services.ERROR;
            if (services.ERROR != null)
            {
                FileHelper.SaveFile(new { data = model, ERROR = services.ERROR }, this.LOG_FOLDER + "/ERROR_" + this.GetType().ToString() + APIStringHelper.GenerateFileId() + ".txt");
            }

            if (output == model.UserId)
            {
                Session["msg_text"] = blockLang.GetLangByPath("messages.block_user_changepw.success", this.LANGUAGE_OBJECT);
                Session["msg_code"] = 1;
            }

            else
            {
                Session["msg_text"] = blockLang.GetLangByPath("messages.block_user_changepw.not_exist_user", this.LANGUAGE_OBJECT);
                Session["msg_code"] = 0;
            }

            return(RedirectToAction("ChangePassword"));
        }
Exemplo n.º 2
0
        public ActionResult ChangePassword()
        {
            Logging.WriteToLog(this.GetType().ToString() + "-changepww()", LogType.Access);
            if (Session[this.SESSION_NAME_USERID] == null)
            {
                return(RedirectToAction("Logout", "Home"));
            }
            this.SetCommonData();
            ViewData["pagename"]     = "change_password";
            ViewData["action_block"] = "Users/block_user_changepw";
            this.GetLanguage();
            BlockLangUserChangepwModel blockLang = new BlockLangUserChangepwModel();

            BI_Project.Models.UI.BlockModel blockModel = new Models.UI.BlockModel("block_user_changepw", this.LANGUAGE_OBJECT, blockLang);
            //blockModel.DataModel = ViewData["block_menu_left_data"];

            ViewData["BlockData"] = blockModel;
            return(View("~/" + this.THEME_FOLDER + "/" + this.THEME_ACTIVE + "/index.cshtml"));
        }