Passwords stored salt and some change is password logic

This commit is contained in:
2026-08-26 14:51:40 +02:00
parent b3383e29a7
commit dd44b380ce
12 changed files with 374 additions and 18 deletions
+5 -1
View File
@@ -3,6 +3,7 @@
const form = document.querySelector('#login-form');
const status = document.querySelector('#login-status');
const otpInput = document.querySelector('#otp');
form.addEventListener('submit', async (event) => {
event.preventDefault();
@@ -12,7 +13,10 @@ form.addEventListener('submit', async (event) => {
const response = await fetch('/api/auth/login', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify(Object.fromEntries(new FormData(form))),
body: JSON.stringify({
...Object.fromEntries(new FormData(form)),
otp: otpInput.value.trim() || null,
}),
});
if (!response.ok) {
+8
View File
@@ -192,6 +192,14 @@ if (mastodonParams.get('mastodon_error')) setStatus('#mastodon-status', mastodon
passwordForm.addEventListener('submit', async (event) => {
event.preventDefault();
const password = passwordForm.elements.new_password.value;
const confirmation = passwordForm.elements.new_password_confirmation.value;
if (password !== confirmation) {
const status = document.querySelector('#password-status');
status.textContent = 'New passwords do not match.';
status.style.color = '#f38ba8';
return;
}
const response = await fetch('/api/user/password', {
method: 'PUT',
headers: authHeaders(true),
+4
View File
@@ -45,6 +45,10 @@
Password
<input id="password" name="password" type="password" autocomplete="current-password" required />
</label>
<label>
One-time password (when configured)
<input id="otp" name="otp" type="text" inputmode="numeric" autocomplete="one-time-code" placeholder="123456" />
</label>
<button type="submit">Sign in</button>
<p id="login-status" class="status" role="status"></p>
<p><small>A mistyped password sends a reset link to your verified email address.</small></p>
+4
View File
@@ -72,6 +72,10 @@
New password
<input name="new_password" type="password" minlength="8" autocomplete="new-password" required />
</label>
<label>
Confirm new password
<input name="new_password_confirmation" type="password" minlength="8" autocomplete="new-password" required />
</label>
<button type="submit">Change password</button>
<p id="password-status" class="status" role="status"></p>
</form>