diff --git a/services/static-webserver/client/source/class/osparc/auth/core/Utils.js b/services/static-webserver/client/source/class/osparc/auth/core/Utils.js index 505d8bbdbf8..da013ab969f 100644 --- a/services/static-webserver/client/source/class/osparc/auth/core/Utils.js +++ b/services/static-webserver/client/source/class/osparc/auth/core/Utils.js @@ -51,6 +51,23 @@ qx.Class.define("osparc.auth.core.Utils", { return isValid; }, + denylistEmailValidator: function(denylist) { + return emailValue => { + let errorMessage = ""; + qx.util.Validate.checkEmail(emailValue, null, errorMessage); + // if the email check goes through, check it now against the denylist + if (denylist) { + denylist.forEach(reg => { + const re = new RegExp(reg); + if (re.test(emailValue)) { + errorMessage = qx.locale.Manager.tr("Invalid email address.
Please register using your university email address"); + throw new qx.core.ValidationError("Validation Error", errorMessage); + } + }) + } + }; + }, + /** Finds parameters in the fragment * * Expected fragment format as https://osparc.io#page=reset-password;code=123546 diff --git a/services/static-webserver/client/source/class/osparc/auth/ui/RequestAccount.js b/services/static-webserver/client/source/class/osparc/auth/ui/RequestAccount.js index ab9533d2311..22035158f76 100644 --- a/services/static-webserver/client/source/class/osparc/auth/ui/RequestAccount.js +++ b/services/static-webserver/client/source/class/osparc/auth/ui/RequestAccount.js @@ -15,16 +15,13 @@ ************************************************************************ */ +/** + * @asset(osparc/denylist.json") + */ + qx.Class.define("osparc.auth.ui.RequestAccount", { extend: osparc.auth.core.BaseAuthPage, - - /* - ***************************************************************************** - MEMBERS - ***************************************************************************** - */ - members: { __captchaField: null, __requestButton: null, @@ -57,15 +54,26 @@ qx.Class.define("osparc.auth.ui.RequestAccount", { required: true }); switch (osparc.product.Utils.getProductName()) { - case "s4l": - case "tis": - case "osparc": - this._form.add(email, this.tr("Email"), qx.util.Validate.email(), "email"); - break; - case "tiplite": case "s4lacad": case "s4ldesktopacad": - this._form.add(email, this.tr("University Email"), qx.util.Validate.email(), "email"); + case "tiplite": { + this._form.add(email, this.tr("University Email"), null, "email"); + let validator = qx.util.Validate.email(); + osparc.utils.Utils.fetchJSON("/resource/osparc/denylist.json") + .then(denylistData => { + if ("lite" in denylistData) { + const denylist = denylistData["lite"]; + validator = osparc.auth.core.Utils.denylistEmailValidator(denylist); + } + }) + .catch(console.error) + .finally(() => { + this._form.getValidationManager().add(email, validator); + }); + break; + } + default: + this._form.add(email, this.tr("Email"), qx.util.Validate.email(), "email"); break; } diff --git a/services/static-webserver/client/source/class/osparc/navigation/NavigationBar.js b/services/static-webserver/client/source/class/osparc/navigation/NavigationBar.js index 93f9af91ce9..4353cd497f0 100644 --- a/services/static-webserver/client/source/class/osparc/navigation/NavigationBar.js +++ b/services/static-webserver/client/source/class/osparc/navigation/NavigationBar.js @@ -236,6 +236,7 @@ qx.Class.define("osparc.navigation.NavigationBar", { marginRight: 30, ...this.self().BUTTON_OPTIONS, }); + osparc.utils.Utils.setIdToWidget(control, "accessTIPBtn"); control.addListener("execute", () => osparc.product.TIPTeaser.getInstance().open()); this.getChildControl("right-items").add(control); break; diff --git a/services/static-webserver/client/source/resource/osparc/denylist.json b/services/static-webserver/client/source/resource/osparc/denylist.json new file mode 100644 index 00000000000..320ad0890b8 --- /dev/null +++ b/services/static-webserver/client/source/resource/osparc/denylist.json @@ -0,0 +1,181 @@ +{ + "lite": [ + "@*\\.ir$", + "@imanova\\.co\\.uk$", + "@centrum\\.sk$", + "@centrum\\.cz$", + "@*\\.medical\\.canon$", + "@gmail.com$", + "@yahoo.com$", + "@hotmail.com$", + "@hotmail\\.*$", + "@aol.com$", + "@hotmail.co.uk$", + "@hotmail.fr$", + "@msn.com$", + "@yahoo.fr$", + "@wanadoo.fr$", + "@orange.fr$", + "@comcast.net$", + "@yahoo.co.uk$", + "@yahoo.com.br$", + "@yahoo.co.in$", + "@live.com$", + "@rediffmail.com$", + "@free.fr$", + "@gmx.de$", + "@web.de$", + "@yandex.ru$", + "@ymail.com$", + "@libero.it$", + "@outlook.com$", + "@uol.com.br$", + "@bol.com.br$", + "@mail.ru$", + "@cox.net$", + "@hotmail.it$", + "@sbcglobal.net$", + "@sfr.fr$", + "@live.fr$", + "@verizon.net$", + "@live.co.uk$", + "@googlemail.com$", + "@yahoo.es$", + "@ig.com.br$", + "@live.nl$", + "@bigpond.com$", + "@terra.com.br$", + "@yahoo.it$", + "@neuf.fr$", + "@yahoo.de$", + "@alice.it$", + "@rocketmail.com$", + "@att.net$", + "@laposte.net$", + "@facebook.com$", + "@bellsouth.net$", + "@yahoo.in$", + "@hotmail.es$", + "@charter.net$", + "@yahoo.ca$", + "@yahoo.com.au$", + "@rambler.ru$", + "@hotmail.de$", + "@tiscali.it$", + "@shaw.ca$", + "@yahoo.co.jp$", + "@sky.com$", + "@earthlink.net$", + "@optonline.net$", + "@freenet.de$", + "@t-online.de$", + "@aliceadsl.fr$", + "@virgilio.it$", + "@home.nl$", + "@qq.com$", + "@telenet.be$", + "@me.com$", + "@yahoo.com.ar$", + "@tiscali.co.uk$", + "@yahoo.com.mx$", + "@voila.fr$", + "@gmx.net$", + "@mail.com$", + "@planet.nl$", + "@tin.it$", + "@live.it$", + "@ntlworld.com$", + "@arcor.de$", + "@yahoo.co.id$", + "@frontiernet.net$", + "@hetnet.nl$", + "@live.com.au$", + "@yahoo.com.sg$", + "@zonnet.nl$", + "@club-internet.fr$", + "@juno.com$", + "@optusnet.com.au$", + "@blueyonder.co.uk$", + "@bluewin.ch$", + "@skynet.be$", + "@sympatico.ca$", + "@windstream.net$", + "@mac.com$", + "@centurytel.net$", + "@chello.nl$", + "@live.ca$", + "@aim.com$", + "@bigpond.net.au$", + "@gmail.comgmx.com$", + "@google.com$", + "@email.com$", + "@fastmail.fm$", + "@games.com$", + "@hush.com$", + "@hushmail.com$", + "@icloud.com$", + "@iname.com$", + "@inbox.com$", + "@lavabit.com$", + "@love.com$", + "@pobox.com$", + "@protonmail.com$", + "@safe-mail.net$", + "@wow.com$", + "@ygm.com$", + "@zoho.com$", + "@yandex.com$", + "@btinternet.com$", + "@virginmedia.com$", + "@freeserve.co.uk$", + "@o2.co.uk$", + "@orange.net$", + "@talktalk.co.uk$", + "@virgin.net$", + "@wanadoo.co.uk$", + "@bt.com$", + "@sina.com$", + "@sina.cn$", + "@naver.com$", + "@hanmail.net$", + "@daum.net$", + "@nate.com$", + "@yahoo.co.kr$", + "@yahoo.com.ph$", + "@163.com$", + "@126.com$", + "@aliyun.com$", + "@foxmail.com$", + "@gmx.frsfr.fr$", + "@live.de$", + "@online.de$", + "@web.deyahoo.de$", + "@aol.it$", + "@email.it$", + "@poste.it$", + "@teletu.it$", + "@ya.ru$", + "@list.ru$", + "@hotmail.be$", + "@live.be$", + "@voo.be$", + "@tvcablenet.be$", + "@hotmail.com.ar$", + "@live.com.ar$", + "@live.cn$", + "@fibertel.com.ar$", + "@speedy.com.ar$", + "@arnet.com.ar$", + "@live.com.mx$", + "@hotmail.com.mx$", + "@prodigy.net.mx$", + "@hotmail.com.br$", + "@outlook.com.br$", + "@itelefonica.com.br$", + "@r7.com$", + "@zipmail.com.br$", + "@globo.com$", + "@globomail.com$", + "@oi.com.br$" + ] +}