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

Encrypted Password Before Storing #211

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
27 changes: 16 additions & 11 deletions blog.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,24 @@
"content": "In the hustle and bustle of modern life, finding moments of stillness becomes a precious endeavor. Mindfulness, the practice of being present in the current moment without judgment, offers a serene refuge in our fast-paced world. Picture yourself in a quiet space, surrounded by nature's symphony. As you take a deep breath, feel the cool breeze on your skin. Inhale, exhale – a simple rhythm that connects you with the essence of now. Mindfulness isn't about emptying the mind but rather observing thoughts without attachment. It's a journey inward, exploring the depths of your consciousness. Through regular practice, you cultivate a profound awareness that extends to your daily experiences. Embrace mindfulness as a gift to yourself. Let it be the compass guiding you through the ebb and flow of life. In this oasis of tranquility, discover the art of mindfulness and unlock a world of inner peace and clarity."
},
{
"id":5,
"title":"Finding the common point between Technology and Creativity",
"content":"Growing up, I was always drawn to both the logical precision of technology and the boundless possibilities of creative expression. From tinkering with gadgets to exploring the depths of storytelling, I found joy in weaving together the analytical and the imaginative. However, as I entered the realm of higher education, I felt pressured to choose between these seemingly disparate interests.My first year as a technology student was a whirlwind of lectures, assignments, and late-night coding sessions. While I thrived in the structured environment of problem-solving and logical reasoning, I couldn’t shake the feeling of something missing. It wasn’t until I stumbled upon a course in digital media that I realized the importance of integrating creativity into my technical pursuits.As I delved into the world of digital media, I discovered a newfound sense of freedom and self-expression. From graphic design to multimedia storytelling, I found avenues to channel my creativity while still leveraging my technical skills. Suddenly, coding wasn’t just about solving equations; it was a tool for bringing ideas to life, for building immersive digital experiences that resonated with audiences on a deeper level.One project that particularly stands out is a multimedia presentation I created for a class assignment. Combining interactive visuals, audio elements, and animated graphics, I was able to convey complex concepts in a way that was engaging and accessible. It was a moment of realization — technology wasn’t just a means to an end; it was a canvas for creative expression.But finding my voice wasn’t without its challenges. Balancing the rigorous demands of my technical coursework with the creative exploration of digital media often felt like walking a tightrope. There were moments of frustration, self-doubt, and the nagging fear of not being “technical” enough. Yet, with each challenge came growth — a deeper understanding of myself, my passions, and the unique perspective I bring to the table.As I progressed through my studies, I sought out opportunities to bridge the gap between technology and creativity. Whether through collaborative projects, extracurricular activities, or personal exploration, I embraced every chance to explore the intersection of these seemingly disparate worlds.Today, as I stand on the brink of graduation, I am grateful for the journey that has brought me to this moment. I’ve come to realize that being a technology student doesn’t mean sacrificing creativity; rather, it’s about finding innovative ways to marry the two. Whether it’s through designing intuitive user interfaces, crafting compelling narratives, or pushing the boundaries of digital art, I am committed to continuing my pursuit of creative expression within the realm of technology."
"id": 5,
"title": "Finding the common point between Technology and Creativity",
"content": "Growing up, I was always drawn to both the logical precision of technology and the boundless possibilities of creative expression. From tinkering with gadgets to exploring the depths of storytelling, I found joy in weaving together the analytical and the imaginative. However, as I entered the realm of higher education, I felt pressured to choose between these seemingly disparate interests.My first year as a technology student was a whirlwind of lectures, assignments, and late-night coding sessions. While I thrived in the structured environment of problem-solving and logical reasoning, I couldn’t shake the feeling of something missing. It wasn’t until I stumbled upon a course in digital media that I realized the importance of integrating creativity into my technical pursuits.As I delved into the world of digital media, I discovered a newfound sense of freedom and self-expression. From graphic design to multimedia storytelling, I found avenues to channel my creativity while still leveraging my technical skills. Suddenly, coding wasn’t just about solving equations; it was a tool for bringing ideas to life, for building immersive digital experiences that resonated with audiences on a deeper level.One project that particularly stands out is a multimedia presentation I created for a class assignment. Combining interactive visuals, audio elements, and animated graphics, I was able to convey complex concepts in a way that was engaging and accessible. It was a moment of realization — technology wasn’t just a means to an end; it was a canvas for creative expression.But finding my voice wasn’t without its challenges. Balancing the rigorous demands of my technical coursework with the creative exploration of digital media often felt like walking a tightrope. There were moments of frustration, self-doubt, and the nagging fear of not being “technical” enough. Yet, with each challenge came growth — a deeper understanding of myself, my passions, and the unique perspective I bring to the table.As I progressed through my studies, I sought out opportunities to bridge the gap between technology and creativity. Whether through collaborative projects, extracurricular activities, or personal exploration, I embraced every chance to explore the intersection of these seemingly disparate worlds.Today, as I stand on the brink of graduation, I am grateful for the journey that has brought me to this moment. I’ve come to realize that being a technology student doesn’t mean sacrificing creativity; rather, it’s about finding innovative ways to marry the two. Whether it’s through designing intuitive user interfaces, crafting compelling narratives, or pushing the boundaries of digital art, I am committed to continuing my pursuit of creative expression within the realm of technology."
},
{
"id":6,
"title":"Finding Solitude in a Noisy World",
"content":"In today's fast-paced and constantly buzzing world, finding moments of solitude can feel like searching for a needle in a haystack. We're bombarded with notifications, messages, and the constant hum of technology. Yet, amidst this chaos, carving out pockets of peace and quiet is essential for our mental well-being.Solitude doesn't necessarily mean being physically alone; it's more about finding inner peace and tranquility regardless of our surroundings. It's about disconnecting from the noise of the world and reconnecting with ourselves.Finding solitude in a noisy world is not always easy, but it's essential for our mental, emotional, and spiritual well-being. By intentionally creating moments of quiet reflection and disconnection, we cultivate a deeper sense of inner peace and resilience to navigate the challenges of modern life. So, take a deep breath, unplug from the chaos, and reconnect with the serenity that lies within."
"id": 6,
"title": "Finding Solitude in a Noisy World",
"content": "In today's fast-paced and constantly buzzing world, finding moments of solitude can feel like searching for a needle in a haystack. We're bombarded with notifications, messages, and the constant hum of technology. Yet, amidst this chaos, carving out pockets of peace and quiet is essential for our mental well-being.Solitude doesn't necessarily mean being physically alone; it's more about finding inner peace and tranquility regardless of our surroundings. It's about disconnecting from the noise of the world and reconnecting with ourselves.Finding solitude in a noisy world is not always easy, but it's essential for our mental, emotional, and spiritual well-being. By intentionally creating moments of quiet reflection and disconnection, we cultivate a deeper sense of inner peace and resilience to navigate the challenges of modern life. So, take a deep breath, unplug from the chaos, and reconnect with the serenity that lies within."
},
{
"id":7,
"title":"Cultivating Resilience: Navigating Life's Challenges with Strength and Grace",
"content":"Life is full of unexpected twists and turns, and no matter how carefully we plan, we are bound to encounter obstacles and setbacks along the way. In the face of adversity, cultivating resilience becomes essential – the ability to bounce back from challenges with strength, determination, and grace.Resilience is not about avoiding hardship or denying the pain of difficult experiences; rather, it's about facing adversity head-on and finding ways to grow stronger as a result. It's a skill that can be developed and nurtured, empowering us to navigate life's ups and downs with greater ease and resilience. Cultivating resilience is an ongoing process that requires patience, practice, and perseverance. By adopting a growth mindset, building a strong support network, practicing self-compassion, finding meaning in adversity, cultivating healthy coping strategies, maintaining perspective, and staying flexible and adapt, you can navigate life's challenges with strength, resilience, and grace. Remember that resilience is not about avoiding hardship, but rather about facing it with courage and resilience, knowing that you have the inner strength to overcome whatever comes your way."
}
"id": 7,
"title": "Cultivating Resilience: Navigating Life's Challenges with Strength and Grace",
"content": "Life is full of unexpected twists and turns, and no matter how carefully we plan, we are bound to encounter obstacles and setbacks along the way. In the face of adversity, cultivating resilience becomes essential – the ability to bounce back from challenges with strength, determination, and grace.Resilience is not about avoiding hardship or denying the pain of difficult experiences; rather, it's about facing adversity head-on and finding ways to grow stronger as a result. It's a skill that can be developed and nurtured, empowering us to navigate life's ups and downs with greater ease and resilience. Cultivating resilience is an ongoing process that requires patience, practice, and perseverance. By adopting a growth mindset, building a strong support network, practicing self-compassion, finding meaning in adversity, cultivating healthy coping strategies, maintaining perspective, and staying flexible and adapt, you can navigate life's challenges with strength, resilience, and grace. Remember that resilience is not about avoiding hardship, but rather about facing it with courage and resilience, knowing that you have the inner strength to overcome whatever comes your way."
},
{
"title": "Online Job Portal",
"content": "Job Ready",
"image": "Picture1.png"
}
]
}
}
5 changes: 4 additions & 1 deletion controllers/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ module.exports.signUp = async (req, res, next) => {
}

try {

// Register the new user
const registeredUser = await User.register(newUser, password);
const registeredUser = await User.create({
name,email,password
});

// Log in the user after registration
await req.logIn(registeredUser, (err) => {
Expand Down
22 changes: 21 additions & 1 deletion models/auth.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const mongoose = require("mongoose");
const passportLocalMongoose = require("passport-local-mongoose");
const bcrypt = require("bcrypt");


const { Schema } = mongoose;

Expand All @@ -9,6 +11,24 @@ const authSchema = new Schema({
password: String,
});

// Pre-save hook to hash the password before saving the user
authSchema.pre('save', async function (next) {
const auth = this;

// Only hash the password if it has been modified (or is new)
if (!auth.isModified('password')) return next();

try {
// Generate a salt and hash the password
const saltRounds = 10;
auth.password = await bcrypt.hash(auth.password, saltRounds);
next();
} catch (err) {
next(err);
}
});


authSchema.plugin(passportLocalMongoose, { usernameField: "email" });

module.exports.User = mongoose.model("User", authSchema);
module.exports.User = mongoose.model("User", authSchema);
Loading