Passwords stored salt and some change is password logic
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user