changements mineurs

This commit is contained in:
batche
2022-12-08 14:01:07 +01:00
parent 8c2df71cde
commit b00c9e1474

View File

@@ -52,22 +52,19 @@
})
const settingsHandler = async() => {
let valid = false;
// I don't really care which i use at this point...
// if (set.username === nameTmp) {
if ((set.username.trim() === '')) {
if ((set.username.trim() === '') && set.tfa === user.isEnabledTwoFactorAuth) {
errors.username = 'Invalid new username';
return;
}
else if (set.username === user.username){
errors.username = "You must choose a different username than the previous"
return;
else if ((set.username.trim() === '') && set.tfa !== user.isEnabledTwoFactorAuth) {
set.username = user.username
}
else {
errors.username = '';
}
const res = await fetch('http://transcendance:8080/api/v2/user',{
await fetch('http://transcendance:8080/api/v2/user',{
method: 'PATCH',
headers: {
'Content-Type': 'application/json'