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