public ActionResult ResetPassword(string un, string rt)
        {
            var help = new AccountControllerHelpers(UoW, PWS);

            bool any;
            using (var db = new UsersContext())
            {
                var userid = help.GetUserId(db, un);

                //check userid and token matches
                any = help.GetUserIdAndTokenMatches(db, userid, rt);
            }
            if (any)
            {
                string newpassword = help.GetNewPasswordPassword(PWS);

                //reset password
                bool response = WebSecurity.ResetPassword(rt, newpassword);

                if (response)
                    help.CreateEmail(un, newpassword);
                else
                    TempData["Message"] = "Hey, avoid random request on this page.";
            }
            else
                TempData["Message"] = "Username and token not maching.";

            return View();
        }
        public ActionResult Register(CreateMemberViewModel model)
        {
            var help = new AccountControllerHelpers(UoW, PWS);

            if (ModelState.IsValid)
            {
                if (help.BuildNewMember(model))
                {
                    // Attempt to register the member
                    try
                    {
                        WebSecurity.CreateUserAndAccount(model.DisplayName, model.Password);
                        Roles.AddUserToRole(model.DisplayName, "Member");
                        WebSecurity.Login(model.DisplayName, model.Password);
                        return RedirectToAction("Index", "Home");
                    }
                    catch (MembershipCreateUserException e)
                    {
                        ModelState.AddModelError("", ErrorCodeToString(e.StatusCode));
                    }

                    MigrateShoppingCart(model.DisplayName);
                    MigrateWishList(model.DisplayName);

                    FormsAuthentication.SetAuthCookie(model.DisplayName, false /* createPersistentCookie */);
                    TempData["toast"] = "<script> $(document).ready(function () {" +
                                "toastr.options = { 'positionClass': 'toast-bottom-right' };" +
                                "toastr.success('Thanks for registering!');});</script>";

                    return RedirectToAction("Index", "Home");
                }
            }
            return View("RegisterMember", model);
        }