Skip to content

Commit

Permalink
Merge branch 'Sahil1786:main' into password-strength/formValidation
Browse files Browse the repository at this point in the history
  • Loading branch information
Samani-Humaira committed May 30, 2024
2 parents 4f8968f + 0a01569 commit b03b071
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 11 deletions.
34 changes: 34 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,40 @@ in case you are stuck:

<br>

### Alternatively, contribute using GitHub Desktop

1. **Open GitHub Desktop:**
Launch GitHub Desktop and log in to your GitHub account if you haven't already.

2. **Clone the Repository:**
- If you haven't cloned the Petari repository yet, you can do so by clicking on the "File" menu and selecting "Clone Repository."
- Choose the Petari repository from the list of repositories on GitHub and clone it to your local machine.

3. **Switch to the Correct Branch:**
- Ensure you are on the branch that you want to submit a pull request for.
- If you need to switch branches, you can do so by clicking on the "Current Branch" dropdown menu and selecting the desired branch.

4. **Make Changes:**
Make your changes to the code or files in the repository using your preferred code editor.

5. **Commit Changes:**
- In GitHub Desktop, you'll see a list of the files you've changed. Check the box next to each file you want to include in the commit.
- Enter a summary and description for your changes in the "Summary" and "Description" fields, respectively. Click the "Commit to <branch-name>" button to commit your changes to the local branch.

6. **Push Changes to GitHub:**
After committing your changes, click the "Push origin" button in the top right corner of GitHub Desktop to push your changes to your forked repository on GitHub.

7. **Create a Pull Request:**
- Go to the GitHub website and navigate to your fork of the Petari repository.
- You should see a button to "Compare & pull request" between your fork and the original repository. Click on it.

8. **Review and Submit:**
- On the pull request page, review your changes and add any additional information, such as a title and description, that you want to include with your pull request.
- Once you're satisfied, click the "Create pull request" button to submit your pull request.

9. **Wait for Review:**
Your pull request will now be available for review by the project maintainers. They may provide feedback or ask for changes before merging your pull request into the main branch of the Petari repository.

## **Issue Report Process 📌**

1. Go to the project's issues.
Expand Down
42 changes: 31 additions & 11 deletions routers/userRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const path = require("path");
const bcrypt = require("bcrypt");
const saltRounds = 10;
const jwt = require("jsonwebtoken");
const nodemailer = require("nodemailer");

const User = require("../model/user");
const Query = require("../model/query"); // Adjust the path based on your project structure
Expand Down Expand Up @@ -226,6 +227,7 @@ router.get("/logout", function (req, res) {
// user Registration
router.post("/User_singUp", async function (req, res) {
const { username } = req.body;
const fullName = req.body.fname;

try {
// Check if the email already exists
Expand All @@ -252,37 +254,55 @@ router.post("/User_singUp", async function (req, res) {
password: hash,
});

// creating a message for USER
const message = `Thank you, ${(fullName).toUpperCase()}, for connecting with the PETARI organization.`

await newUser.save().then((user) => {
let mailOptions = {
to: user.email,
subject: "Welcome To Petari",
template: "Email.template",
context: {
user: {
fname: user.fullName,
_id: user._id,
username: user.fullName,
email: user.email,
},
year: new Date().getFullYear(),
},
// context: {
// user: {
// fname: user.fullName,
// _id: user._id,
// username: user.fullName,
// email: user.email,
// },
// year: new Date().getFullYear(),
// },
text: message,
attachments: [
{
filename: "logo.png",
path: path.join(__dirname, "public", "img", "logo.png"),
path: path.join(__dirname, "..", "public", "img", "logo.png"),
cid: "logo",
},
],
};

const transporter = nodemailer.createTransport({
service: "gmail",
host: "smtp.gmail.com",
port: 465,
secure: true,
auth: {
user: process.env.mail_id,
pass: process.env.pass_id,
},
});

transporter.sendMail(mailOptions, function (error, info) {
if (error) {
console.log(error);
} else {
console.log("Email sent: " + info.response);
console.log("Email sent successfully: " + info.response);
}
});
});

const foundUser = await User.findOne({ email: username });

const userQuerys = await Query.find({ user_id: foundUser._id });

return res.render("UserDashBoard", {
Expand Down

0 comments on commit b03b071

Please sign in to comment.