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

✨[Frontend] Denylist for (lite) registration emails #6385

Merged
merged 15 commits into from
Sep 18, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,23 @@ qx.Class.define("osparc.auth.core.Utils", {
return isValid;
},

denylistEmailValidator: function(denylist) {
odeimaiz marked this conversation as resolved.
Show resolved Hide resolved
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.<br>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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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$"
]
}
Loading