File size: 785 Bytes
dbc8392
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function login() {
    const username = document.getElementById('login-username').value;
    const password = document.getElementById('login-password').value;
    apiPost('/auth/login', { username, password })
        .then(data => showResult('login-result', data))
        .catch(err => console.error(err));
}

function changePassword() {
    const username = document.getElementById('change-username').value;
    const oldPassword = document.getElementById('old-password').value;
    const newPassword = document.getElementById('new-password').value;
    apiPost('/auth/change_password', { username, old_password: oldPassword, new_password: newPassword })
        .then(data => showResult('change-password-result', data))
        .catch(err => console.error(err));
}