diff --git a/.env.example b/.env.example
deleted file mode 100644
index 9f48c08..0000000
--- a/.env.example
+++ /dev/null
@@ -1,53 +0,0 @@
-# Since the ".env" file is gitignored, you can use the ".env.example" file to
-# build a new ".env" file when you clone the repo. Keep this file up-to-date
-# when you add new variables to `.env`.
-
-# This file will be committed to version control, so make sure not to have any
-# secrets in it. If you are cloning this repo, create a copy of this file named
-# ".env" and populate it with your secrets.
-
-GOOGLE_ID=
-GOOGLE_SECRET=
-
-FACEBOOK_APP_ID=
-FACEBOOK_APP_SECRET=
-
-PUBLIC_BASENAME=http://localhost:3000/
-PORT=3000
-MONGO_SERVER=mongodb://127.0.0.1:27017
-
-
-## How to get your GOOGLE_ID and GOOGLE_SECRET
-
-# Create a Google Cloud Platform (GCP) Project:
-# - Go to the Google Cloud Console.
-# - Create a new project by clicking on the project dropdown menu at the top of the page and selecting "New Project".
-# - Follow the prompts to name your project and select your organization.
-# - Enable the Google Sign-In API:
-
-# In the Cloud Console, go to the "APIs & Services" > "Library".
-# - Search for "Google Sign-In API" and select it.
-# - Click on the "Enable" button to enable the API for your project.
-# - Create OAuth 2.0 Credentials:
-
-# In the Cloud Console, navigate to "APIs & Services" > "OAuth consent screen".
-# - Choose either "External" or "Internal" based on your use case and fill in the required information.
-# - After setting up the consent screen, go to "APIs & Services" > "Credentials".
-# - Click on "Create Credentials" and select "OAuth client ID".
-# - Choose "Web application" as the application type.
-# - In the "Authorized redirect URIs" section, add the URL where users will be redirected after signing in with Google. Typically, this would be something like https://yourwebsite.com/auth/google/callback.
-# - Click "Create" to generate your OAuth 2.0 credentials. This will provide you with your GOOGLE_ID (Client ID) and GOOGLE_SECRET (Client Secret).
-
-
-# ## How to get your FACEBOOK_APP_ID and FACEBOOK_APP_SECRET
-
-# Create a Facebook Developer Account:
-# - Go to the Facebook Developer website (https://developers.facebook.com/) and sign in with your Facebook credentials.
-# - Create a new app by clicking on the "My Apps" dropdown menu at the top right corner and selecting "Create App."
-# - Follow the prompts to set up your new app. Choose a display name, category, and other relevant details.
-
-# Configure Basic Settings:
-# - Once your app is created, navigate to the app dashboard.
-# - Under the "Settings" tab, go to the "Basic" section.
-# - Add your website domain under "App Domains" and save the changes.
-# - Note down your App ID and App Secret.
\ No newline at end of file
diff --git a/app.js b/app.js
index 12c54a4..40b6e2b 100644
--- a/app.js
+++ b/app.js
@@ -10,7 +10,7 @@ const findOrCreate = require("mongoose-findorcreate");
const LocalStrategy = require("passport-local").Strategy;
const GoogleStrategy = require("passport-google-oauth20").Strategy;
const FacebookStrategy = require("passport-facebook").Strategy;
-
+// const axios = require("axios");
const app = express();
app.use(express.static("public"));
@@ -296,6 +296,82 @@ app.post('/api/votes', async (req, res) => {
}
});
+// DELETE /api/delete-secret
+app.post('/api/delete-secret', async (req, res) => {
+ try {
+ // Check if the user is authenticated
+ if (!req.isAuthenticated() || !req.user) {
+ return res.status(401).json({ message: 'User is not authenticated.' });
+ }
+ const { index } = req.body;
+ const user = await User.findById(req.user.id); // Assuming user is logged in
+
+ if (!user) {
+ return res.status(404).json({ message: 'User not found' });
+ }
+
+ if (typeof index === 'number' && index >= 0 && index < user.secret.length) {
+ // Remove the secret based on index
+ user.secret.splice(index, 1);
+ await user.save();
+ return res.status(200).json({ message: 'Secret deleted successfully.' });
+ } else {
+ return res.status(400).json({ message: 'Invalid index provided.' });
+ }
+ } catch (error) {
+ console.error('Error deleting secret:', error);
+ return res.status(500).json({ message: 'Internal server error.' });
+ }
+});
+
+
+// POST /api/save-update-secret
+app.post('/api/save-update-secret', async (req, res) => {
+ try {
+ console.log('User Authenticated:', req.isAuthenticated()); // Check if user is authenticated
+ console.log('User ID:', req.user ? req.user.id : 'No user'); // Check user object
+
+ if (!req.isAuthenticated()) {
+ return res.status(401).json({ message: 'User is not authenticated.' });
+ }
+
+ const { index, content } = req.body;
+
+ // Find user using req.user.id
+ const user = await User.findById(req.user.id);
+ if (!user) {
+ return res.status(404).json({ message: 'User not found.' });
+ }
+
+ // Validate index
+ if (typeof index !== 'number' || index < 0 || index >= user.secret.length) {
+ return res.status(400).json({ message: 'Invalid index provided.' });
+ }
+
+ // Validate content
+ if (typeof content !== 'string') {
+ return res.status(400).json({ message: 'Content must be a string.' });
+ }
+
+ // Access the secret safely
+ const secret = user.secret[index];
+ if (!secret || typeof secret.title === 'undefined') {
+ return res.status(400).json({ message: 'Secret not found or invalid structure.' });
+ }
+
+ // Update the title
+ secret.title = content;
+ await user.save();
+
+ res.status(200).json({ message: 'Secret updated successfully.' });
+ } catch (error) {
+ console.error('Error updating secret:', error.message || error);
+ res.status(500).json({ message: 'Internal server error.', error: error.message });
+ }
+});
+
+
+
app.get('*', (req, res) => {
res.status(404).render("404-page");
});
diff --git a/public/css/styles.css b/public/css/styles.css
index 561eecc..9c0601e 100644
--- a/public/css/styles.css
+++ b/public/css/styles.css
@@ -52,31 +52,70 @@ html {
border-bottom-color: transparent;
animation: spin 1.25s linear infinite;
}
+/* Navbar links */
nav a {
color: #a7daff !important;
}
+
nav a:hover {
border: 1px solid #a7daff !important;
}
+
.navbar-brand {
color: white !important;
}
+
+/* Hamburger & Mobile Nav */
+.hamburger {
+ display: none; /* Hidden on larger screens */
+}
+
#nav_small {
+ display: none; /* Hidden initially */
+}
+#nav_small2 {
+ display: none;
+}
+.hide {
display: none;
}
+/* Styles for mobile nav items */
+/* #nav_small a {
+ color: white;
+ padding: 10px;
+ text-align: center;
+ background-color: #444;
+ border-bottom: 1px solid #555;
+}
+
+#nav_small a:hover {
+ background-color: #555;
+} */
+
+/* #nav_small2 a {
+ color: #a7daff;
+ padding: 10px;
+ text-align: center;
+ background-color: #192e4e;
+ border-bottom: 1px solid #444;
+}
+
+#nav_small2 a:hover {
+ background-color: #0a1d3c;
+} */
+
#theme-toggle {
width: 40px;
height: 40px;
padding: 0;
border-radius: 50px;
- background-color: #a7daff;
- background: transparent;
- color:#a7daff;
+ background-color: transparent;
+ color: #a7daff;
margin-right: 20px;
}
+
button {
cursor: pointer;
-
padding: 1em 2em;
border: none;
outline: none;
@@ -85,7 +124,6 @@ button {
font-size: 1.0rem;
border-radius: 10px;
transition: background-color 0.5s, box-shadow 0.5s, color 0.5s;
-
-webkit-tap-highlight-color: transparent;
}
button.secondary {
@@ -283,8 +321,198 @@ header h1 {
.vote-count{
margin-right: 10px;
}
+.button_all_white, .button_all_black{
+ font-size: 1em;
+ margin: 10px;
+}
+/* .inner-secret-text, */
+.edit{
+ margin-top: 2%;
+ width: 80%;
+ margin-left: 8%;
+}
+.edit .vote-container{
+ display: none;
+}
+.editInput {
+ width: 80%;
+ margin-bottom: 20px;
+}
+/* styling edit and delete icons */
+.icon{
+ color: white;
+ height: 30px;
+ width: 30px;
+ transition: transform 0.2s;
+ color: #ff4b4b;
+}
+.icon:hover {
+ transform: scale(1.1);
+}
+.vote-image{
+ width: 24px;
+ height: 24px;
+}
+@media (max-width: 768px) {
+ /* Making navbar responsive */
+ .hide {
+ display: none;
+ }
+ .hide#nav_small {
+ display: none;
+ }
+
+ .hide#nav_small2 {
+ display: none;
+ }
+ .navbar .nav_big {
+ display: none;
+ }
+
+ .hamburger {
+ display: block;
+ color: #a7daff;
+ }
+
+ #nav_small {
+ display: block;
+ background-color: #333;
+ position: absolute;
+ top: 50px;
+ left: 0;
+ width: 100%;
+ z-index: 1000;
+ }
+ #nav_small2 {
+ display: flex;
+ flex-direction: column;
+ }
+ #nav_small2 a {
+ padding: 10px;
+ color: white;
+ background-color: #444;
+ }
+
+ #nav_small2 a:hover {
+ background-color: #555;
+ }
+ /* Making secret page responsive */
+ .button_all_white{
+ font-size: 1.5em;
+ margin: 10px;
+ width: 100px;
+ height: 50px;
+ }
+ .button_all_black{
+ font-size: 1.5em;
+ margin: 10px;
+ width: 150px;
+ height: 50px;
+ }
+ /* Making login & register page responsive */
+ .form-control{
+ font-size: 1rem;
+ height: 45px;
+ border-radius: 20px;
+ padding: 10px;
+ }
+ .button_all_black#user-login{
+ font-size: 1.2rem;
+ height: 45px;
+ }
+ .btn-social{
+ height: 40px;
+ padding: 10px 50px;
+ }
+ .pass-text{
+ font-size: 0.8rem;
+ margin-left: 10px;
+ color: red;
+ }
+ .form-check{
+ margin-left: 3px;
+ }
+ .form-check .pass-text{
+ padding-top: 1px;
+ font-size: 1.0rem;
+ color: black;
+ font-weight: 500;
+ }
+ /* making secret page responsive */
+ .inner-secret-text{
+ width: 50%;
+ margin-left: 0px;
+ font-size: 16px;
+ vertical-align: middle;
+ margin-top: 10px;
+ }
+ .vote-container{
+ margin-top: 10px;
+ }
+ .vote-image{
+ height: 30px;
+ width: 30px;
+ }
+ .vote-count{
+ font-size: 20px;
+ }
+ .edit-rem-icon{
+ margin-top: 10px;
+ }
+
+ /* Stack the buttons vertically */
+ .saveBtn,
+ .cancelBtn {
+ display: block;
+ width: 100%; /* Buttons take full width */
+ margin-bottom: 10px; /* Space between buttons */
+ }
+ .editInput {
+ width: 92%;
+ margin-bottom: 0px;
+ }
+ /* Responsive vote container */
+ .vote-container {
+ display: flex;
+ justify-content: space-between;
+ width: 100%; /* Flexbox layout ensures responsive resizing */
+ margin-top: 10px;
+ }
+ .card-body{
+ display: flex;
+ flex-direction: row;
+ z-index: 0;
+ }
+ .edit .vote-container{
+ display: none;
+ }
+ .edit .edit-icon{
+ display: none;
+ }
+ .edit .remove-icon{
+ display: none;
+ }
+ .edit.card{
+ z-index: 10;
+ }
+ .edit{
+ height: 500px;
+ gap: 10px;
+ display: flex;
+ flex-direction: column;
+ z-index: 10;
+ background-color: #0b0967;
+ padding-left: 20px;
+ }
+ .edit .editInput{
+ font-size: 16px;
+ }
+ .edit button{
+ width: 90%;
+ }
+}
@media (max-width: 600px) {
.flexbox {
@@ -293,7 +521,7 @@ header h1 {
.hero {
flex-direction: column-reverse;
}
- .illustration {
+ /* .illustration {
scale: 1;
}
.hamburger {
@@ -315,14 +543,30 @@ header h1 {
#nav_small.side_nav a {
width: 100%;
color: #a7daff;
+ } */
+ .know_more{
+ width: 100%;
+ height: auto;
+ font-size: 0.9rem;
+ }
+ .illustration{
+ margin: 0px;
+ }
+ .main-content {
+ height: 100px;
+ margin-bottom: 0px;
+ padding-top: 20px;
+ }
+ .hero{
+ min-height: 350px;
}
.hero .container {
align-items: center;
}
- .main-content {
+ /* .main-content {
margin-left: unset !important;
margin-top: unset !important;
- }
+ } */
.main-content h1 {
text-align: center;
}
@@ -360,7 +604,6 @@ header h1 {
}
/* CSS for Privacy */
-
main {
margin: 1px 60px;
padding: 1px 0;
@@ -371,3 +614,4 @@ section.c1 {
padding: 20px;
margin-bottom: 20px;
}
+
diff --git a/views/home.ejs b/views/home.ejs
index 97a895a..749d6c5 100644
--- a/views/home.ejs
+++ b/views/home.ejs
@@ -1,5 +1,9 @@
<%- include('partials/header') %>
-
+
@@ -22,6 +26,6 @@
We allow you to add your secrets that you don't want to share with anyone.
-
+
<%- include('partials/footer') %>
diff --git a/views/partials/footer.ejs b/views/partials/footer.ejs
index 6756fda..7efe824 100644
--- a/views/partials/footer.ejs
+++ b/views/partials/footer.ejs
@@ -147,4 +147,38 @@
.mt-4 {
margin-top: 1.5rem;
}
+
+ @media (min-width: 768px) {
+ /* Adjust for larger screens */
+ .col-md-3 {
+ flex-basis: 24%;
+ }
+
+ .footer-title {
+ font-size: 1.8rem;
+ }
+
+ .footer-link {
+ font-size: 1.1rem;
+ }
+ }
+
+ /* Adjust text size for smaller devices */
+ @media (max-width: 576px) {
+ p.text-white{
+ font-size: 0.9rem;
+ }
+ .footer-title {
+ font-size: 1.4rem;
+ }
+
+ .footer-link {
+ font-size: 0.9rem;
+ }
+
+ .social-icon .icon {
+ width: 40px;
+ height: 40px;
+ }
+ }
diff --git a/views/partials/header.ejs b/views/partials/header.ejs
index 0308ae6..a3c3f86 100644
--- a/views/partials/header.ejs
+++ b/views/partials/header.ejs
@@ -24,13 +24,13 @@
-
+
+
+
+
+
+
diff --git a/views/register.ejs b/views/register.ejs
index 3602302..8ccf638 100644
--- a/views/register.ejs
+++ b/views/register.ejs
@@ -28,14 +28,22 @@
-
+
+
+
+
+
Password should be of minimum 8 characters with uppercase, lowercase letters and special symbols
+