Skip to content

Commit

Permalink
Merge pull request #3055 from guardian/mm/fix-passcode-password-flow
Browse files Browse the repository at this point in the history
Fix | Show correct error page on password incorrect
  • Loading branch information
coldlink authored Feb 5, 2025
2 parents 055c91d + ba52864 commit 93ba9a5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions cypress/integration/ete/sign_in_passcode.8.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ describe('Sign In flow, with passcode', () => {
cy.contains('Enter your one-time code');
cy.contains('Sign in with password instead').click();

// password page
cy.url().should('include', '/signin/password');
cy.get('input[name=email]').should('have.value', emailAddress);
cy.get('input[name=password]').type(finalPassword);
Expand All @@ -194,6 +195,25 @@ describe('Sign In flow, with passcode', () => {
});
});

it('selects password option to sign in and show correct error page on incorrect password', () => {
const emailAddress = randomMailosaurEmail();
cy.visit(`/signin?usePasscodeSignIn=true`);
cy.get('input[name=email]').type(emailAddress);
cy.get('[data-cy="main-form-submit-button"]').click();
// passcode page
cy.url().should('include', '/signin/code');
cy.contains('Enter your one-time code');
cy.contains('Sign in with password instead').click();

// password page
cy.url().should('include', '/signin/password');
cy.get('input[name=email]').should('have.value', emailAddress);
cy.get('input[name=password]').type(randomPassword());
cy.get('[data-cy="main-form-submit-button"]').click();
cy.url().should('include', '/signin/password');
cy.contains('Email and password don’t match');
});

it('should sign in with passcode - resend email', () => {
cy
.createTestUser({
Expand Down
2 changes: 1 addition & 1 deletion src/server/controllers/signInControllers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ export const oktaIdxApiSignInController = async ({

// if we're using passcodes, and the user is attempting to sign in with a password
// on error show the password sign in page
const errorPage: RoutePaths = usePasscode ? '/signin/password' : '/signin';
const errorPage: RoutePaths = usePasscode ? '/signin' : '/signin/password';

const html = renderer(errorPage, {
requestState: mergeRequestState(res.locals, {
Expand Down

0 comments on commit 93ba9a5

Please sign in to comment.