testing messages
This commit is contained in:
@@ -42,8 +42,12 @@ red=Red
|
||||
green=Green
|
||||
blue=Blue
|
||||
custom=Custom...
|
||||
changeCredsMessage=First time login, Please change your username and/or password!
|
||||
changedCredsMessage=Credentials changed!
|
||||
|
||||
notAuthenticatedMessage=User not authenticated.
|
||||
userNotFoundMessage=User not found.
|
||||
incorrectPasswordMessage=Current password is incorrect.
|
||||
usernameExistsMessage=New Username already exists.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,21 @@
|
||||
<!-- User Settings Title -->
|
||||
<h2 class="text-center" th:text="#{account.accountSettings}">User Settings</h2>
|
||||
<hr>
|
||||
<div th:if="${changeCredsFlag}" class="alert alert-success" th:text="#{changeCredsMessage}"></div>
|
||||
<div th:if="${notAuthenticated}" class="alert alert-danger" role="alert">
|
||||
User not authenticated.
|
||||
</div>
|
||||
<div th:if="${userNotFound}" class="alert alert-danger" role="alert">
|
||||
User not found.
|
||||
</div>
|
||||
<div th:if="${incorrectPassword}" class="alert alert-danger" role="alert">
|
||||
Current password is incorrect.
|
||||
</div>
|
||||
<div th:if="${usernameExists}" class="alert alert-danger" role="alert">
|
||||
New username already exists.
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- At the top of the user settings -->
|
||||
<h3 class="text-center"><span th:text="#{welcome} + ' ' + ${username}">User</span>!</h3>
|
||||
|
||||
@@ -16,6 +16,18 @@
|
||||
<!-- User Settings Title -->
|
||||
<h2 class="text-center" th:text="#{changeCreds.header}">User Settings</h2>
|
||||
<hr>
|
||||
<div th:if="${notAuthenticated}" class="alert alert-danger" role="alert">
|
||||
User not authenticated.
|
||||
</div>
|
||||
<div th:if="${userNotFound}" class="alert alert-danger" role="alert">
|
||||
User not found.
|
||||
</div>
|
||||
<div th:if="${incorrectPassword}" class="alert alert-danger" role="alert">
|
||||
Current password is incorrect.
|
||||
</div>
|
||||
<div th:if="${usernameExists}" class="alert alert-danger" role="alert">
|
||||
New username already exists.
|
||||
</div>
|
||||
<div th:if="${changeCredsFlag}" class="alert alert-success" th:text="#{changeCredsMessage}"></div>
|
||||
|
||||
<!-- At the top of the user settings -->
|
||||
|
||||
@@ -179,11 +179,13 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
const urlParams = currentURL.searchParams;
|
||||
const currentLangParam = urlParams.get('lang') || defaultLocale;
|
||||
|
||||
console.log("defaultLocale", defaultLocale)
|
||||
console.log("storedLocale", storedLocale)
|
||||
console.log("currentLangParam", currentLangParam)
|
||||
console.log("defaultLocale", defaultLocale);
|
||||
console.log("storedLocale", storedLocale);
|
||||
console.log("currentLangParam", currentLangParam);
|
||||
|
||||
if (currentLangParam !== storedLocale) {
|
||||
if (defaultLocale !== storedLocale && currentLangParam !== storedLocale) {
|
||||
console.log("currentLangParam", currentLangParam)
|
||||
console.log("storedLocale", storedLocale)
|
||||
urlParams.set('lang', storedLocale);
|
||||
currentURL.search = urlParams.toString();
|
||||
|
||||
@@ -235,17 +237,20 @@ function handleDropdownItemClick(event) {
|
||||
event.preventDefault();
|
||||
const languageCode = event.currentTarget.dataset.bsLanguageCode;
|
||||
const dropdown = document.getElementById('languageDropdown');
|
||||
|
||||
|
||||
if (languageCode) {
|
||||
localStorage.setItem('languageCode', languageCode);
|
||||
|
||||
const currentUrl = window.location.href;
|
||||
if (currentUrl.indexOf('?lang=') === -1) {
|
||||
window.location.href = currentUrl + '?lang=' + languageCode;
|
||||
} else {
|
||||
window.location.href = currentUrl.replace(/\?lang=\w{2,}/, '?lang=' + languageCode);
|
||||
}
|
||||
|
||||
localStorage.setItem('languageCode', languageCode);
|
||||
const currentLang = document.documentElement.getAttribute('lang');
|
||||
if (currentLang !== languageCode) {
|
||||
console.log("currentLang", currentLang)
|
||||
console.log("languageCode", languageCode)
|
||||
const currentUrl = window.location.href;
|
||||
if (currentUrl.indexOf('?lang=') === -1) {
|
||||
window.location.href = currentUrl + '?lang=' + languageCode;
|
||||
} else {
|
||||
window.location.href = currentUrl.replace(/\?lang=\w{2,}/, '?lang=' + languageCode);
|
||||
}
|
||||
}
|
||||
dropdown.innerHTML = event.currentTarget.innerHTML; // Update the dropdown button's content
|
||||
} else {
|
||||
console.error("Language code is not set for this item.");
|
||||
@@ -258,6 +263,8 @@ function handleDropdownItemClick(event) {
|
||||
<div th:if="${logoutMessage}" class="alert alert-success"
|
||||
th:text="${logoutMessage}"></div>
|
||||
|
||||
|
||||
|
||||
<form th:action="@{login}" method="post">
|
||||
<img class="mb-4" src="favicon.svg" alt="" width="144" height="144">
|
||||
<h1 class="h1 mb-3 fw-normal" th:text="${@appName}">Stirling-PDF</h1>
|
||||
|
||||
Reference in New Issue
Block a user