public ActionResult ResetPassword(string token)
        {
            var viewModel = new ResetPasswordViewModel();

            viewModel.Token = token;

            if (string.IsNullOrWhiteSpace(token))
            {
                viewModel.Status = ResetPasswordStatus.NoTokenProvided;
            }
            else
            {
                var drUser = CRCDataAccess.GetCRCUserByResetPasswordToken(token);
                if (drUser == null)
                {
                    viewModel.Status = ResetPasswordStatus.TokenInvalid;
                }
                else
                {
                    viewModel.Status = ResetPasswordStatus.TokenValid;
                    viewModel.Email  = drUser["Email"].ToString();
                }
            }

            return(View(viewModel));
        }
        public ActionResult ResetPassword(ResetPasswordViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                var drUser = CRCDataAccess.GetCRCUserByResetPasswordToken(viewModel.Token);
                if (drUser == null)
                {
                    // make sure the token is still valid
                    viewModel.Status = ResetPasswordStatus.TokenInvalid;
                }
                else
                {
                    var userId = (long)drUser["UserId"];
                    CRCDataAccess.SaveCRCUserPassword(userId, viewModel.NewPassword, userId);
                    viewModel.Status = ResetPasswordStatus.PasswordChanged;
                }
            }

            return(View(viewModel));
        }