( bad ) lil error message on failed login

This commit is contained in:
Madeline 2022-06-27 16:40:40 +10:00
parent 83ed84c4de
commit 845d932e83
2 changed files with 15 additions and 3 deletions

View File

@ -89,6 +89,13 @@
#loginDiscord { #loginDiscord {
background-color: var(--background-login-discord); background-color: var(--background-login-discord);
} }
#failure {
width: 100%;
margin-top: 10px;
color: rgb(200, 20, 20);
display: none;
}
</style> </style>
</head> </head>
@ -98,8 +105,11 @@
<div class="header"> <div class="header">
<h1>Welcome to Slowcord</h1> <h1>Welcome to Slowcord</h1>
<p>Glad to see you &lt;3 </p> <p>Glad to see you &lt;3 </p>
<p id="failure">Login failed</p>
</div> </div>
<form action="javascript:void(0);"> <form action="javascript:void(0);">
<label for="email">Email</label> <label for="email">Email</label>
<input type="email" name="email" /> <input type="email" name="email" />
@ -107,7 +117,7 @@
<label for="password">Password</label> <label for="password">Password</label>
<input type="password" name="password" /> <input type="password" name="password" />
<input type="submit" /> <input type="submit" value="Login" />
<a <a
id="loginDiscord" id="loginDiscord"
@ -157,7 +167,10 @@
if (json.token) { if (json.token) {
window.localStorage.setItem("token", `"${json.token}"`); window.localStorage.setItem("token", `"${json.token}"`);
window.location.href = "/app"; window.location.href = "/app";
return;
} }
document.getElementById("failure").style.display = "block";
}) })
</script> </script>
</body> </body>

View File

@ -71,9 +71,8 @@ const handlers: { [key: string]: any; } = {
app.get("/oauth/:type", async (req, res) => { app.get("/oauth/:type", async (req, res) => {
const { type } = req.params; const { type } = req.params;
if (!type) return res.sendStatus(400);
const handler = handlers[type]; const handler = handlers[type];
if (!handler) return res.sendStatus(400); if (!type || !handler) return res.sendStatus(400);
const data = await handler.getAccessToken(req, res); const data = await handler.getAccessToken(req, res);
if (!data) return res.sendStatus(500); if (!data) return res.sendStatus(500);