Skip to content

Commit

Permalink
fix: Display agresive spam filter rule warning banner (#1058)
Browse files Browse the repository at this point in the history
Closes #1047
  • Loading branch information
kumy authored Aug 31, 2024
1 parent c848c5a commit 10cb5ff
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests-qa/acceptance/010_UserRegistration/012_EmailBanner.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
*** Settings ***
Library RequestsLibrary
Resource ../ressources/Authentication.robot
Test Setup Test Setup

*** Test Cases ***

Display agresive spam filter rule warning banner
[Documentation] Show a banner for o2/wp.pl domains
Go To Url ${PAGE_REGISTER_URL}

Input Text ${REGISTRATION_EMAIL_INPUT} [email protected]
Element Should Not Be Visible ${REGISTRATION_BANNER_AGRESSIVE_SPAM_RULES}

Input Text ${REGISTRATION_EMAIL_INPUT} [email protected]
Wait Until Element Is Visible ${REGISTRATION_BANNER_AGRESSIVE_SPAM_RULES}

Input Text ${REGISTRATION_EMAIL_INPUT} [email protected]
Element Should Not Be Visible ${REGISTRATION_BANNER_AGRESSIVE_SPAM_RULES}

Input Text ${REGISTRATION_EMAIL_INPUT} [email protected]
Wait Until Element Is Visible ${REGISTRATION_BANNER_AGRESSIVE_SPAM_RULES}

Input Text ${REGISTRATION_EMAIL_INPUT} [email protected]
Element Should Not Be Visible ${REGISTRATION_BANNER_AGRESSIVE_SPAM_RULES}


*** Keywords ***

Test Setup
Clear Database
Sign Out Fast
1 change: 1 addition & 0 deletions tests-qa/acceptance/ressources/Authentication.robot
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ ${REGISTRATION_PASSWORD_CONFIRM_INPUT} //*[@id="passwordConfirmInput"]
${REGISTRATION_PREFERRED_LANGUAGE_SELECT} //*[@id="preferredLanguageInput"]
${REGISTRATION_DAILY_MAIL_CHECKBOX} //*[@id="dailyMailsInput"]
${REGISTRATION_TERMS_OF_USE_CHECKBOX} //*[@id="termsOfUseInput"]
${REGISTRATION_BANNER_AGRESSIVE_SPAM_RULES} //*[@id="banner-registration-spam-filter"]

################
# SIGN IN FORM
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div id="banner-registration-spam-filter" class="alert alert-danger" role="alert" style="display: none;">
{t email=GK_SITE_EMAIL escape=no}To o2.pl/wp.pl users, due to agressive spam filter rules with these email service providers, <b>please add <u>%1</u> to your address book</b> before creating your account.{/t}
</div>
2 changes: 2 additions & 0 deletions website/app-templates/smarty/forms/registration.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
</div>
</div>

{include file='banners/registration_spam_filter.tpl'}

<div class="form-group">
<label for="passwordInput" class="col-sm-2 control-label">{t}Password{/t}</label>
<div class="col-sm-8">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Display agresive spam filter rule warning banner
const email = document.getElementById("emailInput");
const banner = document.getElementById("banner-registration-spam-filter");
const strictDomains = ["o2.pl", "wp.pl"];

email.addEventListener("input", () => {
const matches = email.value.match(/.+@(.+)/);
if (matches) {
const domain = matches.pop();
if (strictDomains.indexOf(domain) > -1) {
banner.style.display = "block";
return;
}
}
banner.style.display = "none";
});
1 change: 1 addition & 0 deletions website/app-templates/smarty/pages/registration.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

{block name=javascript}
{include 'js/registration/registration.validation.tpl.js'}
{include 'js/registration/registration.events.tpl.js'}
{include 'js/dialogs/dialog_terms_of_use.tpl.js'}
{include 'js/registration/username2.tpl.js'}
{/block}

0 comments on commit 10cb5ff

Please sign in to comment.