-
Notifications
You must be signed in to change notification settings - Fork 0
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
ft: implement user logout feature #67
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ndevu12
requested review from
MC-Knight,
elijahladdie,
maxCastro1 and
faid-terence
and removed request for
MC-Knight and
elijahladdie
May 6, 2024 11:53
Closed
4 tasks
Ndevu12
changed the title
Ft-implement user logout feature
ft-implement user logout feature
May 6, 2024
Ndevu12
changed the title
ft-implement user logout feature
ft: implement user logout feature
May 6, 2024
Ndevu12
force-pushed
the
ft-logout
branch
3 times, most recently
from
May 7, 2024 11:10
5f07546
to
5ea5e8d
Compare
Pull Request Test Coverage Report for Build 8985631303Details
💛 - Coveralls |
maxCastro1
approved these changes
May 7, 2024
elijahladdie
reviewed
May 7, 2024
Comment on lines
13
to
33
const { email } = req.body; | ||
|
||
if (!email) { | ||
console.log('No email address provided'); | ||
return res.status(400).json({ status: 'error', message: 'Please provide an email' }); | ||
} | ||
|
||
const userRepository = getRepository(User); | ||
const user = await userRepository.findOneBy({ email }); | ||
|
||
if (!user) { | ||
console.log('User not found'); | ||
return res.status(404).json({ status: 'error', message: 'Incorrect email' }); | ||
} | ||
|
||
const otpCode = await start2FAProcess(user.email); | ||
if (!otpCode) throw new Error('Error generating OTP'); | ||
const OTPEmailcontent = otpTemplate(user.firstName, otpCode.toString()); | ||
if (!OTPEmailcontent) throw new Error('Error generating OTP email content'); | ||
await sendOTPEmail('Login OTP', user.email, OTPEmailcontent); | ||
if (process.env.APP_ENV !== 'test') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove consoles please
Comment on lines
21
to
26
|
||
try { | ||
const info = await transporter.sendMail(mailOptions); | ||
console.log('Message sent: %s', info.messageId); | ||
} catch (error) { | ||
console.log('Error occurred while sending email', error); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove console.log here as well
elijahladdie
approved these changes
May 7, 2024
faid-terence
approved these changes
May 7, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice Work @Ndevu12 !
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This pull request aims to add feature that enables a user to logout
Description of Task to be completed?
The task completed in this pull request includes:
How should this be manually tested?
To manually test all the changes made in this pull request, follow these steps: