Skip to content
This repository has been archived by the owner on Nov 3, 2024. It is now read-only.

Commit

Permalink
Merge pull request #44 from CR072/patch-2
Browse files Browse the repository at this point in the history
Disable authentication while signups are disabled.
  • Loading branch information
jojobingsa authored Apr 28, 2024
2 parents 13b1f6a + d5acde0 commit a1c0e06
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions routes/auth/email.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const fetch = require("node-fetch");

module.exports.load = async function(app, ejs, db) {
app.get("/auth/login", async (req, res) => {
if (!settings.api.client.passwordgenerator.signup == true) return res.send("Email auth is disabled!")
if (!req.query.email || !req.query.password) return res.send("<br>Missing information.<br>")
const user = await db.get(`user-${req.query.email}`);
if (!user) return res.send({error: "Invalid Email or Password."});
Expand All @@ -26,6 +27,7 @@ module.exports.load = async function(app, ejs, db) {
});

app.get("/auth/register", async (req, res) => {
if (!settings.api.client.passwordgenerator.signup == true) return res.send("Email auth is disabled!")
if (!req.query.email || !req.query.username || !req.query.password) return res.send("<br> Missing information </br>")
if (await db.get(`user-${req.query.email}`)) return res.send("Already registered.");
const userinfo = {
Expand Down

0 comments on commit a1c0e06

Please sign in to comment.