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

Registration page connected #1140

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

H9660
Copy link

@H9660 H9660 commented Jun 21, 2024

Description

Users were facing issues as there was no way to register a new user. So created a pipeline for the same.

Related Issues

This PR solves the issue: #1136.

Steps to Test

Provide steps on how to test the changes introduced in this pull request.
-> Run on localhost
-> Go to the login page
-> There would be a register button. Click on it and you will be redirected to the registration form.

Screenshots (if applicable)

Here is the demo of the registration page.
c4ec2ad0-6156-4186-ba7d-f03d05c933bd.webm

Checklist

  • I have tested these changes
  • I have updated the relevant documentation
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the codebase
  • My changes generate no new warnings or errors
  • The title of my pull request is clear and descriptive

@H9660
Copy link
Author

H9660 commented Jun 23, 2024

@salahlalami Can you have a look at this?

@@ -2,7 +2,7 @@ const bcrypt = require('bcryptjs');
const jwt = require('jsonwebtoken');

const authUser = async (req, res, { user, databasePassword, password, UserPasswordModel }) => {
const isMatch = await bcrypt.compare(databasePassword.salt + password, databasePassword.password);
const isMatch = await bcrypt.compare(password, databasePassword.password);
Copy link
Contributor

@lukasz1mroz lukasz1mroz Jul 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we should stick to the existing hashing logic here otherwise admin login will fail

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay I will adjust this. Thanks for bringing this into view.

// authUser if your has correct password
const salt = await bcrypt.genSalt(10);
console.log(salt)
const hashedPassword = await bcrypt.hash(password, salt);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As with the comment above, we could reuse existing hashing logic from here. Maybe @salahlalami can confirm

const mongoose = require('mongoose');

const checkAndCorrectURL = require('./checkAndCorrectURL');
const sendMail = require('./sendMail');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do we use email sending logic?

Copy link
Contributor

@lukasz1mroz lukasz1mroz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @H9660 I think you've done nice work implementing registration workflow 😃 I'd just check hashing and email sending logic as in the comments and eventually consult with other maintainers.

@H9660
Copy link
Author

H9660 commented Jul 3, 2024

Hi @lukasz1mroz. Thanks. I will check in these issues and make necessary changes.

@H9660
Copy link
Author

H9660 commented Jul 6, 2024

Hi @lukasz1mroz. I have reverted the password hash logic. Also I have email sending logic on every registration. Please find it here: #1143

@AhsanSarwar0413
Copy link

@salahlalami please merge this asap. We have to fix more issues that are related to sign up page.

@H9660
Copy link
Author

H9660 commented Jul 17, 2024

@salahlalami please merge this asap. We have to fix more issues that are related to sign up page.

Hi @salahlalami . Please merge #1143 for this issue as it's the latest one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants