Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Commit

Permalink
Merge pull request #216 from cfpb/request-more-often
Browse files Browse the repository at this point in the history
Make institution request on load after accidental submit and on autofill
  • Loading branch information
awolfe76 authored Feb 14, 2018
2 parents 0374def + 1c41445 commit 54eaece
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion keycloak/themes/hmda/login/messages/messages_en.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
missingInstitutionMessage=• Please specify the financial institution(s) for which you will be filing HMDA data.
missingInstitutionMessage=• Please choose the financial institution(s) for which you will be filing from the list below your email address.
invalidInstitutionMessage=&#8226; The financial institution <strong>{0}</strong> is not associated with <strong>{1}</strong> email domain.
unknownEmailDomainMessage=&#8226; The email domain <strong>{0}</strong> is not in the known list of HMDA filer domains.
institutionErrorMessage=&#8226; An error occurred while validating the financial institution(s) against the <strong>{0}</strong> email domain.
Expand Down
10 changes: 7 additions & 3 deletions keycloak/themes/hmda/login/resources/js/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,11 @@
var lastEmail = null

//Process email and make debounced request when typing in email field
email.on('blur keyup', function(e) {
email.on('blur keyup', checkEmail)

checkEmail({})

function checkEmail(e) {
var emailVal = email.val().trim()
if (emailVal === lastEmail) return
else lastEmail = emailVal
Expand All @@ -172,13 +176,13 @@
// don't make the API call on tab keyup
var domain = emailToDomain(emailVal)
if (
(emailExp.test(emailVal) && e.keyCode) ||
emailExp.test(emailVal) ||
(e.type === 'blur' && domain !== '' && domain !== undefined)
) {
debounceRequest(domain)
}
}
})
}

//Save institution to input when clicked
$('#institutions').on('click', '.institutionsCheck', addInstitutionsToInput)
Expand Down

0 comments on commit 54eaece

Please sign in to comment.