Skip to content

Commit

Permalink
Merge pull request #192 from itzz-keerthi/master
Browse files Browse the repository at this point in the history
Added user registration form
  • Loading branch information
shreyamalogi authored Oct 17, 2024
2 parents bc2c357 + 5cb7e4c commit 6df744e
Show file tree
Hide file tree
Showing 3 changed files with 161 additions and 0 deletions.
50 changes: 50 additions & 0 deletions web/pages/keerthana.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>User Registration</title>
<link rel="stylesheet" href="keerthana.css">
</head>
<body>
<div class="container">
<div class="form-box">
<h2>Login</h2>
<form id="loginForm">
<div class="input-group">
<label for="loginEmail">Email</label>
<input type="email" id="loginEmail" required>
</div>
<div class="input-group">
<label for="loginPassword">Password</label>
<input type="password" id="loginPassword" required>
</div>
<button type="submit">Login</button>
<p class="error-message" id="loginError"></p>
</form>
</div>

<div class="form-box">
<h2>Sign Up</h2>
<form id="signUpForm">
<div class="input-group">
<label for="signUpEmail">Email</label>
<input type="email" id="signUpEmail" required>
</div>
<div class="input-group">
<label for="signUpPassword">Password</label>
<input type="password" id="signUpPassword" required>
</div>
<div class="input-group">
<label for="confirmPassword">Confirm Password</label>
<input type="password" id="confirmPassword" required>
</div>
<button type="submit">Sign Up</button>
<p class="error-message" id="signUpError"></p>
</form>
</div>
</div>

<script src="keerthana.js"></script>
</body>
</html>
38 changes: 38 additions & 0 deletions web/scripts/keerthana.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
document.getElementById('loginForm').addEventListener('submit', function(e) {
e.preventDefault();

const email = document.getElementById('loginEmail').value;
const password = document.getElementById('loginPassword').value;
const errorMessage = document.getElementById('loginError');

// Basic validation
if (email === '' || password === '') {
errorMessage.innerText = 'All fields are required!';
errorMessage.style.display = 'block';
} else {
errorMessage.style.display = 'none';
alert('Login Successful!');
}
});

document.getElementById('signUpForm').addEventListener('submit', function(e) {
e.preventDefault();

const email = document.getElementById('signUpEmail').value;
const password = document.getElementById('signUpPassword').value;
const confirmPassword = document.getElementById('confirmPassword').value;
const errorMessage = document.getElementById('signUpError');

// Basic validation
if (email === '' || password === '' || confirmPassword === '') {
errorMessage.innerText = 'All fields are required!';
errorMessage.style.display = 'block';
} else if (password !== confirmPassword) {
errorMessage.innerText = 'Passwords do not match!';
errorMessage.style.display = 'block';
} else {
errorMessage.style.display = 'none';
alert('Sign Up Successful!');
}
});

73 changes: 73 additions & 0 deletions web/stylesheet/keerthana.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: Arial, sans-serif;
}

body {
background-color: #f7f7f7;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}

.container {
display: flex;
gap: 20px;
}

.form-box {
background-color: #fff;
padding: 20px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
border-radius: 8px;
width: 300px;
}

h2 {
margin-bottom: 20px;
color: #333;
}

.input-group {
margin-bottom: 15px;
}

.input-group label {
display: block;
margin-bottom: 5px;
color: #333;
}

.input-group input {
width: 100%;
padding: 10px;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 16px;
}

button {
width: 100%;
padding: 10px;
background-color: #28a745;
color: white;
border: none;
border-radius: 4px;
font-size: 16px;
cursor: pointer;
}

button:hover {
background-color: #218838;
}

.error-message {
color: red;
font-size: 14px;
margin-top: 10px;
display: none;
}

0 comments on commit 6df744e

Please sign in to comment.