Skip to content

Commit

Permalink
Merge pull request #285 from shreyas1434shinde/boardEnrollment
Browse files Browse the repository at this point in the history
Task #PS-2032 : Send email notification to the user upon reset password
  • Loading branch information
itsvick authored Sep 23, 2024
2 parents 701d274 + ee4a6dd commit 2290e98
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 67 deletions.
2 changes: 1 addition & 1 deletion public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
"PLEASE_RESET_YOUR_PASSWORD": "Please reset your password to ensure your account is secure",
"DO_IT_LATER": "I’ll do it later",
"SUCCESSFULLY_RESET": "Your password has been successfully reset",
"LINK_EXPIRED": "Link Expired",
"LINK_EXPIRED": "Link has been expired",
"WE_SEND_AN_EMAIL":"We sent an email to {{maskEmail}} with a link to reset your password",
"CURRENT_PASSWORD_NOT":"Current Password Not Matched",
"NO_USERNAME":"Username not found",
Expand Down
88 changes: 54 additions & 34 deletions src/pages/reset-password/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect, useState } from 'react';
import { Box } from '@mui/material';
import { Box, Divider } from '@mui/material';
import { useTranslation } from 'react-i18next';
import { useTheme } from '@mui/material/styles';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
Expand Down Expand Up @@ -86,41 +86,61 @@ const ResetPassword = () => {
<Image src={Logo} alt="App Logo" height={100} />
</Box>
<Box sx={{ padding: '60px' }}>
<Box
sx={{
color: theme.palette.warning['300'],
fontWeight: '400',
fontSize: '22px',
textAlign: 'center',
}}
>
{t('LOGIN_PAGE.CREATE_STRONG_PASSWORD')}
</Box>
<Box
sx={{
color: theme.palette.warning['300'],
fontWeight: '400',
fontSize: '14px',
textAlign: 'center',
mt: 0.5,
}}
>
{t('LOGIN_PAGE.CREATE_NEW')}
</Box>
{isTokenValid ? (
<PasswordCreate handleResetPassword={handleResetPassword} />
<>
<Box
sx={{
color: theme.palette.warning['300'],
fontWeight: '400',
fontSize: '22px',
textAlign: 'center',
}}
>
{t('LOGIN_PAGE.CREATE_STRONG_PASSWORD')}
</Box>
<Box
sx={{
color: theme.palette.warning['300'],
fontWeight: '400',
fontSize: '14px',
textAlign: 'center',
mt: 0.5,
}}
>
{t('LOGIN_PAGE.CREATE_NEW')}
</Box>
<PasswordCreate handleResetPassword={handleResetPassword} />
</>
) : (
<Box
sx={{
color: theme.palette.error.main,
fontWeight: '400',
fontSize: '16px',
textAlign: 'center',
mt: 2,
}}
>
{t('LOGIN_PAGE.LINK_EXPIRED')}
</Box>
<>
<Box
sx={{
color: theme.palette.error.main,
fontWeight: '500',
fontSize: '22px',
textAlign: 'center',
}}
>
{t('LOGIN_PAGE.LINK_EXPIRED')}
</Box>
<Box sx={{ mt: 3 }}>
<Divider />
</Box>
<Box
sx={{
mt: 2,
color: theme.palette.secondary.main,
textAlign: 'center',
fontSize: '14px',
fontWeight: '500',
}}
onClick={() => {
router.push('/login');
}}
>
{t('LOGIN_PAGE.BACK_TO_LOGIN')}
</Box>
</>
)}
<CentralizedModal
icon={true}
Expand Down
64 changes: 33 additions & 31 deletions src/pages/user-profile/[userId].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -627,42 +627,44 @@ const TeacherProfile: React.FC<TeacherProfileProp> = ({
<Box mt={5}>
<Typography textAlign={'center'}>{t('COMMON.LOADING')}</Typography>
</Box>
)}{' '}
<Box sx={{ px: '16px', mt: 2 }}>
<Box
sx={{
fontSize: '14px',
fontWeight: '500',
color: theme.palette.warning['300'],
}}
>
{t('LOGIN_PAGE.OTHER_SETTING')}
</Box>
<Box sx={{ mt: 2.5 }}>
<Button
variant="outlined"
color="primary"
)}
{selfUserId === userId ? (
<Box sx={{ px: '16px', mt: 2 }}>
<Box
sx={{
'&.Mui-disabled': {
backgroundColor: theme?.palette?.primary?.main,
},
minWidth: '84px',
padding: theme.spacing(1),
fontSize: '14px',
fontWeight: '500',
width: '188px',
height: '40px',
'@media (max-width: 430px)': {
width: '100%',
},
}}
onClick={() => {
router.push('/edit-password');
color: theme.palette.warning['300'],
}}
>
{t('LOGIN_PAGE.RESET_PASSWORD')}
</Button>
{t('LOGIN_PAGE.OTHER_SETTING')}
</Box>
<Box sx={{ mt: 2.5 }}>
<Button
variant="outlined"
color="primary"
sx={{
'&.Mui-disabled': {
backgroundColor: theme?.palette?.primary?.main,
},
minWidth: '84px',
padding: theme.spacing(1),
fontWeight: '500',
width: '188px',
height: '40px',
'@media (max-width: 430px)': {
width: '100%',
},
}}
onClick={() => {
router.push('/edit-password');
}}
>
{t('LOGIN_PAGE.RESET_PASSWORD')}
</Button>
</Box>
</Box>
</Box>
) : null}
</Box>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/services/LoginService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const successfulNotification = async (
key: any,
email: any
): Promise<any> => {
const apiUrl: string = `${process.env.NEXT_PUBLIC_NOTIFICATION_BASE_URL}/notification/send'`;
const apiUrl: string = `${process.env.NEXT_PUBLIC_NOTIFICATION_BASE_URL}/notification/send`;
try {
const response = await post(apiUrl, { isQueue, context, key, email });
console.log(email);
Expand Down

0 comments on commit 2290e98

Please sign in to comment.