mirror of
https://github.com/Derpy-Leggies/OnlyLegs.git
synced 2025-01-01 12:26:13 +00:00
Login not working correctly
This commit is contained in:
parent
ce64821500
commit
3bfa890751
|
@ -80,19 +80,15 @@ function login(event) {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: formData
|
body: formData
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
if (response.status === 200) {
|
if (response.ok) {
|
||||||
location.reload();
|
location.reload();
|
||||||
} else {
|
} else {
|
||||||
switch (response.status) {
|
if (response.status === 403) {
|
||||||
case 500:
|
addNotification('None but devils play past here... Wrong information', 2);
|
||||||
addNotification('Server exploded, F\'s in chat', 2);
|
} else if (response.status === 500) {
|
||||||
break;
|
addNotification('Server exploded, F\'s in chat', 2);
|
||||||
case 403:
|
} else {
|
||||||
addNotification('None but devils play past here... Wrong information', 2);
|
addNotification('Error logging in, blame someone', 2);
|
||||||
break;
|
|
||||||
default:
|
|
||||||
addNotification('Error logging in, blame someone', 2);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
@ -178,30 +174,26 @@ function register(event) {
|
||||||
formData.append("password-repeat", formPasswordRepeat);
|
formData.append("password-repeat", formPasswordRepeat);
|
||||||
|
|
||||||
// Send form to server
|
// Send form to server
|
||||||
fetch('/auth/login', {
|
fetch('/auth/register', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: formData
|
body: formData
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
if (response.status === 200) {
|
if (response.ok) {
|
||||||
if (response === "gwa gwa") {
|
addNotification('Registered successfully! Now please login to continue', 1);
|
||||||
addNotification('Registered successfully! Now please login to continue', 1);
|
showLogin();
|
||||||
showLogin();
|
|
||||||
} else {
|
|
||||||
for (let i = 0; i < response.length; i++) {
|
|
||||||
addNotification(response[i], 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
switch (response.status) {
|
if (response.status === 400) {
|
||||||
case 500:
|
response.json().then(data => {
|
||||||
addNotification('Server exploded, F\'s in chat', 2);
|
for (let i = 0; i < data.length; i++) {
|
||||||
break;
|
addNotification(data[i], 2);
|
||||||
case 403:
|
}
|
||||||
addNotification('None but devils play past here... Wrong information', 2);
|
});
|
||||||
break;
|
} else if (response.status === 403) {
|
||||||
default:
|
addNotification('None but devils play past here... Wrong information', 2);
|
||||||
addNotification('Error logging in, blame someone', 2);
|
} else if (response.status === 500) {
|
||||||
break;
|
addNotification('Server exploded, F\'s in chat', 2);
|
||||||
|
} else {
|
||||||
|
addNotification('Error logging in, blame someone', 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
|
Loading…
Reference in a new issue