Skip to content
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

Fix | Show correct error page on password incorrect #3055

Merged
merged 1 commit into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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