-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: design for forgot password and reset password
- Loading branch information
1 parent
4b83b3e
commit cc77601
Showing
17 changed files
with
453 additions
and
27 deletions.
There are no files selected for viewing
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
This file was deleted.
Oops, something went wrong.
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from 'react'; | ||
|
||
import { useIntl } from '@edx/frontend-platform/i18n'; | ||
|
||
import messages from './messages'; | ||
|
||
/** | ||
* Header component for the reset password form. | ||
* Renders the heading for the reset password form along with a separator. | ||
* @returns {JSX.Element} The rendered header component. | ||
*/ | ||
const ResetPasswordHeader = () => { | ||
const { formatMessage } = useIntl(); | ||
|
||
return ( | ||
<> | ||
<h2 className="font-italic text-center display-1 mb-4 text-dark-500"> | ||
{formatMessage(messages.resetPasswordFormHeading)} | ||
</h2> | ||
<hr className="separator mb-3 mt-3" /> | ||
</> | ||
); | ||
}; | ||
|
||
export default ResetPasswordHeader; |
44 changes: 44 additions & 0 deletions
44
src/forms/reset-password-popup/forgot-password/ForgotPasswordEmailSentConfirmation.jsx
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React from 'react'; | ||
|
||
import { getConfig } from '@edx/frontend-platform'; | ||
import { FormattedMessage, useIntl } from '@edx/frontend-platform/i18n'; | ||
import { Alert } from '@openedx/paragon'; | ||
|
||
import messages from '../messages'; | ||
|
||
/** | ||
* Component to display confirmation message after sending the password reset email. | ||
* @returns {JSX.Element} The rendered confirmation message component. | ||
*/ | ||
const ForgotPasswordEmailSentConfirmation = () => { | ||
const { formatMessage } = useIntl(); | ||
|
||
return ( | ||
<div className="text-gray-800 mb-5"> | ||
<span className="font-weight-bold mr-2 h3 text-center d-block"> | ||
{formatMessage(messages.emailSentMessage)} | ||
</span> | ||
<span> | ||
<FormattedMessage | ||
id="forgot.password.confirmation.message" | ||
defaultMessage="We sent an email to {email} with instructions to reset your password. | ||
If you do not receive a password reset message after 1 minute, verify that you entered | ||
the correct email address, or check your spam folder. If you need further assistance, visit Help | ||
Center contact edX support at {supportLink}." | ||
description="Forgot password confirmation message" | ||
values={{ | ||
email: <span className="data-hj-suppress">[email protected]</span>, | ||
supportLink: ( | ||
<Alert.Link href={getConfig().PASSWORD_RESET_SUPPORT_LINK} target="_blank"> | ||
[email protected] | ||
</Alert.Link> | ||
), | ||
}} | ||
/> | ||
</span> | ||
</div> | ||
|
||
); | ||
}; | ||
|
||
export default ForgotPasswordEmailSentConfirmation; |
95 changes: 95 additions & 0 deletions
95
src/forms/reset-password-popup/forgot-password/ForgotPasswordPage.jsx
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import React, { useState } from 'react'; | ||
|
||
import { getConfig } from '@edx/frontend-platform'; | ||
import { useIntl } from '@edx/frontend-platform/i18n'; | ||
import { | ||
Button, Container, Form, | ||
} from '@openedx/paragon'; | ||
|
||
import ForgotPasswordEmailSentConfirmation from './ForgotPasswordEmailSentConfirmation'; | ||
import { InlineLink } from '../../../common-ui'; | ||
import EmailField from '../../fields/email-field'; | ||
import messages from '../messages'; | ||
import ResetPasswordHeader from '../ResetPasswordHeader'; | ||
import '../index.scss'; | ||
|
||
/** | ||
* ForgotPasswordForm component for handling user password reset. | ||
* This component provides a form for users to reset their password by entering their email. | ||
*/ | ||
const ForgotPasswordPage = () => { | ||
const { formatMessage } = useIntl(); | ||
|
||
const [formFields, setFormFields] = useState({ email: '' }); | ||
const [isSuccess, setIsSuccess] = useState(false); | ||
|
||
const handleOnChange = (event) => { | ||
const { name } = event.target; | ||
const value = event.target.type === 'checkbox' ? event.target.checked : event.target.value; | ||
setFormFields(prevState => ({ ...prevState, [name]: value })); | ||
}; | ||
|
||
const handleSubmit = (e) => { | ||
e.preventDefault(); | ||
setIsSuccess(true); | ||
}; | ||
|
||
return ( | ||
<Container size="lg" className="p-5 overflow-auto"> | ||
<ResetPasswordHeader /> | ||
{!isSuccess && ( | ||
<Form id="forgot-password-form" name="reset-password-form" className="d-flex flex-column my-4.5"> | ||
<EmailField | ||
name="email" | ||
value={formFields.email} | ||
handleChange={handleOnChange} | ||
floatingLabel={formatMessage(messages.forgotPasswordFormEmailFieldLabel)} | ||
/> | ||
<Button | ||
id="reset-password-user" | ||
name="reset-password-user" | ||
variant="primary" | ||
type="submit" | ||
className="align-self-end" | ||
onClick={handleSubmit} | ||
onMouseDown={(e) => e.preventDefault()} | ||
> | ||
{formatMessage(messages.resetPasswordFormSubmitButton)} | ||
</Button> | ||
<div> | ||
<InlineLink | ||
className="mb-2" | ||
destination={getConfig().LOGIN_ISSUE_SUPPORT_LINK} | ||
linkHelpText={formatMessage(messages.resetPasswordFormNeedHelpText)} | ||
linkText={formatMessage(messages.resetPasswordFormHelpCenterLink)} | ||
/> | ||
<InlineLink | ||
className="mb-2 font-weight-normal small" | ||
destination={getConfig().INFO_EMAIL} | ||
linkHelpText={formatMessage(messages.resetPasswordFormAdditionalHelpText)} | ||
linkText={formatMessage(messages.resetPasswordFormAdditionalHelpLink)} | ||
/> | ||
</div> | ||
</Form> | ||
)} | ||
{isSuccess && ( | ||
<ForgotPasswordEmailSentConfirmation /> | ||
)} | ||
<form className="text-center"> | ||
<Button | ||
id="reset-password-back-to-login" | ||
name="reset-password-back-to-login" | ||
variant="tertiary" | ||
type="submit" | ||
className="align-self-center back-to-login__button" | ||
onClick={handleSubmit} | ||
onMouseDown={(e) => e.preventDefault()} | ||
> | ||
{formatMessage(messages.resetPasswordBackToLoginButton)} | ||
</Button> | ||
</form> | ||
</Container> | ||
); | ||
}; | ||
|
||
export default ForgotPasswordPage; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
@import "~@edx/brand/paragon/variables"; | ||
|
||
.separator { | ||
border: 0; | ||
border-top: 0.075rem solid $light-500 | ||
} | ||
.back-to-login__button { | ||
border-color: $primary-500; | ||
border: 2px solid; | ||
} | ||
#set-reset-password-form .pgn__form-control-floating-label-text:after { | ||
content: none; | ||
} | ||
.help-text { | ||
line-height: 0.5; | ||
} |
Oops, something went wrong.