Code fixes to make menus more unified
This commit is contained in:
@@ -162,7 +162,7 @@ app.get('/', (req, res) => {
|
|||||||
|
|
||||||
// Render login page for /login route
|
// Render login page for /login route
|
||||||
app.get('/login', (req, res) => {
|
app.get('/login', (req, res) => {
|
||||||
res.render('pages/home');
|
res.render('/');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Trigger login form to check database for matching username and password
|
// Trigger login form to check database for matching username and password
|
||||||
@@ -182,7 +182,7 @@ app.post('/login', async (req, res) => {
|
|||||||
// Check if match returns no data
|
// Check if match returns no data
|
||||||
if (!match) {
|
if (!match) {
|
||||||
// Render the login page with the message parameter
|
// Render the login page with the message parameter
|
||||||
return res.render('pages/home', { message: 'Password does not match' });
|
return res.render('/', { message: 'Password does not match' });
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
// Save user information in the session variable
|
// Save user information in the session variable
|
||||||
@@ -190,7 +190,7 @@ app.post('/login', async (req, res) => {
|
|||||||
req.session.save();
|
req.session.save();
|
||||||
|
|
||||||
// Redirect user to the home page
|
// Redirect user to the home page
|
||||||
res.redirect('/home');
|
res.redirect('/');
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Direct user to login screen if no user is found with matching password
|
// Direct user to login screen if no user is found with matching password
|
||||||
@@ -204,7 +204,7 @@ app.post('/login', async (req, res) => {
|
|||||||
|
|
||||||
// Render registration page for /register route
|
// Render registration page for /register route
|
||||||
app.get('/register', (req, res) => {
|
app.get('/register', (req, res) => {
|
||||||
res.render('pages/register');
|
res.redirect('/');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Trigger Registration Form to Post
|
// Trigger Registration Form to Post
|
||||||
@@ -259,8 +259,6 @@ app.get('/logout', (req, res) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/************************
|
/************************
|
||||||
League Page Routes
|
League Page Routes
|
||||||
*************************/
|
*************************/
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#account-pane {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#login-page {
|
#login-pane {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
|
/* Standardized Styling for Login, Registration, and Account Panes */
|
||||||
.account-portal-container {
|
.account-portal-container {
|
||||||
width: 400px;
|
width: 400px;
|
||||||
height: 408px;
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 150px; /* Adjust this value as needed */
|
top: 150px; /* Adjust this value as needed */
|
||||||
right: 20px; /* Adjust this value as needed */
|
right: 20px; /* Adjust this value as needed */
|
||||||
@@ -10,7 +11,12 @@
|
|||||||
border: 1px solid gray;
|
border: 1px solid gray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Set Login and Registration Panes to be same size */
|
||||||
|
#login-pane, #register-pane {
|
||||||
|
height: 408px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* */
|
||||||
.form-container {
|
.form-container {
|
||||||
width: 70%; /* Adjust width as needed */
|
width: 70%; /* Adjust width as needed */
|
||||||
margin: 0 auto; /* Center horizontally */
|
margin: 0 auto; /* Center horizontally */
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
$('#register-screen-container').hide();
|
$('#register-screen-container').hide();
|
||||||
// Toggle the visibility of the login container
|
// Toggle the visibility of the login container
|
||||||
$('#login-page').toggle();
|
$('#login-pane').toggle();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#register-page-login-button').click(function() {
|
$('#register-page-login-button').click(function (event) {
|
||||||
event.preventDefault(); // Prevent the default action of following the link
|
event.preventDefault(); // Prevent the default action of following the link
|
||||||
|
|
||||||
$('#register-screen-container').hide();
|
$('#register-screen-container').hide();
|
||||||
@@ -27,4 +27,15 @@ $(document).ready(function () {
|
|||||||
// Show the register container
|
// Show the register container
|
||||||
$('#register-screen-container').show();
|
$('#register-screen-container').show();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
// When #user is clicked
|
||||||
|
$('#user-profile-button').click(function() {
|
||||||
|
|
||||||
|
// Toggle the visibility of the login container
|
||||||
|
$('#account-pane').toggle();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
<link rel="stylesheet" type="text/css" href="/css/navigation-bar/navigation-bar.css">
|
<link rel="stylesheet" type="text/css" href="/css/navigation-bar/navigation-bar.css">
|
||||||
<link rel="stylesheet" type="text/css" href="/css/login-and-registration/login.css">
|
<link rel="stylesheet" type="text/css" href="/css/login-and-registration/login.css">
|
||||||
<link rel="stylesheet" type="text/css" href="/css/login-and-registration/registration.css">
|
<link rel="stylesheet" type="text/css" href="/css/login-and-registration/registration.css">
|
||||||
|
<link rel="stylesheet" type="text/css" href="/css/login-and-registration/account.css">
|
||||||
|
|
||||||
<!-- Scoreboard Header Stylesheets -->
|
<!-- Scoreboard Header Stylesheets -->
|
||||||
<link rel="stylesheet" type="text/css" href="/css/navigation-bar/scoreboard-header/scoreboard.css">
|
<link rel="stylesheet" type="text/css" href="/css/navigation-bar/scoreboard-header/scoreboard.css">
|
||||||
|
|||||||
@@ -57,15 +57,15 @@
|
|||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
{{#if user.username}}
|
{{#if user.username}}
|
||||||
<div class="account-portal" id="login-screen-container">
|
<div class="account-portal" id="account-screen-container">
|
||||||
{{> navigation-bar/account-screen}}
|
{{> navigation-bar/user-menu/account-screen}}
|
||||||
</div>
|
</div>
|
||||||
{{else}}
|
{{else}}
|
||||||
<div class="account-portal" id="login-account-container">
|
<div class="account-portal" id="login-account-container">
|
||||||
{{> navigation-bar/login}}
|
{{> navigation-bar/user-menu/login}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<div class="account-portal" id="register-screen-container">
|
<div class="account-portal" id="register-screen-container">
|
||||||
{{> navigation-bar/register}}
|
{{> navigation-bar/user-menu/register}}
|
||||||
</div>
|
</div>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<!-- Linking forms.css -->
|
<!-- Linking forms.css -->
|
||||||
<div class="account-portal-container" id="login-page">
|
<div class="account-portal-container" id="account-pane">
|
||||||
|
|
||||||
<div class="form-container" id="login-form">
|
<div class="form-container" id="login-form">
|
||||||
<a id="username">Username: {{user.username}}</a>
|
<a id="username">Username: {{user.username}}</a>
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
<span>{{this.teamname}}</span> <br>
|
<span>{{this.teamname}}</span> <br>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
||||||
<a class="nav-link" href="/logout">Logout</a>
|
<a class="account-portal-button" id="logout-button" href="/logout">Logout</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<!-- Linking forms.css -->
|
<!-- Linking forms.css -->
|
||||||
<div class="account-portal-container" id="login-page">
|
<div class="account-portal-container" id="login-pane">
|
||||||
<div class="form-container" id="login-form">
|
<div class="form-container" id="login-form">
|
||||||
<h1 class="mt-5 mb-4">Login</h1>
|
<h1 class="mt-5 mb-4">Login</h1>
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<div class="account-portal-container" id="register-page">
|
<div class="account-portal-container" id="register-pane">
|
||||||
<div class="form-container">
|
<div class="form-container">
|
||||||
|
|
||||||
<h1 class="mt-5 mb-4">Register</h1>
|
<h1 class="mt-5 mb-4">Register</h1>
|
||||||
Reference in New Issue
Block a user