Skip to content

Commit a38cf37

Browse files
committed
feat: add 9business to free email provider + use local free email domain list in 2 services
1 parent 3665a8c commit a38cf37

File tree

8 files changed

+9
-6
lines changed

8 files changed

+9
-6
lines changed
File renamed without changes.

src/services/did-you-mean/most-used-free-email-domains.ts renamed to src/data/most-used-free-email-domains.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// arbitrary selection of free email provider domains used in municipalities
1+
// arbitrary selection of free email provider domains used by our users
22
export default [
33
"gmail.com",
44
"orange.fr",
@@ -12,5 +12,6 @@ export default [
1212
"yahoo.com",
1313
"live.fr",
1414
"sfr.fr",
15+
"9business.fr",
1516
"laposte.fr",
1617
];
File renamed without changes.

src/services/did-you-mean.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { run as spellCheckEmail } from "@zootools/email-spell-checker";
2-
import gouvfrDomains from "./did-you-mean/gouvfr-domains";
3-
import mostUsedFreeEmailDomains from "./did-you-mean/most-used-free-email-domains";
4-
import otherGouvDomains from "./did-you-mean/other-gouv-domains";
2+
import gouvfrDomains from "../data/gouvfr-domains";
3+
import mostUsedFreeEmailDomains from "../data/most-used-free-email-domains";
4+
import otherGouvDomains from "../data/other-gouv-domains";
55

66
// Display an email suggestion for most used public domains
77
export const getDidYouMeanSuggestion = (email: string): string => {

src/services/email.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
FEATURE_CONSIDER_ALL_EMAIL_DOMAINS_AS_FREE,
66
FEATURE_CONSIDER_ALL_EMAIL_DOMAINS_AS_NON_FREE,
77
} from "../config/env";
8+
import mostUsedFreeEmailDomains from "../data/most-used-free-email-domains";
89

910
export const isAFreeEmailProvider = (domain: string) => {
1011
if (FEATURE_CONSIDER_ALL_EMAIL_DOMAINS_AS_FREE) {
@@ -15,7 +16,7 @@ export const isAFreeEmailProvider = (domain: string) => {
1516
return false;
1617
}
1718

18-
return isFree(domain);
19+
return isFree(domain) || mostUsedFreeEmailDomains.includes(domain);
1920
};
2021

2122
export const getEmailDomain = (email: string) => {

src/services/security.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import { customAlphabet, nanoid } from "nanoid/async";
44
import { parse_host } from "tld-extract";
55
import { MONCOMPTEPRO_HOST } from "../config/env";
66
import notificationMessages from "../config/notification-messages";
7+
import dicewareWordlistFrAlt from "../data/diceware-wordlist-fr-alt";
78
import type { AmrValue } from "../types/express-session";
89
import { owaspPasswordStrengthTest } from "./owasp-password-strength-tester";
9-
import dicewareWordlistFrAlt from "./security/diceware-wordlist-fr-alt";
1010

1111
// TODO compare to https://github.com/anandundavia/manage-users/blob/master/src/api/utils/security.js
1212
export const hashPassword = async (plainPassword: string): Promise<string> => {

test/email.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ describe("usesAFreeEmailProvider", () => {
2929
"user@gmail.com",
3030
"collectivite@wanadoo.fr",
3131
"collectivite@orange.fr",
32+
"serious@9business.fr",
3233
];
3334

3435
emailAddressesThatUsesFreeEmailProviders.forEach((email) => {

0 commit comments

Comments
 (0)