Language tweaks and fixes

This commit is contained in:
Colin Dawson 2026-02-03 18:22:31 +00:00
parent 39a4f46b5b
commit b77c3e867f
2 changed files with 43 additions and 35 deletions

View File

@ -38,7 +38,7 @@
@Html.ValidationMessageFor(m => m.Profile.LastName)
</div>
@await Html.PartialAsync("_loginMethodChooser", Model.Profile)
@await Html.PartialAsync("_loginMethodChooser", Model)
<button type="submit" class="btn btn-primary btn-spaced" name="Submit">@t.T("Save")</button>
}

View File

@ -1,7 +1,14 @@
@model eSuite.API.Models.IPasswordInformation
@using eSuite.API.Translation
@model eSuite.API.Controllers.ProfileViewModel
@{
var passwordMinLength = 12;
var t = await Model.TranslatorFactory.Use(Namespaces.Common);
Layout = null;
}
@if (Model.DomainSsoProviderId != null)
@if (Model.Profile.DomainSsoProviderId != null)
{
<div id="domainLoginMethod">
Your domain has authorisation from an external source.
@ -11,19 +18,19 @@ else
{
<div id="userLoginMethod" class="changePasswordBlock">
<div class="form-group">
@Html.LabelFor(m => m.SsoProviderId)
@Html.DropDownListFor(m => m.SsoProviderId,
@Html.LabelFor(m => m.Profile.SsoProviderId, t.T("LoginMethod"))
@Html.DropDownListFor(m => m.Profile.SsoProviderId,
new SelectList(
new List<KeyValuePair<long, string>>
{
new(-1, "Password")
}.Concat(Model.SsoProviders.OrderBy(x => x.Value)), nameof(KeyValuePair<long, string>.Key), nameof(KeyValuePair<long, string>.Value)))
}.Concat(Model.Profile.SsoProviders.OrderBy(x => x.Value)), nameof(KeyValuePair<long, string>.Key), nameof(KeyValuePair<long, string>.Value)))
</div>
<div id="passwordDiv">
<div class="form-group">
@Html.LabelFor(m => m.Password)
@Html.EditorFor(m => m.Password, new
@Html.LabelFor(m => m.Profile.Password, t.T("Password"))
@Html.EditorFor(m => m.Profile.Password, new
{
htmlAttributes = new
{
@ -31,22 +38,22 @@ else
autocomplete = "new-password"
}
})
@Html.ValidationMessageFor(m => m.Password, default)
@Html.ValidationMessageFor(m => m.Profile.Password, default)
</div>
<div>Passwords require:</div>
<ul>
<li id="minCharacters">At least 12 characters </li>
<li id="minSymbols">At least 1 symbol</li>
<li id="minNumbers">At least 1 number</li>
<li id="minLowerCase">At least 1 lowercase letter</li>
<li id="minUppserCase">At least 1 uppercase letter</li>
<li id="minCharacters">@t.T("PasswordMinLength", new { minPasswordLength = 12 })</li>
<li id="minSymbols">@t.T("PasswordMinSymbols", new { minSymbols = 1 })</li>
<li id="minNumbers">@t.T("PasswordMinNumbers", new { minNumbers = 1 })</li>
<li id="minLowerCase">@t.T("PasswordMinLowercase", new { minLowercase = 1 })</li>
<li id="minUppserCase">@t.T("PasswordMinUppercase", new { minUppercase = 1 })</li>
</ul>
<div id="confirmPasswordDiv">
<div class="form-group">
@Html.LabelFor(m => m.ConfirmPassword)
@Html.EditorFor(m => m.ConfirmPassword, new
@Html.LabelFor(m => m.Profile.ConfirmPassword, t.T("ConfirmPassword"))
@Html.EditorFor(m => m.Profile.ConfirmPassword, new
{
htmlAttributes = new
{
@ -54,30 +61,30 @@ else
autocomplete = "new-password"
}
})
@Html.ValidationMessageFor(m => m.ConfirmPassword)
@Html.ValidationMessageFor(m => m.Profile.ConfirmPassword)
</div>
</div>
<div class="form-group">
@Html.LabelFor(m => m.UsingTwoFactorAuthentication)
@Html.EditorFor(m => m.UsingTwoFactorAuthentication, new { htmlAttributes = new { } })
@Html.ValidationMessageFor(m => m.UsingTwoFactorAuthentication)
@Html.LabelFor(m => m.Profile.UsingTwoFactorAuthentication, t.T("UsingTwoFactorAuthentication"))
@Html.EditorFor(m => m.Profile.UsingTwoFactorAuthentication, new { htmlAttributes = new { } })
@Html.ValidationMessageFor(m => m.Profile.UsingTwoFactorAuthentication)
</div>
<div id="tfaDetailsDiv">
<div class="form-group">
<div>
<label>@Model.TwoFactorAuthenticationSettings.ManualEntrySetupCode</label>
<label>@Model.Profile.TwoFactorAuthenticationSettings.ManualEntrySetupCode</label>
</div>
<div>
<img src="@Model.TwoFactorAuthenticationSettings.QrCodeImageUrl" alt="@Model.TwoFactorAuthenticationSettings.ManualEntrySetupCode"/>
<img src="@Model.Profile.TwoFactorAuthenticationSettings.QrCodeImageUrl" alt="@Model.Profile.TwoFactorAuthenticationSettings.ManualEntrySetupCode" />
</div>
</div>
<div class="form-group">
@Html.LabelFor(m => m.SecurityCode)
@Html.EditorFor(m => m.SecurityCode, new
@Html.LabelFor(m => m.Profile.SecurityCode, t.T("AuthenticationCode"))
@Html.EditorFor(m => m.Profile.SecurityCode, new
{
htmlAttributes = new
{
@ -85,22 +92,23 @@ else
autocomplete = "one-time-code"
}
})
@Html.ValidationMessageFor(m => m.SecurityCode)
@Html.ValidationMessageFor(m => m.Profile.SecurityCode)
</div>
</div>
</div>
<div id="ssoLinkDiv">
Save changes to trigger the process that will link your SSO Account.
@t.T("SaveChangesToLinkSSOAccount")
</div>
</div>
}
<script type="text/javascript">
var CurrentSsoProviderId = $('#SsoProviderId').val();
var CurrentSsoProviderId = $('#Profile_SsoProviderId').val();
function UpdatePasswordDivVisibility()
{
var value = $('#SsoProviderId').val();
var value = $('#Profile_SsoProviderId').val();
var ssoAlreadyLinked = value == CurrentSsoProviderId;
@ -126,7 +134,7 @@ else
function UpdatePasswordValidationList()
{
var value = $('#Password').val();
var value = $('#Profile_Password').val();
if (value.length >= 12)
{
@ -168,7 +176,7 @@ else
function UpdateConfirmPasswordDivVisibility()
{
var value = $('#Password').val();
var value = $('#Profile_Password').val();
if (value !== '')
{
$('#confirmPasswordDiv').show();
@ -181,12 +189,12 @@ else
UpdatePasswordValidationList();
}
var UsingTwoFactorAuthenticationEnabled = $('#UsingTwoFactorAuthentication').is(':checked');
var UsingTwoFactorAuthenticationEnabled = $('#Profile_UsingTwoFactorAuthentication').is(':checked');
function TwoFactorAuthenticationEnabledVisibility()
{
var enabled = UsingTwoFactorAuthenticationEnabled;
var wantToEnabled = $('#UsingTwoFactorAuthentication').is(':checked');
var wantToEnabled = $('#Profile_UsingTwoFactorAuthentication').is(':checked');
if (!enabled && wantToEnabled)
{
$('#tfaDetailsDiv').show();
@ -200,7 +208,7 @@ else
UpdatePasswordDivVisibility();
UpdateConfirmPasswordDivVisibility();
TwoFactorAuthenticationEnabledVisibility();
$('#Password').on('input', UpdateConfirmPasswordDivVisibility);
$('#UsingTwoFactorAuthentication').change(TwoFactorAuthenticationEnabledVisibility);
$('#SsoProviderId').change(UpdatePasswordDivVisibility);
$('#Profile_Password').on('input', UpdateConfirmPasswordDivVisibility);
$('#Profile_UsingTwoFactorAuthentication').change(TwoFactorAuthenticationEnabledVisibility);
$('#Profile_SsoProviderId').change(UpdatePasswordDivVisibility);
</script>