Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development #132

Closed
wants to merge 122 commits into from
Closed
Changes from 5 commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
39efb95
fe-Erik for interactive map to work need: installed "leaflet" , "reac…
socratic617 Dec 21, 2023
31561e9
fe-Erik installed "leaflet" and "leaflet-react" to display interactiv…
socratic617 Dec 21, 2023
9968c37
fe-Erik setup basic stylingfor fridgeList component and fridgeMap com…
socratic617 Dec 21, 2023
efdb9ff
fe-Erik cleaned up index.js
socratic617 Dec 21, 2023
215edfa
fe-Erik imported FridgeCard component and mapped through card compone…
socratic617 Dec 21, 2023
de4bf5e
fe-erik imported features to get interactive map going, added philly …
socratic617 Dec 21, 2023
830b25b
fe-erik added data attribute to fridge component to hold all info of …
socratic617 Dec 21, 2023
2c83b37
fe-erik FridgeMap added bound prop, The MapContainer component now in…
socratic617 Dec 21, 2023
fa549fc
fe-erik added styling for fridgeList to scroll
socratic617 Dec 21, 2023
296f0b8
fe-erik created container for fridgeMap to style
socratic617 Dec 21, 2023
15775e9
fe-erik added container for fridgelist to be nested in frdige parent …
socratic617 Dec 21, 2023
19e6526
fe-erik added fridge icon to images folder to display on interactive map
socratic617 Dec 21, 2023
3160bec
fe-erik installed dependencies "postcss-present-css" and "react-scripts"
socratic617 Dec 21, 2023
35b90e3
fe-erik FridgeMap: created variable to reformatData from Schema to fi…
socratic617 Dec 22, 2023
cbcbd19
fe-erik Fridge component: included data attribute to component Fridg…
socratic617 Dec 22, 2023
cdd52fa
added more dummy data to test that it dynamically renders all fridge …
socratic617 Dec 22, 2023
4c1800b
fe-erik package.json: installed tailwindcss, flowbite-react, react-s…
socratic617 Dec 22, 2023
803bc45
fe-erik package.json: installed tailwindcss, flowbite-react, react-sc…
socratic617 Dec 22, 2023
6435f83
fe-erik tailwind.config.js : configured tailwind css for frontend to …
socratic617 Dec 22, 2023
93759e8
fe-erik index.css : imported tailwind base, components, utilities to …
socratic617 Dec 22, 2023
5882085
fe-erik about landing page: styled and incorperated content
socratic617 Dec 22, 2023
db023cd
fe-sarah multple sections landing page: styled and incorperated content
socratic617 Dec 22, 2023
c8d1bc8
fe-erik fridge landing page: basic styling and incorperated content
socratic617 Dec 22, 2023
f0d6df7
add images to landing pg
socratic617 Dec 22, 2023
c2d1c30
fe-erik import Hero from components
socratic617 Dec 22, 2023
e2583cc
be set up
socratic617 Dec 22, 2023
0e81b60
be fetch all info for fridges and by zipcode
socratic617 Dec 22, 2023
bce33c6
merge be
socratic617 Dec 22, 2023
71bfd30
merge be
socratic617 Dec 22, 2023
5717458
merge be
socratic617 Dec 22, 2023
616d1f1
merge be
socratic617 Dec 22, 2023
4b80497
merge be
socratic617 Dec 22, 2023
e5894fd
merge be
socratic617 Dec 22, 2023
131e97d
deleted communitypost.js and fridgeprofile.js
socratic617 Dec 22, 2023
2e1857e
fe-erik installed fontawesome <link> to include icons
socratic617 Dec 22, 2023
4244f71
fe-erik Fridge.js : added styling to div container and added padding
socratic617 Dec 22, 2023
91c0531
fe-erik FridgeList: added css components from tailwind
socratic617 Dec 22, 2023
97a7d1b
fe-erik clean up for Fridge Map
socratic617 Dec 22, 2023
9e613da
Merge pull request #80 from Resilient-Labs/BE-changeENVpathinCloudinary
JacinthaDev Dec 22, 2023
ecf4196
Merge remote-tracking branch 'origin/development' into fe-interactive…
socratic617 Dec 22, 2023
4f41dd9
Merge pull request #85 from Resilient-Labs/fe-interactive-map-about-me
anaiscmateus Dec 22, 2023
14c8805
adding prettier to format code
briannawillis195 Dec 22, 2023
27c462b
adding prettier for formatting
briannawillis195 Dec 22, 2023
fc41257
Merge pull request #86 from Resilient-Labs/hideENV
JacinthaDev Dec 23, 2023
1014d24
Merge pull request #87 from Resilient-Labs/hideENV
JacinthaDev Dec 23, 2023
d1c66d7
config postcss
socratic617 Dec 23, 2023
40e1532
fe-erik W.I.P set up for getting all fridges info from b-e and connec…
socratic617 Dec 23, 2023
e2c3342
fe-erik fixed port for server side to client
socratic617 Dec 23, 2023
dc2938f
Merge remote-tracking branch 'origin/development' into fe-interactive…
socratic617 Dec 23, 2023
278ea1d
ignore pack-lock.json
socratic617 Dec 23, 2023
9ab6425
stylized individual fridge pages and make interactive and responsive
codedbycass Dec 23, 2023
1e67457
Merge remote-tracking branch 'origin/development' into fe-stylized-fr…
codedbycass Dec 23, 2023
41beb79
fe-erik work in progress, testing
socratic617 Dec 23, 2023
07d280f
fe-erik made code more efficient. Making one fetch call for component…
socratic617 Dec 24, 2023
2f52d0d
fe-erik moved all functionality to fridgelist and got rid of fridge c…
socratic617 Dec 24, 2023
849b488
fe-erik WorkInProgres FridgeList: moved over logic/fetch functionalit…
socratic617 Dec 24, 2023
4db168e
fe-erik WorkInProgress FridgeMap: reformatted data to match DB and re…
socratic617 Dec 24, 2023
b50cd1a
fe-erik Home.js: removed dummy data now that intergreated mongoDb data
socratic617 Dec 24, 2023
cbf85a6
fe-erik app.css: cleaned up css
socratic617 Dec 24, 2023
dc83560
changed px to rem
socratic617 Dec 24, 2023
1b23979
fe-erik FridgeList: connected to fridge profile pages individually f…
socratic617 Dec 24, 2023
6e2d58a
fe-style-landing-page
xsarahyu Dec 24, 2023
a072266
updates profile controller and routers, updates user schema and passw…
RoReeceDev Dec 26, 2023
96263ec
Merge pull request #91 from Resilient-Labs/be-ro-user-profile-router-…
briannawillis195 Dec 26, 2023
e5d281d
fe-erik FridgeList: changed colors of buttons
socratic617 Dec 26, 2023
116a388
Merge remote-tracking branch 'origin/development' into fe-landing-page
socratic617 Dec 26, 2023
eb9ef6b
Merge pull request #90 from Resilient-Labs/fe-landing-page
anaiscmateus Dec 26, 2023
6b1bd74
Merge remote-tracking branch 'origin/development' into fe-interactive…
socratic617 Dec 26, 2023
8709043
fixing issue with server and modules not loading
RoReeceDev Dec 26, 2023
6321197
fixing bcrypt import issue
RoReeceDev Dec 26, 2023
693d7f8
final updates
RoReeceDev Dec 26, 2023
abe0ec6
fix spacing
RoReeceDev Dec 26, 2023
7d30f00
Merge remote-tracking branch 'origin/BE-ro-fixing-module-issues' into…
socratic617 Dec 26, 2023
a46a924
Merge pull request #95 from Resilient-Labs/BE-ro-fixing-module-issues
anaiscmateus Dec 27, 2023
d7ecf5f
added conditional logic for 2 small features (fridge status and donat…
codedbycass Dec 27, 2023
2c158ee
fridge conditionals
codedbycass Dec 27, 2023
126bf6a
Merge pull request #89 from Resilient-Labs/fe-stylized-fridge-pages
anaiscmateus Dec 27, 2023
8d58a6f
Merge pull request #96 from Resilient-Labs/fe-fridge-conditionals
anaiscmateus Dec 27, 2023
e364ede
Merge branch 'development' into fe-interactive-map-about-me
anaiscmateus Dec 27, 2023
80a24f3
Merge pull request #97 from Resilient-Labs/fe-interactive-map-about-me
anaiscmateus Dec 27, 2023
c4e852c
delete fridgedata
anaiscmateus Dec 27, 2023
da70f30
cleaning up code
socratic617 Dec 27, 2023
7df42ff
cleaning up code
socratic617 Dec 27, 2023
2868b35
cleaning up code
socratic617 Dec 27, 2023
f3a45bb
Merge branch 'fe-interactive-map-about-me' of https://github.com/Resi…
socratic617 Dec 27, 2023
7f22900
Deleted extra "<Fridge/>" and data={fridgeData}
socratic617 Dec 27, 2023
a27c45b
changed tile map for interactive map
socratic617 Dec 27, 2023
46dc5b9
Merge pull request #98 from Resilient-Labs/fe-interactive-map-about-me
briannawillis195 Dec 27, 2023
63c18f6
cloudinary created for posts
RoReeceDev Dec 27, 2023
dad487e
add community board placeholder
anaiscmateus Dec 27, 2023
17d8d66
Merge pull request #100 from Resilient-Labs/BE-kyle-post-cloundinary
briannawillis195 Dec 27, 2023
a15f144
fe style login and signup pages
xsarahyu Dec 27, 2023
59e852b
Merge pull request #99 from Resilient-Labs/fe-add-community-placeholder
briannawillis195 Dec 27, 2023
e2212b5
Merge branch 'development' of https://github.com/Resilient-Labs/nouri…
xsarahyu Dec 27, 2023
fb22a55
fe style login and signup pages
xsarahyu Dec 27, 2023
3413e17
Merge pull request #102 from Resilient-Labs/fe-login-signup
xsarahyu Dec 27, 2023
8ca0e86
fixing cloudinary issue and routes for login and signup
RoReeceDev Dec 27, 2023
9513c71
fixing models
RoReeceDev Dec 27, 2023
730fa3e
Merge pull request #107 from Resilient-Labs/BE-ro-fix-errors-add-logi…
anaiscmateus Dec 28, 2023
88df810
Update login/signup with POST actions. Change signup labels (confirm-…
xsarahyu Dec 28, 2023
0849bc7
Merge pull request #116 from Resilient-Labs/fe-update-login-signup
briannawillis195 Dec 28, 2023
2d09e4d
completed fridge menu styling and logic
codedbycass Dec 28, 2023
4f5f95d
change login method to POST
xsarahyu Dec 28, 2023
e53aba0
change name of function, form method, and form action
xsarahyu Dec 28, 2023
01721e6
rewrite code to use async/await instead of callbacks
xsarahyu Dec 28, 2023
363b031
rewrite code to use async/await instead of callbacks. change fName/lN…
xsarahyu Dec 28, 2023
5dd2afd
Merge pull request #120 from Resilient-Labs/fe-fridge-landing-menu
briannawillis195 Dec 28, 2023
5bda98f
create terms and conditions and update signup page
anaiscmateus Dec 28, 2023
b4ad66e
Merge pull request #123 from Resilient-Labs/fe-create-terms-modal-and…
briannawillis195 Dec 28, 2023
cbc0606
Resolves issue with Community Page merge conflict
JoseDiazCodes Dec 29, 2023
3138341
fe-erik Fridge.js: making Fridge Map and Fridge List components web r…
socratic617 Dec 29, 2023
fb9c2a7
Merge pull request #126 from Resilient-Labs/FE-JoseCommunityPageComplete
briannawillis195 Dec 29, 2023
6de4710
Merge pull request #127 from Resilient-Labs/fe-interactive-map-about-me
briannawillis195 Dec 29, 2023
1930706
connect login to server
xsarahyu Dec 29, 2023
15b79e3
connect signin to server
xsarahyu Dec 29, 2023
27fd8d8
change fName/lName variables to firstName/lastName
xsarahyu Dec 29, 2023
152a4c5
delete comments
xsarahyu Dec 29, 2023
be13ae7
Merge branch 'development' into fe-be-connect-login-signup
xsarahyu Dec 29, 2023
6f35549
Merge pull request #128 from Resilient-Labs/fe-be-connect-login-signup
anaiscmateus Dec 29, 2023
3bca4ec
updated username field and key names for mongo
RoReeceDev Dec 29, 2023
0d437ab
Merge pull request #130 from Resilient-Labs/be-ro-change-userName-fields
anaiscmateus Dec 29, 2023
0ae225f
Add controller for team member profiles and fix a post route
JacinthaDev Dec 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions server/controllers/auth.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import passport from "passport";
import validator from "validator";
import User from "../models/User";
import passport from 'passport';
import validator from 'validator';
import { User } from "../models/User.js";

export const getLogin = (req, res) => {
if (req.user) {
97 changes: 49 additions & 48 deletions server/controllers/profile.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { cloudinary } from "../middleware/cloudinary.js"
import bcrypt from 'bcryptjs';
import { User } from "../models/User.js"
import { Post } from "../models/Post.js"

import pkg from "mongodb"
const { ObjectID } = pkg
import pkg1 from "mongodb"
const { ObjectID } = pkg1

import bcrypt from 'bcrypt';


export const getUserProfile = async (req, res) => {
@@ -35,64 +35,65 @@ export const changePassword = async (req, res) => {
const { currentPassword, newPassword, confirmPassword } = req.body;

try {
// Ensure the user is authenticated
if (!req.user) {
return res.status(401).json({ success: false, message: 'User not authenticated.' });
}

// Validate the new password
if (!validator.isLength(newPassword, { min: 8 })) {
return res.status(400).json({ success: false, message: 'Password must be at least 8 characters long.' });
}

if (newPassword !== confirmPassword) {
return res.status(400).json({ success: false, message: 'Passwords do not match.' });
}

// Fetch the user from the database
const user = await User.findById(req.user._id);

if (!user) {
return res.status(404).json({ success: false, message: 'User not found.' });
}

// Verify the current password
const isMatch = await bcrypt.compare(currentPassword, user.password);
if (!isMatch) {
return res.status(401).json({ success: false, message: 'Your current password is incorrect.' });
}

// Hash the new password
const salt = await bcrypt.genSalt(10);
const hash = await bcrypt.hash(newPassword, salt);

// Update the password
user.password = hash;
await user.save();

res.json({ success: true, message: 'Password successfully changed.' });
// Ensure the user is authenticated
if (!req.user) {
return res.status(401).json({ success: false, message: 'User not authenticated.' });
}

// Validate the new password
if (!validator.isLength(newPassword, { min: 8 })) {
return res.status(400).json({ success: false, message: 'Password must be at least 8 characters long.' });
}

if (newPassword !== confirmPassword) {
return res.status(400).json({ success: false, message: 'Passwords do not match.' });
}

// Fetch the user from the database
const user = await User.findById(req.user._id);

if (!user) {
return res.status(404).json({ success: false, message: 'User not found.' });
}

// Verify the current password
const isMatch = await bcrypt.compare(currentPassword, user.password);
if (!isMatch) {
return res.status(401).json({ success: false, message: 'Your current password is incorrect.' });
}

// Hash the new password
const salt = await bcrypt.genSalt(10);
const hash = await bcrypt.hash(newPassword, salt);

// Update the password
user.password = hash;
await user.save();

res.json({ success: true, message: 'Password successfully changed.' });
} catch (error) {
console.error(error);
res.status(500).json({ success: false, message: 'Internal Server Error' });
console.error(error);
res.status(500).json({ success: false, message: 'Internal Server Error' });
}
};

//set up changing/updating contact info

export const updateContact = async (req, res) => {
try {

const userId = req.params.id;

// Find the profile by ID and update
const updateProfile = await User.findByIdAndUpdate(
userId,
{ userName: req.body.userName.trim(),
fName: req.body.firstName.trim(),
lName: req.body.lastName.trim(),
email: req.body.email.trim(),
},
{ new: true }
{
userName: req.body.userName.trim(),
fName: req.body.firstName.trim(),
lName: req.body.lastName.trim(),
email: req.body.email.trim(),
},
{ new: true }
);

if (!updateProfile) {
4 changes: 2 additions & 2 deletions server/models/User.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import bcrypt from "bcrypt"
import mongoose from "mongoose"
import bcrypt from 'bcrypt';
import { mongoose } from "mongoose"

const UserSchema = new mongoose.Schema({
userName: { type: String, unique: true },
5 changes: 4 additions & 1 deletion server/server.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import express from "express"

import mongoose from "mongoose"
import session from "express-session"
import methodOverride from "method-override"
@@ -48,6 +49,8 @@ app.use(logger("dev"))
// Passport Config
configurePassport(passport)

console.log(process.env.DB_STRING)

// Setup Sessions - stored in MongoDB
const MongoStore = ConnectMongo.create({
mongoUrl: process.env.DB_STRING // Your MongoDB connection string
@@ -74,7 +77,7 @@ app.use(flash())
// Setup Routes For Which The Server Is Listening
app.use("/", fridgeRoutes)
app.use("/post", postRoutes)
app.use("/profile", postRoutes)
app.use("/profile", profileRoutes)


// Serve React App