2121 using Microsoft . AspNetCore . Hosting ;
2222 using Microsoft . AspNetCore . Mvc ;
2323 using Microsoft . AspNetCore . Routing ;
24+ using Microsoft . Extensions . Configuration ;
2425 using Microsoft . Extensions . Logging ;
2526 using Microsoft . Extensions . Options ;
2627 using NHSUKViewComponents . Web . ViewModels ;
2728 using ChangePasswordViewModel = LearningHub . Nhs . WebUI . Models . UserProfile . ChangePasswordViewModel ;
29+ using IConfiguration = Microsoft . Extensions . Configuration . IConfiguration ;
2830
2931 /// <summary>
3032 /// The UserController.
@@ -43,6 +45,7 @@ public partial class MyAccountController : BaseController
4345 private readonly ISpecialtyService specialtyService ;
4446 private readonly ILocationService locationService ;
4547 private readonly ICacheService cacheService ;
48+ private readonly IConfiguration configuration ;
4649
4750 /// <summary>
4851 /// Initializes a new instance of the <see cref="MyAccountController"/> class.
@@ -61,6 +64,7 @@ public partial class MyAccountController : BaseController
6164 /// <param name="locationService">The locationService.</param>
6265 /// <param name="multiPageFormService">The multiPageFormService<see cref="IMultiPageFormService"/>.</param>
6366 /// <param name="cacheService">The cacheService<see cref="ICacheService"/>.</param>
67+ /// <param name="configuration">The cacheService<see cref="IConfiguration"/>.</param>
6468 public MyAccountController (
6569 IWebHostEnvironment hostingEnvironment ,
6670 ILogger < ResourceController > logger ,
@@ -75,7 +79,8 @@ public MyAccountController(
7579 ISpecialtyService specialtyService ,
7680 ILocationService locationService ,
7781 IMultiPageFormService multiPageFormService ,
78- ICacheService cacheService )
82+ ICacheService cacheService ,
83+ IConfiguration configuration )
7984 : base ( hostingEnvironment , httpClientFactory , logger , settings . Value )
8085 {
8186 this . userService = userService ;
@@ -88,6 +93,7 @@ public MyAccountController(
8893 this . locationService = locationService ;
8994 this . multiPageFormService = multiPageFormService ;
9095 this . cacheService = cacheService ;
96+ this . configuration = configuration ;
9197 }
9298
9399 private string LoginWizardCacheKey => $ "{ this . CurrentUserId } :LoginWizard";
@@ -452,9 +458,8 @@ public async Task<IActionResult> UpdatePassword(ChangePasswordViewModel model)
452458 if ( this . ModelState . IsValid )
453459 {
454460 await this . userService . UpdatePassword ( model . NewPassword ) ;
455-
456- this . ViewBag . SuccessMessage = CommonValidationErrorMessages . PasswordSuccessMessage ;
457- return this . View ( "SuccessMessage" ) ;
461+ var redirectUri = $ "{ this . configuration [ "LearningHubAuthServiceConfig:Authority" ] } /Home/SetIsPasswordUpdate?isLogout=false";
462+ return this . Redirect ( redirectUri ) ;
458463 }
459464 else
460465 {
0 commit comments