Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,14 @@ public IActionResult AddSuperviseDelegate(MyStaffListViewModel model)
var supervisorEmail = GetUserEmail();

ModelState.Remove("Page");
if (ModelState.IsValid)
if (ModelState.IsValid && supervisorEmail != model.DelegateEmail)
{
AddSupervisorDelegateAndReturnId(adminId, model.DelegateEmail ?? String.Empty, supervisorEmail, centreId);
return RedirectToAction("MyStaffList", model.Page);
}
else
{
if (supervisorEmail == model.DelegateEmail) { ModelState.AddModelError("DelegateEmail", "The email address must not match the email address you are logged in with."); }
ModelState.ClearErrorsForAllFieldsExcept("DelegateEmail");
return MyStaffList(model.SearchString, model.SortBy, model.SortDirection, model.Page);
}
Expand All @@ -131,7 +132,7 @@ public IActionResult AddMultipleSuperviseDelegates(AddMultipleSupervisorDelegate
var delegateEmailsList = NewlineSeparatedStringListHelper.SplitNewlineSeparatedList(model.DelegateEmails);
foreach (var delegateEmail in delegateEmailsList)
{
if (delegateEmail.Length > 0)
if (delegateEmail.Length > 0 && supervisorEmail != delegateEmail)
{
if (RegexStringValidationHelper.IsValidEmail(delegateEmail))
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@using DigitalLearningSolutions.Web.ViewModels.Common.ViewComponents
@using DigitalLearningSolutions.Web.Helpers
@model TextInputViewModel
<div class="nhsuk-form-group @(Model.HasError ? "nhsuk-form-group--error" : "")" style="white-space:nowrap">
<div class="nhsuk-form-group @(Model.HasError ? "nhsuk-form-group--error" : "")">
<label class="nhsuk-label" for="@Model.Name">
@Model.Label
</label>
Expand Down