Skip to content

Commit

Permalink
fix: add query param for forgot password form
Browse files Browse the repository at this point in the history
  • Loading branch information
attiyaIshaque committed Aug 16, 2024
1 parent beff591 commit 125e177
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/data/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export const VALID_AUTH_PARAMS = [

export const AUTH_MODE = 'authMode';
export const AUTH_MODE_LOGIN = 'Login';
export const AUTH_MODE_REGSITER = 'Register';
export const AUTH_MODE_REGISTER = 'Register';
export const AUTH_MODE_RESET_PASSWORD = 'ResetPassword';

// Regular expression for validating email addresses.
export const VALID_EMAIL_REGEX = '(^[-!#$%&\'*+/=?^_`{}|~0-9A-Z]+(\\.[-!#$%&\'*+/=?^_`{}|~0-9A-Z]+)*'
Expand Down
4 changes: 2 additions & 2 deletions src/forms/registration-popup/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import isFormValid from './data/utils';
import messages from './messages';
import { InlineLink, SocialAuthProviders } from '../../common-ui';
import {
AUTH_MODE_REGSITER,
AUTH_MODE_REGISTER,
COMPLETE_STATE,
ENTERPRISE_LOGIN_URL,
FAILURE_STATE,
Expand Down Expand Up @@ -148,7 +148,7 @@ const RegistrationForm = () => {

useEffect(() => {
moveScrollToTop(registerFormHeadingRef, 'end');
handleURLUpdationOnLoad(AUTH_MODE_REGSITER);
handleURLUpdationOnLoad(AUTH_MODE_REGISTER);
}, []);

useEffect(() => {
Expand Down
9 changes: 8 additions & 1 deletion src/forms/reset-password-popup/forgot-password/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ import getValidationMessage from './data/utils';
import ForgotPasswordFailureAlert from './ForgotPasswordFailureAlert';
import ForgotPasswordSuccess from './ForgotPasswordSuccess';
import { InlineLink } from '../../../common-ui';
import { COMPLETE_STATE, DEFAULT_STATE, LOGIN_FORM } from '../../../data/constants';
import {
AUTH_MODE_RESET_PASSWORD, COMPLETE_STATE, DEFAULT_STATE, LOGIN_FORM,
} from '../../../data/constants';
import { useDispatch, useSelector } from '../../../data/storeHooks';
import { handleURLUpdationOnLoad } from '../../../data/utils';
import { setCurrentOpenedForm } from '../../../onboarding-component/data/reducers';
import { trackForgotPasswordPageEvent, trackForgotPasswordPageViewed } from '../../../tracking/trackers/forgotpassword';
import EmailField from '../../fields/email-field';
Expand Down Expand Up @@ -57,6 +60,10 @@ const ForgotPasswordForm = () => {
error: formErrors,
}));
};
useEffect(() => {
handleURLUpdationOnLoad(AUTH_MODE_RESET_PASSWORD);
}, []);

const backToLogin = (e) => {
e.preventDefault();
backupFormDataHandler();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ describe('ForgotPasswordPage', () => {

beforeEach(() => {
store = mockStore(initialState);
window.history.replaceState = jest.fn();
});

afterEach(() => {
Expand Down

0 comments on commit 125e177

Please sign in to comment.