public ActionResult PasswordReset(PasswordReset model)
        {
            if (ModelState.IsValid)
            {
                string connection     = ConfigurationManager.AppSettings["InternalAPIURL"];
                var    appAccessToken = WebUtils.GetVaultSecret("AppConnectionKey");

                RequestResetPasswordRequest  resetRequest  = new RequestResetPasswordRequest(connection, appAccessToken, model.Email);
                RequestResetPasswordResponse resetResponse = resetRequest.Send();

                //always act like success - don't want people fishing for email addresses
                TempData["Success"] = "An email was sent to the email address provided. Please follow the instructions to reset your password.";
                return(RedirectToAction("Login", "Account"));
            }
            else
            {
                return(View(model));
            }
        }
Exemple #2
0
            public void ForgotPasswordRequest()
            {
                RequestResetPasswordRequest request = new RequestResetPasswordRequest(connection, testToken, "*****@*****.**");

                KeyVaultClient KeyVault;

                try
                {
                    var azureServiceTokenProvider = new AzureServiceTokenProvider();
                    var _token = azureServiceTokenProvider.GetAccessTokenAsync("https://vault.azure.net").Result;
                    KeyVault = new KeyVaultClient(new KeyVaultClient.AuthenticationCallback(azureServiceTokenProvider.KeyVaultTokenCallback));
                }
                catch (Exception e)
                {
                    throw e;
                }
                var bundle = KeyVault.GetSecretAsync("https://pr-kv-uks-dev.vault.azure.net/secrets/AppConnectionKey").Result;

                request.AppAccessToken = bundle.Value;

                RequestResetPasswordResponse response = request.Send();

                Assert.AreEqual(response.StatusCode, System.Net.HttpStatusCode.OK);
            }