Skip to content

Commit

Permalink
* feat(rbac): Implement role based access control
Browse files Browse the repository at this point in the history
-define roles and permissions for vendors and buyers
-assign roles and permissions to users during registration or profile update
-enforce role-based access control throughout the application
-write comprehensive unit tests

[Delivers #34]

* feat(rbac): integrate rbac into user registration

-integrate role based access control into user registration

[Delivers #34]

* feat(rbac): integrate rbac into user registration

-integrate role based access control into user registration

[Delivers #34]

---------

Co-authored-by: ambroisegithub <muhayimana21@gmail.com>

Social Logins (#45)

* squashing commits

implementing routes for auth

create passport callback function

adding new user from Google

creating new user

check if user is exist in db

implementing cookie session

Fix error of TypeError: req.session.regenerate is not a function using Passport

fix secret keys

remove Google client secret keys

working on facebook strategy

get email from fb login and update the scope

after verification save the user into db

add profile image in db

fixing minor bugs

fix minor bugs in codes

after rebasing & updating some fts

link social login with userModel

Addong Google client keys & FB client key into yml

send confrim email after register a new user

send email after register from facebook

fix minor bugs

* fix minor errors

* remove lints errors

user register

register user test

register user testing fix

register user testing fix

register user testing fix

Authentication for User

Added slint changes

removed  mocha

 added new features

 added new features

Solved comflicts

changed file

added changes

added new Test

added new Test

resolved test cases

resolved test cases

implemented two-factor authentication for enhanced security

implemented two-factor authentication for enhanced security

check whether the usertype is vendor to proceed with 2FA

test the 2fa authentication

add new tests for buyers login

bug-fixes

fixing bugs to remove conflicts with develop

ft-password-recover-and-documentation

This PR corrects some bugs on the user password recover function and add the documentation in th swagger

bug-fixes

fixing bugs on the recover password endpoints

ft-password-rover

Thi PR add a password recover by email feature, it also have a new email templates to send recovering token to email, and finally it resolve color contrast issue on the button nside the email template

ft-password-recover-and-documentation

This PR corrects some bugs on the user password recover function and add the documentation in th swagger

bug-fixes

fixing bugs on the recover password endpoints

bug-fixes

bug-fixes
  • Loading branch information
jkarenzi authored and bertrandshema committed May 24, 2024
1 parent 3f44280 commit c19b2ad
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 36 deletions.
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 0 additions & 33 deletions src/controller/userController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,39 +207,6 @@ export const verify2FA = errorHandler(async (req: Request, res: Response) => {
return res.status(200).json({ token });
});

export const updateProfile = errorHandler(async (req: Request, res: Response) => {
const userId: number = parseInt(req.params.id);
const { firstName, lastName, email } = req.body as UpdateRrofileRequestBody;

const user = await userRepository.findOne({ where: { id: userId } });

if (!user) {
return res.status(404).json({ error: 'User not found' });
}

user.firstName = firstName || user.firstName;
user.lastName = lastName || user.lastName;


const emailExists = await userRepository.findOne({ where: { email } });

if (emailExists) {
return res.status(400).json({ error: 'Email is already taken' });
}

user.email = email;


const errors = await validate(user);

if (errors.length > 0) {
return res.status(400).json({ errors });
}

await userRepository.save(user);

return res.status(201).json({ message: 'User updated successfully' });
});

export const recoverPassword = errorHandler(async (req: Request, res: Response) => {
const { email } = req.body as { email: string };
Expand Down
4 changes: 2 additions & 2 deletions src/routes/userRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ userRouter.put(
deactivateAccount
);
userRouter.post('/recover', recoverPassword);
userRouter.post('/recover/confirm', updateNewPassword);
userRouter.post('/recover/confirm/:recoverToken', updateNewPassword);

export default userRouter;
export default userRouter;

0 comments on commit c19b2ad

Please sign in to comment.