Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Make (push) Successful in 9s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-CMake (push) Successful in 14s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Meson (push) Failing after 8s
35 lines
1.4 KiB
JavaScript
35 lines
1.4 KiB
JavaScript
const changepasswordform = document.querySelector('.changepasswordform')
|
|
const cancelchangepassword = document.querySelector('#cancelchangepassword')
|
|
const changepasswordformbody = document.querySelector('.changepasswordformbody')
|
|
const changepasswordnewpassword = document.querySelector('#changepasswordnewpassword')
|
|
|
|
let changepassuserid = "";
|
|
|
|
const change_password = (userid) => {
|
|
changepasswordform.classList.add('active')
|
|
changepassuserid = userid
|
|
}
|
|
|
|
cancelchangepassword.addEventListener('click', e => {
|
|
e.preventDefault()
|
|
changepasswordform.classList.remove('active')
|
|
})
|
|
|
|
changepasswordformbody.addEventListener('submit', async e => {
|
|
e.preventDefault()
|
|
const hashedpassword = await hashPassword(changepasswordnewpassword.value)
|
|
const status = await fetch(routes.change_password_url(), {
|
|
method: 'POST',
|
|
body: `{"token":"${localStorage.getItem('token')}","userid":${changepassuserid},"new_password":"${hashedpassword}"}`
|
|
}).then(data => data.json()).then(jsondata => jsondata).catch((error) => {
|
|
notification(`Ошибка на сервере: ${error}`, "error")
|
|
})
|
|
if (!status.error) {
|
|
notification("Пароль успешно изменен", "success")
|
|
changepasswordform.classList.remove('active')
|
|
changepasswordnewpassword.value = ""
|
|
} else {
|
|
notification(status.error, "error")
|
|
}
|
|
})
|