コード例 #1
0
        public ActionResult CreateNewPassword(string id)
        {
            var userInfo = UserManager.FindById(id);
            var user     = new CreateNewPassword
            {
                Id   = userInfo.Id,
                Name = userInfo.UserName
            };

            return(View(user));
        }
コード例 #2
0
        /// <summary>
        /// Метод сохранения пароля в xml.
        /// </summary>
        /// <param name="password"></param>
        public void SaveUserPasswordToXml(CreateNewPassword password)
        {
            XDocument xDocPassword = new XDocument();
            XElement  root         = new XElement("password");

            root.Add(new XElement("pass",
                                  new XAttribute("value", password.AddPassword),
                                  new XElement("secret", password.AddSecretWord)));
            xDocPassword.Add(root);
            xDocPassword.Save("UserPassword.xml");
            xmlPasswordDb = xDocPassword;
        }
コード例 #3
0
ファイル: Account.cs プロジェクト: abhijeetsap21/Auxo
        public ActionResult NewPassword(CreateNewPassword oCreateNewPassword)
        {
            long userID = oCreateNewPassword.userID;

            if (userID != 0)
            {
                //---------check for Employer-----------
                if (oCreateNewPassword.roleID == 2)
                {
                    var emplyoer = db.EmployerDetails.Where(e => e.EmployerID == userID).FirstOrDefault();
                    if (emplyoer != null)
                    {
                        emplyoer.password        = oCreateNewPassword.password;
                        db.Entry(emplyoer).State = EntityState.Modified;
                        try
                        {
                            db.SaveChanges();
                            ViewBag.success = 2;
                        }
                        catch (Exception ex)
                        {
                            TempData["msg"] = ex.Message.ToString();
                            BaseUtil.CaptureErrorValues(ex);
                            return(RedirectToAction("Error"));
                        }
                    }
                }

                //---------check for candidate-----------
                if (oCreateNewPassword.roleID == 5)
                {
                    var emplyoer = db.qendidateLists.Where(e => e.qenID == userID).FirstOrDefault();
                    if (emplyoer != null)
                    {
                        emplyoer.password        = oCreateNewPassword.password;
                        db.Entry(emplyoer).State = EntityState.Modified;
                        try
                        {
                            db.SaveChanges();
                            ViewBag.success = 5;
                        }
                        catch (Exception ex)
                        {
                            TempData["msg"] = ex.Message.ToString();
                            BaseUtil.CaptureErrorValues(ex);
                            return(RedirectToAction("Error"));
                        }
                    }
                }
            }
            return(View());
        }
コード例 #4
0
ファイル: Account.cs プロジェクト: abhijeetsap21/Auxo
        public ActionResult NewPassword()
        {
            int role = 0;

            if (!string.IsNullOrEmpty(Request.QueryString["role"]))
            {
                role = Convert.ToInt16(BaseUtil.Decrypt(Request.QueryString["role"].ToString()));
            }
            long UID = 0;

            if (!string.IsNullOrEmpty(Request.QueryString["UID"]))
            {
                UID = Convert.ToInt64(BaseUtil.Decrypt(Request.QueryString["UID"].ToString()));
            }
            CreateNewPassword oCreateNewPassword = new CreateNewPassword();

            oCreateNewPassword.userID = UID;
            oCreateNewPassword.roleID = role;
            return(View(oCreateNewPassword));
        }