Password fix and others (#875)

* init

* user and pass to just pass lang update
This commit is contained in:
Anthony Stirling 2024-03-07 20:12:07 +00:00 committed by GitHub
parent 2f703796e9
commit cf4613d043
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 80 additions and 96 deletions

View file

@ -19,6 +19,7 @@ import io.github.pixee.security.SystemCommand;
import jakarta.annotation.PostConstruct;
import stirling.software.SPDF.config.ConfigInitializer;
import stirling.software.SPDF.model.ApplicationProperties;
@SpringBootApplication
@EnableScheduling
@ -28,6 +29,8 @@ public class SPdfApplication {
@Autowired private Environment env;
@Autowired ApplicationProperties applicationProperties;
private static String serverPortStatic;
@Value("${server.port:8080}")
@ -55,6 +58,7 @@ public class SPdfApplication {
logger.error("Error opening browser: {}", e.getMessage());
}
}
logger.info("Running configs {}", applicationProperties.toString());
}
public static void main(String[] args) throws IOException, InterruptedException {
@ -88,7 +92,6 @@ public class SPdfApplication {
private static void printStartupLogs() {
logger.info("Stirling-PDF Started.");
String url = "http://localhost:" + getStaticPort();
logger.info("Navigate to {}", url);
}

View file

@ -31,7 +31,6 @@ import jakarta.servlet.http.HttpServletResponse;
import stirling.software.SPDF.config.security.UserService;
import stirling.software.SPDF.model.Role;
import stirling.software.SPDF.model.User;
import stirling.software.SPDF.model.api.user.UpdateUserDetails;
import stirling.software.SPDF.model.api.user.UsernameAndPass;
@Controller
@ -53,53 +52,6 @@ public class UserController {
return "redirect:/login?registered=true";
}
@PreAuthorize("!hasAuthority('ROLE_DEMO_USER')")
@PostMapping("/change-username-and-password")
public RedirectView changeUsernameAndPassword(
Principal principal,
@ModelAttribute UpdateUserDetails requestModel,
HttpServletRequest request,
HttpServletResponse response,
RedirectAttributes redirectAttributes) {
String currentPassword = requestModel.getPassword();
String newPassword = requestModel.getNewPassword();
String newUsername = requestModel.getNewUsername();
if (principal == null) {
return new RedirectView("/change-creds?messageType=notAuthenticated");
}
Optional<User> userOpt = userService.findByUsername(principal.getName());
if (userOpt == null || userOpt.isEmpty()) {
return new RedirectView("/change-creds?messageType=userNotFound");
}
User user = userOpt.get();
if (!userService.isPasswordCorrect(user, currentPassword)) {
return new RedirectView("/change-creds?messageType=incorrectPassword");
}
if (!user.getUsername().equals(newUsername) && userService.usernameExists(newUsername)) {
return new RedirectView("/change-creds?messageType=usernameExists");
}
userService.changePassword(user, newPassword);
if (newUsername != null
&& newUsername.length() > 0
&& !user.getUsername().equals(newUsername)) {
userService.changeUsername(user, newUsername);
}
userService.changeFirstUse(user, false);
// Logout using Spring's utility
new SecurityContextLogoutHandler().logout(request, response, null);
return new RedirectView("/login?messageType=credsUpdated");
}
@PreAuthorize("!hasAuthority('ROLE_DEMO_USER')")
@PostMapping("/change-username")
public RedirectView changeUsername(
@ -139,6 +91,39 @@ public class UserController {
return new RedirectView("/login?messageType=credsUpdated");
}
@PreAuthorize("!hasAuthority('ROLE_DEMO_USER')")
@PostMapping("/change-password-on-login")
public RedirectView changePasswordOnLogin(
Principal principal,
@RequestParam String currentPassword,
@RequestParam String newPassword,
HttpServletRequest request,
HttpServletResponse response,
RedirectAttributes redirectAttributes) {
if (principal == null) {
return new RedirectView("/change-creds?messageType=notAuthenticated");
}
Optional<User> userOpt = userService.findByUsername(principal.getName());
if (userOpt == null || userOpt.isEmpty()) {
return new RedirectView("/change-creds?messageType=userNotFound");
}
User user = userOpt.get();
if (!userService.isPasswordCorrect(user, currentPassword)) {
return new RedirectView("/change-creds?messageType=incorrectPassword");
}
userService.changePassword(user, newPassword);
userService.changeFirstUse(user, false);
// Logout using Spring's utility
new SecurityContextLogoutHandler().logout(request, response, null);
return new RedirectView("/login?messageType=credsUpdated");
}
@PreAuthorize("!hasAuthority('ROLE_DEMO_USER')")
@PostMapping("/change-password")
public RedirectView changePassword(

View file

@ -110,7 +110,7 @@ settings.accountSettings=Account Settings
changeCreds.title=Change Credentials
changeCreds.header=Update Your Account Details
changeCreds.changeUserAndPassword=You are using default login credentials. Please enter a new password (and username if wanted)
changeCreds.changePassword=You are using default login credentials. Please enter a new password
changeCreds.newUsername=New Username
changeCreds.oldPassword=Current Password
changeCreds.newPassword=New Password
@ -153,7 +153,7 @@ adminUserSettings.extraApiUser=Additional Limited API User
adminUserSettings.webOnlyUser=Web Only User
adminUserSettings.demoUser=Demo User (No custom settings)
adminUserSettings.internalApiUser=Internal API User
adminUserSettings.forceChange=Force user to change username/password on login
adminUserSettings.forceChange=Force user to change password on login
adminUserSettings.submit=Save User
#############

View file

@ -110,7 +110,7 @@ settings.accountSettings=Настройки на акаунта
changeCreds.title=Промяна на идентификационните данни
changeCreds.header=Актуализирайте данните за акаунта си
changeCreds.changeUserAndPassword=Използвате идентификационни данни за вход по подразбиране. Моля, въведете нова парола (и потребителско име, ако искате)
changeCreds.changePassword=You are using default login credentials. Please enter a new password
changeCreds.newUsername=Ново потребителско име
changeCreds.oldPassword=Текуща парола
changeCreds.newPassword=Нова парола

View file

@ -110,7 +110,7 @@ settings.accountSettings=Account Settings
changeCreds.title=Change Credentials
changeCreds.header=Update Your Account Details
changeCreds.changeUserAndPassword=You are using default login credentials. Please enter a new password (and username if wanted)
changeCreds.changePassword=You are using default login credentials. Please enter a new password
changeCreds.newUsername=New Username
changeCreds.oldPassword=Current Password
changeCreds.newPassword=New Password
@ -153,7 +153,7 @@ adminUserSettings.extraApiUser=Additional Limited API User
adminUserSettings.webOnlyUser=Usuari només WEB
adminUserSettings.demoUser=Demo User (No custom settings)
adminUserSettings.internalApiUser=Internal API User
adminUserSettings.forceChange=Force user to change username/password on login
adminUserSettings.forceChange=Force user to change password on login
adminUserSettings.submit=Desar Usuari
#############

View file

@ -110,7 +110,7 @@ settings.accountSettings=Kontoeinstellungen
changeCreds.title=Anmeldeinformationen ändern
changeCreds.header=Aktualisieren Sie Ihre Kontodaten
changeCreds.changeUserAndPassword=Sie verwenden Standard-Anmeldeinformationen. Bitte geben Sie ein neues Passwort (und ggf. einen Benutzernamen) ein.
changeCreds.changePassword=You are using default login credentials. Please enter a new password
changeCreds.newUsername=Neuer Benutzername
changeCreds.oldPassword=Aktuelles Passwort
changeCreds.newPassword=Neues Passwort

View file

@ -110,7 +110,7 @@ settings.accountSettings=\u03A1\u03C5\u03B8\u03BC\u03AF\u03C3\u03B5\u03B9\u03C2
changeCreds.title=\u0391\u03BB\u03BB\u03B1\u03B3\u03AE \u0394\u03B9\u03B1\u03C0\u03B9\u03C3\u03C4\u03B5\u03C5\u03C4\u03B7\u03C1\u03AF\u03C9\u03BD
changeCreds.header=\u0395\u03BD\u03B7\u03BC\u03AD\u03C1\u03C9\u03C3\u03B7 \u03C4\u03C9\u03BD \u03BB\u03B5\u03C0\u03C4\u03BF\u03BC\u03B5\u03C1\u03B5\u03B9\u03CE\u03BD \u03C4\u03BF\u03C5 \u039B\u03BF\u03B3\u03B1\u03C1\u03B9\u03B1\u03C3\u03BC\u03BF\u03CD \u03C3\u03B1\u03C2
changeCreds.changeUserAndPassword=\u03A7\u03C1\u03B7\u03C3\u03B9\u03BC\u03BF\u03C0\u03BF\u03B9\u03B5\u03AF\u03C4\u03B5 \u03C4\u03B1 \u03C0\u03C1\u03BF\u03B5\u03C0\u03B9\u03BB\u03B5\u03B3\u03BC\u03AD\u03BD\u03B1 \u03B4\u03B9\u03B1\u03C0\u03B9\u03C3\u03C4\u03B5\u03C5\u03C4\u03AE\u03C1\u03B9\u03B1 \u03C3\u03CD\u03BD\u03B4\u03B5\u03C3\u03B7\u03C2. \u03A0\u03B1\u03C1\u03B1\u03BA\u03B1\u03BB\u03CE \u03B5\u03B9\u03C3\u03AC\u03B3\u03B5\u03C4\u03B5 \u03BD\u03AD\u03BF \u03BA\u03C9\u03B4\u03B9\u03BA\u03CC \u03C0\u03C1\u03CC\u03C3\u03B2\u03B1\u03C3\u03B7\u03C2 (\u03BA\u03B1\u03B9 \u03CC\u03BD\u03BF\u03BC\u03B1 \u03C7\u03C1\u03AE\u03C3\u03C4\u03B7 \u03B1\u03BD \u03C4\u03BF \u03B5\u03C0\u03B9\u03B8\u03C5\u03BC\u03B5\u03AF\u03C4\u03B5)
changeCreds.changePassword=You are using default login credentials. Please enter a new password
changeCreds.newUsername=\u039D\u03AD\u03BF \u038C\u03BD\u03BF\u03BC\u03B1 \u03A7\u03C1\u03AE\u03C3\u03C4\u03B7
changeCreds.oldPassword=\u03A4\u03C1\u03AD\u03C7\u03C9\u03BD \u039A\u03C9\u03B4\u03B9\u03BA\u03CC\u03C2 \u03A0\u03C1\u03CC\u03C3\u03B2\u03B1\u03C3\u03B7\u03C2
changeCreds.newPassword=\u039D\u03AD\u03BF\u03C2 \u039A\u03C9\u03B4\u03B9\u03BA\u03CC\u03C2 \u03A0\u03C1\u03CC\u03C3\u03B2\u03B1\u03C3\u03B7\u03C2

View file

@ -110,7 +110,7 @@ settings.accountSettings=Account Settings
changeCreds.title=Change Credentials
changeCreds.header=Update Your Account Details
changeCreds.changeUserAndPassword=You are using default login credentials. Please enter a new password (and username if wanted)
changeCreds.changePassword=You are using default login credentials. Please enter a new password
changeCreds.newUsername=New Username
changeCreds.oldPassword=Current Password
changeCreds.newPassword=New Password
@ -153,7 +153,7 @@ adminUserSettings.extraApiUser=Additional Limited API User
adminUserSettings.webOnlyUser=Web Only User
adminUserSettings.demoUser=Demo User (No custom settings)
adminUserSettings.internalApiUser=Internal API User
adminUserSettings.forceChange = Force user to change username/password on login
adminUserSettings.forceChange=Force user to change password on login
adminUserSettings.submit=Save User
#############

View file

@ -110,7 +110,7 @@ settings.accountSettings=Account Settings
changeCreds.title=Change Credentials
changeCreds.header=Update Your Account Details
changeCreds.changeUserAndPassword=You are using default login credentials. Please enter a new password (and username if wanted)
changeCreds.changePassword=You are using default login credentials. Please enter a new password
changeCreds.newUsername=New Username
changeCreds.oldPassword=Current Password
changeCreds.newPassword=New Password
@ -153,7 +153,7 @@ adminUserSettings.extraApiUser=Additional Limited API User
adminUserSettings.webOnlyUser=Web Only User
adminUserSettings.demoUser=Demo User (No custom settings)
adminUserSettings.internalApiUser=Internal API User
adminUserSettings.forceChange=Force user to change username/password on login
adminUserSettings.forceChange=Force user to change password on login
adminUserSettings.submit=Save User
#############

View file

@ -110,7 +110,7 @@ settings.accountSettings=Configuración de la cuenta
changeCreds.title=Cambiar Credenciales
changeCreds.header=Actualice los detalles de su cuenta
changeCreds.changeUserAndPassword=Está usando las credenciales por defecto. Por favor, introduzca una nueva contraseña (y usuario si lo desea)
changeCreds.changePassword=You are using default login credentials. Please enter a new password
changeCreds.newUsername=Nuevo usuario
changeCreds.oldPassword=Contraseña actual
changeCreds.newPassword=Nueva contraseña

View file

@ -110,7 +110,7 @@ settings.accountSettings=Kontuaren ezarpenak
changeCreds.title=Change Credentials
changeCreds.header=Update Your Account Details
changeCreds.changeUserAndPassword=You are using default login credentials. Please enter a new password (and username if wanted)
changeCreds.changePassword=You are using default login credentials. Please enter a new password
changeCreds.newUsername=New Username
changeCreds.oldPassword=Current Password
changeCreds.newPassword=New Password
@ -153,7 +153,7 @@ adminUserSettings.extraApiUser=Additional Limited API User
adminUserSettings.webOnlyUser=Web-erabiltzailea bakarrik
adminUserSettings.demoUser=Demo User (No custom settings)
adminUserSettings.internalApiUser=Internal API User
adminUserSettings.forceChange=Force user to change username/password on login
adminUserSettings.forceChange=Force user to change password on login
adminUserSettings.submit=Gorde Erabiltzailea
#############

View file

@ -110,7 +110,7 @@ settings.accountSettings=Paramètres du compte
changeCreds.title=Modifiez vos identifiants
changeCreds.header=Mettez à jour vos identifiants de connexion
changeCreds.changeUserAndPassword=Vous utilisez les identifiants de connexion par défaut. Veuillez entrer un nouveau mot de passe (et nom d\u2019utilisateur si vous le souhaitez)
changeCreds.changePassword=You are using default login credentials. Please enter a new password
changeCreds.newUsername=Nouveau nom d\u2019utilisateur
changeCreds.oldPassword=Mot de passe actuel
changeCreds.newPassword=Nouveau mot de passe

View file

@ -110,7 +110,7 @@ settings.accountSettings=खाता सेटिंग्स
changeCreds.title=क्रेडेंशियल बदलें
changeCreds.header=अपना खाता विवरण अपडेट करें
changeCreds.changeUserAndPassword=आप डिफ़ॉल्ट लॉगिन क्रेडेंशियल का उपयोग कर रहे हैं। कृपया एक नया पासवर्ड दर्ज करें (और यदि चाहें तो उपयोगकर्ता नाम)
changeCreds.changePassword=You are using default login credentials. Please enter a new password
changeCreds.newUsername=नया उपयोगकर्ता नाम
changeCreds.oldPassword=वर्तमान पासवर्ड
changeCreds.newPassword=नया पासवर्ड

View file

@ -110,7 +110,7 @@ settings.accountSettings=Fiókbeállítások
changeCreds.title=Hitelesítés megváltoztatása
changeCreds.header=Frissítse fiókadatait
changeCreds.changeUserAndPassword=Alapértelmezett bejelentkezési adatokat használ. Adjon meg egy új jelszót (és felhasználónevet, ha szeretné)
changeCreds.changePassword=You are using default login credentials. Please enter a new password
changeCreds.newUsername=Új felhasználónév
changeCreds.oldPassword=Jelenlegi jelszó
changeCreds.newPassword=Új jelszó

View file

@ -110,7 +110,7 @@ settings.accountSettings=Pengaturan Akun
changeCreds.title=Ubah Kredensial
changeCreds.header=Perbarui Detail Akun Anda
changeCreds.changeUserAndPassword=Anda menggunakan kredensial masuk default. Masukkan kata sandi baru (dan nama pengguna jika diinginkan)
changeCreds.changePassword=You are using default login credentials. Please enter a new password
changeCreds.newUsername=Nama Pengguna Baru
changeCreds.oldPassword=Kata Sandi Saat Ini
changeCreds.newPassword=Kata Sandi Baru

View file

@ -110,7 +110,7 @@ settings.accountSettings=Impostazioni Account
changeCreds.title=Cambia credenziali
changeCreds.header=Aggiorna i dettagli del tuo account
changeCreds.changeUserAndPassword=Stai utilizzando le credenziali di accesso predefinite. Inserisci una nuova password (e un nome utente se lo desideri)
changeCreds.changePassword=You are using default login credentials. Please enter a new password
changeCreds.newUsername=Nuovo nome utente
changeCreds.oldPassword=Password attuale
changeCreds.newPassword=Nuova Password

View file

@ -110,7 +110,7 @@ settings.accountSettings=アカウント設定
changeCreds.title=資格情報の変更
changeCreds.header=アカウントの詳細を更新する
changeCreds.changeUserAndPassword=デフォルトのログイン認証情報を使用しています。新しいパスワード (必要に応じてユーザー名も) を入力してください
changeCreds.changePassword=You are using default login credentials. Please enter a new password
changeCreds.newUsername=新しいユーザー名
changeCreds.oldPassword=現在のパスワード
changeCreds.newPassword=新しいパスワード

View file

@ -110,7 +110,7 @@ settings.accountSettings=계정 설정
changeCreds.title=계정 정보 변경
changeCreds.header=계정 정보 업데이트
changeCreds.changeUserAndPassword=기본 제공된 로그인 정보를 사용하고 있습니다. 새 비밀번호를 입력합니다. (필요하다면 사용자명을 변경할 수 있습니다.)
changeCreds.changePassword=You are using default login credentials. Please enter a new password
changeCreds.newUsername=새 사용자명
changeCreds.oldPassword=현재 비밀번호
changeCreds.newPassword=새 비밀번호

View file

@ -110,7 +110,7 @@ settings.accountSettings=Account instellingen
changeCreds.title=Inloggegevens wijzigen
changeCreds.header=Werk je accountgegevens bij
changeCreds.changeUserAndPassword=Je gebruikt de standaard inloggegevens. Voer een nieuw wachtwoord in (en eventueel een gebruikersnaam)
changeCreds.changePassword=You are using default login credentials. Please enter a new password
changeCreds.newUsername=Nieuwe gebruikersnaam
changeCreds.oldPassword=Huidige wachtwoord
changeCreds.newPassword=Nieuw wachtwoord

View file

@ -110,7 +110,7 @@ settings.accountSettings=Account Settings
changeCreds.title=Change Credentials
changeCreds.header=Update Your Account Details
changeCreds.changeUserAndPassword=You are using default login credentials. Please enter a new password (and username if wanted)
changeCreds.changePassword=You are using default login credentials. Please enter a new password
changeCreds.newUsername=New Username
changeCreds.oldPassword=Current Password
changeCreds.newPassword=New Password
@ -153,7 +153,7 @@ adminUserSettings.extraApiUser=Additional Limited API User
adminUserSettings.webOnlyUser=Web Only User
adminUserSettings.demoUser=Demo User (No custom settings)
adminUserSettings.internalApiUser=Internal API User
adminUserSettings.forceChange=Force user to change username/password on login
adminUserSettings.forceChange=Force user to change password on login
adminUserSettings.submit=Save User
#############

View file

@ -110,7 +110,7 @@ settings.accountSettings=Account Settings
changeCreds.title=Change Credentials
changeCreds.header=Update Your Account Details
changeCreds.changeUserAndPassword=You are using default login credentials. Please enter a new password (and username if wanted)
changeCreds.changePassword=You are using default login credentials. Please enter a new password
changeCreds.newUsername=New Username
changeCreds.oldPassword=Current Password
changeCreds.newPassword=New Password
@ -153,7 +153,7 @@ adminUserSettings.extraApiUser=Additional Limited API User
adminUserSettings.webOnlyUser=Web Only User
adminUserSettings.demoUser=Demo User (No custom settings)
adminUserSettings.internalApiUser=Internal API User
adminUserSettings.forceChange=Force user to change username/password on login
adminUserSettings.forceChange=Force user to change password on login
adminUserSettings.submit=Save User
#############

View file

@ -110,7 +110,7 @@ settings.accountSettings=Configuração de Conta
changeCreds.title=Alterar senha
changeCreds.header=Alterar dados da sua conta
changeCreds.changeUserAndPassword=Está usando a senha padrão. Por favor, digite uma nova senha (e nome de utilizador, se desejar)
changeCreds.changePassword=You are using default login credentials. Please enter a new password
changeCreds.newUsername=Novo Utilizador
changeCreds.oldPassword=Senha Atual
changeCreds.newPassword=Nova Senha
@ -153,7 +153,7 @@ adminUserSettings.extraApiUser=Additional Limited API User
adminUserSettings.webOnlyUser=Web Only User
adminUserSettings.demoUser=Demo User (No custom settings)
adminUserSettings.internalApiUser=Internal API User
adminUserSettings.forceChange=Force user to change username/password on login
adminUserSettings.forceChange=Force user to change password on login
adminUserSettings.submit=Save User
#############

View file

@ -110,7 +110,7 @@ settings.accountSettings=Account Settings
changeCreds.title=Change Credentials
changeCreds.header=Update Your Account Details
changeCreds.changeUserAndPassword=You are using default login credentials. Please enter a new password (and username if wanted)
changeCreds.changePassword=You are using default login credentials. Please enter a new password
changeCreds.newUsername=New Username
changeCreds.oldPassword=Current Password
changeCreds.newPassword=New Password
@ -153,7 +153,7 @@ adminUserSettings.extraApiUser=Additional Limited API User
adminUserSettings.webOnlyUser=Web Only User
adminUserSettings.demoUser=Demo User (No custom settings)
adminUserSettings.internalApiUser=Internal API User
adminUserSettings.forceChange=Force user to change username/password on login
adminUserSettings.forceChange=Force user to change password on login
adminUserSettings.submit=Save User
#############

View file

@ -110,7 +110,7 @@ settings.accountSettings=Account Settings
changeCreds.title=Change Credentials
changeCreds.header=Update Your Account Details
changeCreds.changeUserAndPassword=You are using default login credentials. Please enter a new password (and username if wanted)
changeCreds.changePassword=You are using default login credentials. Please enter a new password
changeCreds.newUsername=New Username
changeCreds.oldPassword=Current Password
changeCreds.newPassword=New Password
@ -153,7 +153,7 @@ adminUserSettings.extraApiUser=Additional Limited API User
adminUserSettings.webOnlyUser=Web Only User
adminUserSettings.demoUser=Demo User (No custom settings)
adminUserSettings.internalApiUser=Internal API User
adminUserSettings.forceChange=Force user to change username/password on login
adminUserSettings.forceChange=Force user to change password on login
adminUserSettings.submit=Save User
#############

View file

@ -110,7 +110,7 @@ settings.accountSettings=Podešavanja naloga
changeCreds.title=Promeni pristupne podatke
changeCreds.header=Ažurirajte detalje svog naloga
changeCreds.changeUserAndPassword=Koristite podrazumevane prijavne podatke. Unesite novu lozinku (i korisničko ime ako želite)
changeCreds.changePassword=You are using default login credentials. Please enter a new password
changeCreds.newUsername=Novo korisničko ime
changeCreds.oldPassword=Trenutna lozinka
changeCreds.newPassword=Nova lozinka

View file

@ -110,7 +110,7 @@ settings.accountSettings=Account Settings
changeCreds.title=Change Credentials
changeCreds.header=Update Your Account Details
changeCreds.changeUserAndPassword=You are using default login credentials. Please enter a new password (and username if wanted)
changeCreds.changePassword=You are using default login credentials. Please enter a new password
changeCreds.newUsername=New Username
changeCreds.oldPassword=Current Password
changeCreds.newPassword=New Password
@ -153,7 +153,7 @@ adminUserSettings.extraApiUser=Additional Limited API User
adminUserSettings.webOnlyUser=Web Only User
adminUserSettings.demoUser=Demo User (No custom settings)
adminUserSettings.internalApiUser=Internal API User
adminUserSettings.forceChange=Force user to change username/password on login
adminUserSettings.forceChange=Force user to change password on login
adminUserSettings.submit=Save User
#############

View file

@ -110,7 +110,7 @@ settings.accountSettings=Hesap Ayarları
changeCreds.title=Giriş Bilgilerini Değiştir
changeCreds.header=Hesap Detaylarınızı Güncelleyin
changeCreds.changeUserAndPassword=Varsayılan giriş bilgilerini kullanıyorsunuz. Lütfen yeni bir şifre (ve istenirse kullanıcı adı) girin
changeCreds.changePassword=You are using default login credentials. Please enter a new password
changeCreds.newUsername=Yeni Kullanıcı Adı
changeCreds.oldPassword=Mevcut Şifre
changeCreds.newPassword=Yeni Şifre

View file

@ -110,7 +110,7 @@ settings.accountSettings=帐号设定
changeCreds.title=更改凭证
changeCreds.header=更新您的账户详情
changeCreds.changeUserAndPassword=您正在使用默认登录凭据。请输入新密码(如果需要,还可以输入新用户名)
changeCreds.changePassword=You are using default login credentials. Please enter a new password
changeCreds.newUsername=新用户名
changeCreds.oldPassword=当前密码
changeCreds.newPassword=新密码

View file

@ -110,7 +110,7 @@ settings.accountSettings=帳戶設定
changeCreds.title=變更憑證
changeCreds.header=更新您的帳戶詳細資訊
changeCreds.changeUserAndPassword=您正在使用預設的登入憑證。請輸入新的密碼(如果需要,也可以輸入使用者名稱)
changeCreds.changePassword=You are using default login credentials. Please enter a new password
changeCreds.newUsername=新使用者名稱
changeCreds.oldPassword=目前密碼
changeCreds.newPassword=新密碼

View file

@ -36,15 +36,11 @@
<!-- Change Username Form -->
<h4></h4>
<h4 th:text="#{changeCreds.changeUserAndPassword}">Change Username and password</h4>
<form action="api/v1/user/change-username-and-password" method="post">
<h4 th:text="#{changeCreds.changePassword}">Change password</h4>
<form action="api/v1/user/change-password-on-login" method="post">
<div class="mb-3">
<label for="username" th:text="#{changeCreds.newUsername}">New Username</label>
<input type="text" class="form-control" name="username" id="username" th:placeholder="${username}">
</div>
<div class="mb-3">
<label for="password" th:text="#{changeCreds.oldPassword}">Old Password</label>
<input type="password" class="form-control" name="password" id="password" th:placeholder="#{changeCreds.oldPassword}">
<label for="currentPassword" th:text="#{changeCreds.oldPassword}">Old Password</label>
<input type="password" class="form-control" name="currentPassword" id="currentPassword" th:placeholder="#{changeCreds.oldPassword}">
</div>
<div class="mb-3">
<label for="newPassword" th:text="#{changeCreds.newPassword}">New Password</label>
@ -60,7 +56,7 @@
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector('form[action="api/v1/user/change-username-and-password"]');
const form = document.querySelector('form[action="api/v1/user/change-password-on-login"]');
form.addEventListener('submit', function(event) {
const newPassword = document.getElementById('newPassword').value;