C
C#2y ago
gamer50082

✅ need someone to fix a html for me

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Login</title>
</head>
<body>
<h1>Login</h1>
<form action="http://144.24.154.156:5445/login" method="POST">
<label for="username">Username:</label>
<input type="text" id="username" name="username" required><br><br>
<label for="password">Password:</label>
<input type="password" id="password" name="password" required><br><br>
<button type="submit">Login</button>
</form>

<h1>Register</h1>
<form action="http://144.24.154.156:5445/register" method="POST">
<label for="username">Username:</label>
<input type="text" id="username" name="username" required><br><br>
<label for="password">Password:</label>
<input type="password" id="password" name="password" required><br><br>
<label for="confirm-password">Confirm Password:</label>
<input type="password" id="confirm-password" name="confirm-password" required><br><br>
<button type="submit">Register</button>
</form>

<script>
// Parse the query string to get the token parameter
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const token = urlParams.get('token');

// If a token was received, display it
if (token) {
const tokenElement = document.createElement('p');
tokenElement.textContent = `Your token is: ${token}`;
document.body.appendChild(tokenElement);
}
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Login</title>
</head>
<body>
<h1>Login</h1>
<form action="http://144.24.154.156:5445/login" method="POST">
<label for="username">Username:</label>
<input type="text" id="username" name="username" required><br><br>
<label for="password">Password:</label>
<input type="password" id="password" name="password" required><br><br>
<button type="submit">Login</button>
</form>

<h1>Register</h1>
<form action="http://144.24.154.156:5445/register" method="POST">
<label for="username">Username:</label>
<input type="text" id="username" name="username" required><br><br>
<label for="password">Password:</label>
<input type="password" id="password" name="password" required><br><br>
<label for="confirm-password">Confirm Password:</label>
<input type="password" id="confirm-password" name="confirm-password" required><br><br>
<button type="submit">Register</button>
</form>

<script>
// Parse the query string to get the token parameter
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const token = urlParams.get('token');

// If a token was received, display it
if (token) {
const tokenElement = document.createElement('p');
tokenElement.textContent = `Your token is: ${token}`;
document.body.appendChild(tokenElement);
}
</script>
</body>
</html>
16 Replies
gamer50082
gamer50082OP2y ago
the ip is my server ip
JakenVeina
JakenVeina2y ago
no one here is going to write code for you
gamer50082
gamer50082OP2y ago
help me fix*
JakenVeina
JakenVeina2y ago
hehe, yeah, that's different what's your issue
gamer50082
gamer50082OP2y ago
error after reg login works fine reg doesnt
JakenVeina
JakenVeina2y ago
what is "reg"?
gamer50082
gamer50082OP2y ago
register
// Define a registration API endpoint
app.post('/register', limiter, async (req, res) => {
try {
const { username, password } = req.body;

// Check if username is already taken
const existingUser = await User.findOne({ username });
if (existingUser) {
return res.status(400).json({ message: 'Username is already taken' });
}

// Create a new user with a random 16-character token
const token = generateToken();
const user = new User({ username, password, token });
await user.save();

// Return the token to the requester
res.json({ token });
} catch (err) {
console.error(err);
res.status(500).json({ message: 'Internal server error' });
}
});
// Define a registration API endpoint
app.post('/register', limiter, async (req, res) => {
try {
const { username, password } = req.body;

// Check if username is already taken
const existingUser = await User.findOne({ username });
if (existingUser) {
return res.status(400).json({ message: 'Username is already taken' });
}

// Create a new user with a random 16-character token
const token = generateToken();
const user = new User({ username, password, token });
await user.save();

// Return the token to the requester
res.json({ token });
} catch (err) {
console.error(err);
res.status(500).json({ message: 'Internal server error' });
}
});
just incase u want to know what register does the html sends a post api suppose to add user to mongodb
Angius
Angius2y ago
Wait, your backend is in JS?
JakenVeina
JakenVeina2y ago
is this all JS?
Angius
Angius2y ago
$js
Angius
Angius2y ago
Might get more help there This is a C# server
gamer50082
gamer50082OP2y ago
html is hosted on replit oh i see going to host a discord bot in nodejs
gamer50082
gamer50082OP2y ago
then i will be back here to fix my winform
Want results from more Discord servers?
Add your server