Added login page
This commit is contained in:
1 parent
915253161f
commit
7aef86c50c
3 files changed
+181
-232
No files matched your search
@@ -1,37 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>Ask a Question</title>
|
|
||||||
<link rel="stylesheet" href="style.css">
|
|
||||||
</head>
|
|
||||||
<body class="login-signup-page">
|
|
||||||
<section class="section">
|
|
||||||
<div class="container">
|
|
||||||
<div class="box">
|
|
||||||
<h1 class="title">Ask a Question</h1>
|
|
||||||
<form>
|
|
||||||
<div class="field">
|
|
||||||
<label class="label">Title</label>
|
|
||||||
<div class="control">
|
|
||||||
<input class="input" type="text" placeholder="Enter your question title">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="field">
|
|
||||||
<label class="label">Body</label>
|
|
||||||
<div class="control">
|
|
||||||
<textarea class="textarea" placeholder="Enter your question details"></textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="field">
|
|
||||||
<div class="control">
|
|
||||||
<button class="button is-primary" type="submit">Submit</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
+3
-26
@@ -33,7 +33,7 @@
|
|||||||
nearby
|
nearby
|
||||||
</a>
|
</a>
|
||||||
<!-- Added 'past' menu item -->
|
<!-- Added 'past' menu item -->
|
||||||
<a class="navbar-item" href="#" id="past-button">
|
<a class="navbar-item" href="#">
|
||||||
past
|
past
|
||||||
</a>
|
</a>
|
||||||
<a class="navbar-item" href="#">
|
<a class="navbar-item" href="#">
|
||||||
@@ -48,7 +48,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="navbar-end">
|
<div class="navbar-end">
|
||||||
<div class="navbar-item">
|
<div class="navbar-item">
|
||||||
<a href="#">@handle</a>
|
<!-- Changed @handle to login link -->
|
||||||
|
<a href="/login.html">login</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -61,16 +62,6 @@
|
|||||||
<p><strong>Quick Tips:</strong> Keep it brief, keep it real. Share your desk moments, finds, or frustrations. Upvote what resonates!</p>
|
<p><strong>Quick Tips:</strong> Keep it brief, keep it real. Share your desk moments, finds, or frustrations. Upvote what resonates!</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Date Display -->
|
|
||||||
<div class="date-display mb-4">
|
|
||||||
<p>Stories from <a href="#" class="date-link">April</a> <a href="#" class="date-link">24</a>, <a href="#" class="date-link">2025</a> (UTC)</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Filter Section -->
|
|
||||||
<div class="filter-section">
|
|
||||||
<p>Go back a day, month, or year. Go forward a day.</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="post-list">
|
<div class="post-list">
|
||||||
<!-- Post 1 -->
|
<!-- Post 1 -->
|
||||||
<div class="post-item">
|
<div class="post-item">
|
||||||
@@ -96,13 +87,6 @@
|
|||||||
</article>
|
</article>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Carbon Ad -->
|
|
||||||
<div class="carbon-demo card-shadow">
|
|
||||||
<img class="carbon-img" src="../images/buysellads-carbon-example.png">
|
|
||||||
<div class="carbon-desc">This is where your "Ad Description" will render.</div>
|
|
||||||
<div class="carbon-via">ads via Carbon</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Post 2 -->
|
<!-- Post 2 -->
|
||||||
<div class="post-item">
|
<div class="post-item">
|
||||||
<article class="media">
|
<article class="media">
|
||||||
@@ -213,13 +197,6 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggle filter section visibility
|
|
||||||
const pastButton = document.getElementById('past-button');
|
|
||||||
const filterSection = document.querySelector('.filter-section');
|
|
||||||
pastButton.addEventListener('click', () => {
|
|
||||||
filterSection.classList.toggle('hidden');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
+178
-169
@@ -5,193 +5,202 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<link rel="stylesheet" href="node_modules/bulma/css/bulma.min.css">
|
<link rel="stylesheet" href="node_modules/bulma/css/bulma.min.css">
|
||||||
<link rel="stylesheet" href="style.css">
|
<link rel="stylesheet" href="style.css">
|
||||||
<!-- Include Google reCAPTCHA API script -->
|
|
||||||
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
|
|
||||||
<title>Login / Signup - Behind the Desk</title>
|
<title>Login / Signup - Behind the Desk</title>
|
||||||
|
<style>
|
||||||
|
/* Add specific styles for login page if needed */
|
||||||
|
.login-container {
|
||||||
|
max-width: 450px; /* Increased width for longer fields */
|
||||||
|
margin-top: 2rem;
|
||||||
|
}
|
||||||
|
.login-container h2 {
|
||||||
|
font-size: 1.2rem;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
color: #38315f; /* Updated text color */
|
||||||
|
}
|
||||||
|
.login-container .field {
|
||||||
|
margin-bottom: 0.75rem;
|
||||||
|
}
|
||||||
|
.login-container .label {
|
||||||
|
font-size: 0.9rem;
|
||||||
|
font-weight: normal;
|
||||||
|
color: #38315f; /* Updated text color */
|
||||||
|
margin-bottom: 0.25rem;
|
||||||
|
display: inline-block; /* HN style labels */
|
||||||
|
width: 100px; /* Align inputs */
|
||||||
|
}
|
||||||
|
.login-container .input {
|
||||||
|
font-size: 0.9rem;
|
||||||
|
max-width: 250px; /* Increased max-width for longer fields */
|
||||||
|
display: inline-block; /* Align with label */
|
||||||
|
width: calc(100% - 110px); /* Adjust width */
|
||||||
|
background-color: #ffffff; /* Ensure white background */
|
||||||
|
color: #363636; /* Default input text color */
|
||||||
|
border: 1px solid #dbdbdb; /* Standard Bulma border */
|
||||||
|
}
|
||||||
|
.login-container .input:focus {
|
||||||
|
border-color: #38315f; /* Highlight focus */
|
||||||
|
box-shadow: 0 0 0 0.125em rgba(56, 49, 95, 0.25);
|
||||||
|
}
|
||||||
|
.login-container .button.is-link { /* Target the specific button */
|
||||||
|
font-size: 0.9rem;
|
||||||
|
margin-left: 100px; /* Align button with inputs */
|
||||||
|
margin-top: 0.5rem;
|
||||||
|
background-color: #38315f; /* Updated button color */
|
||||||
|
color: #ffffff; /* White text for contrast */
|
||||||
|
border-color: transparent; /* Remove default border */
|
||||||
|
}
|
||||||
|
.login-container .button.is-link:hover {
|
||||||
|
background-color: #2d274a; /* Slightly darker on hover */
|
||||||
|
}
|
||||||
|
.recaptcha-placeholder {
|
||||||
|
margin-left: 100px; /* Align with inputs */
|
||||||
|
margin-top: 0.75rem;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
color: #6c757d;
|
||||||
|
border: 1px dashed #ccc;
|
||||||
|
padding: 10px;
|
||||||
|
display: inline-block;
|
||||||
|
width: 250px; /* Match input width */
|
||||||
|
text-align: center;
|
||||||
|
background-color: #f5f5f5; /* Light background for placeholder */
|
||||||
|
}
|
||||||
|
.form-section {
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
}
|
||||||
|
.login-container p a {
|
||||||
|
color: #38315f; /* Link color */
|
||||||
|
}
|
||||||
|
.login-container p a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body class="login-signup-page"> <!-- Add class for specific styling -->
|
<body>
|
||||||
<!-- Navbar Removed -->
|
<nav class="navbar is-fixed-top" role="navigation" aria-label="main navigation">
|
||||||
|
<div class="container">
|
||||||
|
<div class="navbar-brand">
|
||||||
|
<a class="navbar-item has-text-weight-bold" href="/">
|
||||||
|
Behind the Desk
|
||||||
|
</a>
|
||||||
|
<a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false" data-target="navbarBasicExample">
|
||||||
|
<span aria-hidden="true"></span>
|
||||||
|
<span aria-hidden="true"></span>
|
||||||
|
<span aria-hidden="true"></span>
|
||||||
|
<span aria-hidden="true"></span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div id="navbarBasicExample" class="navbar-menu">
|
||||||
|
<div class="navbar-start">
|
||||||
|
<a class="navbar-item" href="/">
|
||||||
|
top 🔥
|
||||||
|
</a>
|
||||||
|
<a class="navbar-item" href="#">
|
||||||
|
new
|
||||||
|
</a>
|
||||||
|
<a class="navbar-item" href="#">
|
||||||
|
nearby
|
||||||
|
</a>
|
||||||
|
<a class="navbar-item" href="#">
|
||||||
|
past
|
||||||
|
</a>
|
||||||
|
<a class="navbar-item" href="#">
|
||||||
|
ask
|
||||||
|
</a>
|
||||||
|
<a class="navbar-item" href="#">
|
||||||
|
show
|
||||||
|
</a>
|
||||||
|
<a class="navbar-item" href="#">
|
||||||
|
submit
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="navbar-end">
|
||||||
|
<div class="navbar-item">
|
||||||
|
<a href="/login.html">login</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
<main class="section main-content">
|
<main class="section main-content">
|
||||||
<div class="container">
|
<div class="container login-container">
|
||||||
<div class="columns"> <!-- Use standard columns for side-by-side -->
|
|
||||||
<!-- Login Column -->
|
|
||||||
<div class="column is-half">
|
|
||||||
<h1 class="title has-text-centered">Login</h1>
|
|
||||||
<div class="box">
|
|
||||||
<form id="login-form">
|
|
||||||
<div class="field">
|
|
||||||
<label class="label" for="login-username">Username</label>
|
|
||||||
<div class="control">
|
|
||||||
<input class="input" type="text" id="login-username" name="username" placeholder="Enter your username" required>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="field">
|
<!-- Login Form -->
|
||||||
<label class="label" for="login-password">Password</label>
|
<div class="form-section">
|
||||||
<div class="control">
|
<h2>Login</h2>
|
||||||
<input class="input" type="password" id="login-password" name="password" placeholder="Enter your password" required>
|
<form action="/login" method="post">
|
||||||
</div>
|
<div class="field">
|
||||||
</div>
|
<label class="label" for="login-username">username:</label>
|
||||||
<!-- Confirm Password removed from Login -->
|
<div class="control" style="display: inline-block;">
|
||||||
|
<input class="input" type="text" id="login-username" name="username" required>
|
||||||
<div class="field">
|
</div>
|
||||||
<div class="control">
|
|
||||||
<button type="submit" class="button is-primary is-fullwidth">Login</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
</div> <!-- End Login Column -->
|
<div class="field">
|
||||||
|
<label class="label" for="login-password">password:</label>
|
||||||
<!-- Signup Column -->
|
<div class="control" style="display: inline-block;">
|
||||||
<div class="column is-half">
|
<input class="input" type="password" id="login-password" name="password" required>
|
||||||
<h1 class="title has-text-centered">Sign Up</h1>
|
</div>
|
||||||
<div class="box">
|
|
||||||
<form id="signup-form">
|
|
||||||
<div class="field">
|
|
||||||
<label class="label" for="signup-username">Username</label>
|
|
||||||
<div class="control">
|
|
||||||
<input class="input" type="text" id="signup-username" name="username" placeholder="Choose a username" required>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="field">
|
|
||||||
<label class="label" for="signup-email">Email</label>
|
|
||||||
<div class="control">
|
|
||||||
<input class="input" type="email" id="signup-email" name="email" placeholder="Enter your email" required>
|
|
||||||
</div>
|
|
||||||
<!-- Optional: Add help text for email format -->
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="field">
|
|
||||||
<label class="label" for="signup-password">Password</label>
|
|
||||||
<div class="control">
|
|
||||||
<input class="input" type="password" id="signup-password" name="password" placeholder="Create a password" required>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="field">
|
|
||||||
<label class="label" for="signup-confirm-password">Confirm Password</label>
|
|
||||||
<div class="control">
|
|
||||||
<input class="input" type="password" id="signup-confirm-password" name="confirm-password" placeholder="Confirm your password" required>
|
|
||||||
</div>
|
|
||||||
<p class="help is-danger is-hidden" id="signup-password-mismatch">Passwords do not match.</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="field">
|
|
||||||
<div class="control">
|
|
||||||
<button type="submit" class="button is-link is-fullwidth">Sign Up</button> <!-- Use is-link or another color for distinction -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
</div> <!-- End Signup Column -->
|
<div class="field">
|
||||||
|
<div class="recaptcha-placeholder">[reCAPTCHA placeholder]</div>
|
||||||
</div> <!-- End columns -->
|
|
||||||
|
|
||||||
<!-- Shared reCAPTCHA -->
|
|
||||||
<div class="recaptcha-container"> <!-- Use dedicated container for centering -->
|
|
||||||
<div> <!-- Wrapper div for reCAPTCHA and help text -->
|
|
||||||
<div class="g-recaptcha" data-sitekey="YOUR_RECAPTCHA_SITE_KEY"></div>
|
|
||||||
<!-- IMPORTANT: Replace YOUR_RECAPTCHA_SITE_KEY with your actual site key -->
|
|
||||||
<p class="help is-danger is-hidden" id="recaptcha-error">Please complete the reCAPTCHA.</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<div class="control">
|
||||||
|
<button class="button is-link is-small">Login</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<p style="margin-left: 100px; margin-top: 0.5rem; font-size: 0.8rem;"><a href="#">Forgot your password?</a></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<!-- Signup Form -->
|
||||||
|
<div class="form-section">
|
||||||
|
<h2>Create Account</h2>
|
||||||
|
<form action="/signup" method="post">
|
||||||
|
<div class="field">
|
||||||
|
<label class="label" for="signup-username">username:</label>
|
||||||
|
<div class="control" style="display: inline-block;">
|
||||||
|
<input class="input" type="text" id="signup-username" name="username" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<label class="label" for="signup-password">password:</label>
|
||||||
|
<div class="control" style="display: inline-block;">
|
||||||
|
<input class="input" type="password" id="signup-password" name="password" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<div class="recaptcha-placeholder">[reCAPTCHA placeholder]</div>
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<div class="control">
|
||||||
|
<button class="button is-link is-small">Create Account</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div> <!-- End container -->
|
</div> <!-- End container -->
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<!-- Footer Removed -->
|
<!-- Footer can be added later if needed -->
|
||||||
|
|
||||||
<!-- Updated script for both forms -->
|
<!-- Simple script to toggle mobile menu -->
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
// Navbar burger toggle removed
|
const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);
|
||||||
|
if ($navbarBurgers.length > 0) {
|
||||||
const loginForm = document.getElementById('login-form');
|
$navbarBurgers.forEach( el => {
|
||||||
const signupForm = document.getElementById('signup-form');
|
el.addEventListener('click', () => {
|
||||||
const recaptchaErrorHelp = document.getElementById('recaptcha-error');
|
const target = el.dataset.target;
|
||||||
|
const $target = document.getElementById(target);
|
||||||
// --- Login Form Validation ---
|
el.classList.toggle('is-active');
|
||||||
if (loginForm) {
|
$target.classList.toggle('is-active');
|
||||||
loginForm.addEventListener('submit', function(event) {
|
});
|
||||||
let isValid = true;
|
|
||||||
// Basic validation (e.g., required fields handled by HTML5 'required')
|
|
||||||
|
|
||||||
// Check reCAPTCHA
|
|
||||||
const recaptchaResponse = grecaptcha.getResponse();
|
|
||||||
if (recaptchaResponse.length === 0) {
|
|
||||||
recaptchaErrorHelp.classList.remove('is-hidden');
|
|
||||||
isValid = false;
|
|
||||||
} else {
|
|
||||||
recaptchaErrorHelp.classList.add('is-hidden');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isValid) {
|
|
||||||
event.preventDefault(); // Prevent submission if invalid
|
|
||||||
}
|
|
||||||
// Add further login validation if needed
|
|
||||||
// IMPORTANT: Remember server-side validation!
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Signup Form Validation ---
|
|
||||||
if (signupForm) {
|
|
||||||
const signupPasswordInput = document.getElementById('signup-password');
|
|
||||||
const signupConfirmPasswordInput = document.getElementById('signup-confirm-password');
|
|
||||||
const signupPasswordMismatchHelp = document.getElementById('signup-password-mismatch');
|
|
||||||
|
|
||||||
signupForm.addEventListener('submit', function(event) {
|
|
||||||
let isValid = true;
|
|
||||||
|
|
||||||
// Check password match
|
|
||||||
if (signupPasswordInput.value !== signupConfirmPasswordInput.value) {
|
|
||||||
signupConfirmPasswordInput.classList.add('is-danger');
|
|
||||||
signupPasswordMismatchHelp.classList.remove('is-hidden');
|
|
||||||
isValid = false;
|
|
||||||
} else {
|
|
||||||
signupConfirmPasswordInput.classList.remove('is-danger');
|
|
||||||
signupPasswordMismatchHelp.classList.add('is-hidden');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check reCAPTCHA
|
|
||||||
const recaptchaResponse = grecaptcha.getResponse();
|
|
||||||
if (recaptchaResponse.length === 0) {
|
|
||||||
recaptchaErrorHelp.classList.remove('is-hidden');
|
|
||||||
isValid = false;
|
|
||||||
} else {
|
|
||||||
recaptchaErrorHelp.classList.add('is-hidden');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isValid) {
|
|
||||||
event.preventDefault(); // Prevent submission if invalid
|
|
||||||
}
|
|
||||||
// Add further signup validation if needed (email format, username availability via AJAX etc.)
|
|
||||||
// IMPORTANT: Remember server-side validation!
|
|
||||||
});
|
|
||||||
|
|
||||||
// Real-time password match check for signup (optional)
|
|
||||||
signupConfirmPasswordInput.addEventListener('input', () => {
|
|
||||||
if (signupPasswordInput.value !== signupConfirmPasswordInput.value) {
|
|
||||||
signupConfirmPasswordInput.classList.add('is-danger');
|
|
||||||
signupPasswordMismatchHelp.classList.remove('is-hidden');
|
|
||||||
} else {
|
|
||||||
signupConfirmPasswordInput.classList.remove('is-danger');
|
|
||||||
signupPasswordMismatchHelp.classList.add('is-hidden');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reset reCAPTCHA error on interaction (optional, improves UX)
|
|
||||||
// This requires a more complex setup if using the invisible reCAPTCHA or explicit rendering.
|
|
||||||
// For the simple checkbox version, clicking it usually suffices.
|
|
||||||
// We can hide the error when either form attempts submission again.
|
|
||||||
if(recaptchaErrorHelp){
|
|
||||||
if(loginForm) loginForm.addEventListener('submit', () => recaptchaErrorHelp.classList.add('is-hidden'));
|
|
||||||
if(signupForm) signupForm.addEventListener('submit', () => recaptchaErrorHelp.classList.add('is-hidden'));
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Reference in new issue
Block a user