Skip to content

Commit

Permalink
Merge pull request #87 from harish08102004/fix/password-type-mismatch
Browse files Browse the repository at this point in the history
Fix password argument type mismatch in authentication process
  • Loading branch information
Soujanya2004 authored Oct 14, 2024
2 parents f56510b + 054c27c commit 164fd17
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
MAP_TOKEN=
ATLAS_DB_TOKEN=
SECRET=
CLOUD_NAME=
CLOUD_API_KEY=
CLOUD_API_SECRET=
PORT=8080
1 change: 1 addition & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ app.get('/about',asyncwrap ( async (req, res) => {
app.post('/signup', asyncwrap(async (req, res, next) => {
const { username, email, password } = req.body;


// Check for missing fields
if (!username || !password) {
req.flash('error', 'Username and password are required');
Expand Down
3 changes: 2 additions & 1 deletion controllers/listing.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ module.exports.showPost = async (req, res) => {

module.exports.saveEditpost = async (req, res) => {
const { id } = req.params;

console.log("saveditpost");
try {
if (!req.body.listing) {
req.flash('error', ERROR_SEND_VALID_DATA);
Expand Down Expand Up @@ -189,6 +189,7 @@ module.exports.saveEditpost = async (req, res) => {


module.exports.deletepost = async (req, res) => {
console.log("Deleting listing with ID:", req.params.id);
const { id } = req.params;
try {
await listing.findByIdAndDelete(id); // Deconstructing parameters
Expand Down
2 changes: 1 addition & 1 deletion init/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ main()
.catch((err) => console.log(err));

async function main() {
await mongoose.connect('mongodb://127.0.0.1:27017/wanderlust');
await mongoose.connect(process.env.MONGO_URL);
}

const initdb = async () =>{
Expand Down
2 changes: 1 addition & 1 deletion views/signup.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<div class="mb-3">
<label for="password" class="form-label">Confirm Password</label>
<br>
<input type="password" name="password" placeholder="Password" class="form-control" required>
<input type="password" name="cnf-password" placeholder="Password" class="form-control" required>
<div class="valid-feedback">
looks great!
</div>
Expand Down

0 comments on commit 164fd17

Please sign in to comment.