Skip to content

Commit

Permalink
fix: duplicate messages in recovery flow (#2592)
Browse files Browse the repository at this point in the history
  • Loading branch information
erolkskn authored Jul 21, 2022
1 parent 6c14b68 commit 43fcc51
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions selfservice/flow/recovery/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ func (s *ErrorHandler) WriteFlowError(
return
}

f.UI.ResetMessages()
if err := f.UI.ParseError(group, err); err != nil {
s.forward(w, r, f, err)
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,22 @@ context('Account Recovery Errors', () => {
cy.get('[name="method"][value="link"]').should('exist')
})

it('should cause non-repeating form errors after submitting empty form twice. see: #2512', () => {
cy.visit(recovery)
cy.get('button[value="link"]').click()
cy.location('pathname').should('eq', '/recovery')

cy.get('button[value="link"]').click()
cy.get('[data-testid="ui/message/4000002"]').should(
'contain.text',
'Property email is missing.'
)
cy.get('form')
.find('[data-testid="ui/message/4000002"]')
.should('have.length', 1)
cy.get('[name="method"][value="link"]').should('exist')
})

it('is unable to recover the email address if the code is expired', () => {
cy.shortLinkLifespan()
const identity = gen.identityWithWebsite()
Expand Down

0 comments on commit 43fcc51

Please sign in to comment.