aboutsummaryrefslogtreecommitdiff
path: root/ExamTemplate/Web/Controllers
diff options
context:
space:
mode:
Diffstat (limited to 'ExamTemplate/Web/Controllers')
-rw-r--r--ExamTemplate/Web/Controllers/UserController.cs11
1 files changed, 6 insertions, 5 deletions
diff --git a/ExamTemplate/Web/Controllers/UserController.cs b/ExamTemplate/Web/Controllers/UserController.cs
index c855c39..4d245f7 100644
--- a/ExamTemplate/Web/Controllers/UserController.cs
+++ b/ExamTemplate/Web/Controllers/UserController.cs
@@ -112,19 +112,20 @@ namespace ExamTemplate.Web.Controllers
if (!this._userService.IsSignedIn(HttpContext.User))
return RedirectToAction("Login");
+ UserServiceModel loggedInUser = await this._userService.GetUserByClaimsAsync(HttpContext.User);
+
EditUserServiceModel editUserServiceModel = this._autoMapper.Map<EditUserServiceModel>(editUserViewModel);
bool result = await this._userService.EditUserAsync(HttpContext.User, editUserServiceModel);
if (result)
{
- await this._userService.LogoutAsync();
+ if (loggedInUser.Username != editUserViewModel.Username)
+ await this._userService.LogoutAsync();
+
return RedirectToAction("Profile", new { username = editUserViewModel.Username });
}
else
- {
- UserServiceModel userServiceModel = await this._userService.GetUserByClaimsAsync(HttpContext.User);
- return RedirectToAction("Profile", new { username = userServiceModel.Username });
- }
+ return RedirectToAction("Profile", new { username = loggedInUser.Username });
}
}
}