[RequireHttps] //apply to all actions in controller
#endif
        public ActionResult LostPassword(string code, string email)
        {
            LostAccountModel accountModel = new LostAccountModel();
            try
            {

                var user = Membership.GetUser(email);
                accountModel.Email = email;
                accountModel.VerificationCode = code;
                if (user != null)
                {
                    bool check = RDN.Library.Classes.Account.User.CheckLostPasswordVerificationCode(code, email);

                    if (!check)
                        accountModel.ConfirmationMessage = "Code and Email could not be found.";
                    else
                    {
                        accountModel.CanChangePassword = true;
                        return View(accountModel);
                    }
                }
                else
                {
                    accountModel.ConfirmationMessage = "It Seems Your Password Change Request Has Expired.";
                }

            }
            catch (Exception exception)
            {
                ErrorDatabaseManager.AddException(exception, GetType());
            }


            return View(accountModel);
        }
[RequireHttps] //apply to all actions in controller
#endif
        public ActionResult Recover(LostAccountModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {

                    var user = Membership.GetUser(model.Email);
                    if (user != null)
                    {
                        if (RDN.Library.Classes.Account.User.UserLostPassword(user))
                            model.ConfirmationMessage = "An Email Has Been Sent to: " + model.Email;
                        else
                            model.ConfirmationMessage = "Something went wrong, if this problem persists please contact [email protected]";
                        return View(model);
                    }
                }
            }
            catch (Exception exception)
            {
                ErrorDatabaseManager.AddException(exception, GetType());
            }
            return View();
        }
[RequireHttps] //apply to all actions in controller
#endif
        public ActionResult LostPassword(LostAccountModel model)
        {
            try
            {

                model.CanChangePassword = true;
                if (model.NewPasswordConfirm != model.NewPassword)
                    return View(model);

                if (ModelState.IsValid)
                {
                    var user = Membership.GetUser(model.Email);
                    if (user != null)
                    {

                        bool changed = RDN.Library.Classes.Account.User.ChangeUserPassword(user, model.NewPassword, model.VerificationCode);
                        if (changed == true)
                            model.ConfirmationMessage = "Your Password Has Been Changed.";
                        else
                            model.ConfirmationMessage = "Your Password Has NOT Been Changed. If this problem persists, please email " + ServerConfig.DEFAULT_INFO_EMAIL;
                        return View(model);
                    }
                }
            }
            catch (Exception exception)
            {
                ErrorDatabaseManager.AddException(exception, GetType());
            }
            return View(model);
        }