Skip to content
Snippets Groups Projects
Commit ebf52e17 authored by Felix Schäfer's avatar Felix Schäfer :construction_worker:
Browse files

Revert "Refactor to build suffixes list at init time" #1

This reverts commit 5521d789.
parent 5521d789
No related branches found
No related tags found
No related merge requests found
...@@ -33,21 +33,62 @@ public class SignupFormAction implements FormAction, FormActionFactory { ...@@ -33,21 +33,62 @@ public class SignupFormAction implements FormAction, FormActionFactory {
private static Requirement[] REQUIREMENT_CHOICES = { Requirement.REQUIRED, Requirement.DISABLED }; private static Requirement[] REQUIREMENT_CHOICES = { Requirement.REQUIRED, Requirement.DISABLED };
private static String[] unimailDomains = { private static String[] unimailDomains = {
"rwth-aachen.de", "fsmpi.eu", // exact domains
"uni-bremen.de", "tzi.de", "tzi.org", "stugen.de", "fbmi.de", "@rwth-aachen.de",
"d120.de", "tu-darmstadt.de", "@fsmpi.eu",
"tu-dortmund.de", "uni-dortmund.de", "udo.edu", "oh14.de", "fachschaften.org", "@uni-bremen.de",
"ifsr.de", "@tzi.de",
"uni-due.de", "@tzi.org",
"thm.de", "th-mittelhessen.de", "fh-giessen-friedberg.de", "fh-giessen.de", "@stugen.de",
"thm.de", "th-mittelhessen.de", "fh-giessen-friedberg.de", "fh-friedberg.de", "@fbmi.de",
"thm.de", "th-mittelhessen.de", "fh-giessen-friedberg.de", "fh-friedberg.de", "@d120.de",
"hs-karlsruhe.de", "@tu-darmstadt.de",
"lmu.de", "uni-muenchen.de", "@tu-dortmund.de",
"uni-paderborn.de", "upb.de", "@uni-dortmund.de",
}; "@udo.edu",
"@oh14.de",
"@fachschaften.org",
"@ifsr.de",
"@uni-due.de",
"@thm.de",
"@th-mittelhessen.de",
"@fh-giessen-friedberg.de",
"@fh-giessen.de",
"@fh-friedberg.de",
"@hs-karlsruhe.de",
"@lmu.de",
"@uni-muenchen.de",
"@uni-paderborn.de",
"@upb.de",
// subdomains
".rwth-aachen.de",
".fsmpi.eu",
".uni-bremen.de",
".tzi.de",
".tzi.org",
".stugen.de",
".fbmi.de",
".d120.de",
".tu-darmstadt.de",
".tu-dortmund.de",
".uni-dortmund.de",
".udo.edu",
".oh14.de",
".fachschaften.org",
".ifsr.de",
".uni-due.de",
".thm.de",
".th-mittelhessen.de",
".fh-giessen-friedberg.de",
".fh-giessen.de",
".fh-friedberg.de",
".hs-karlsruhe.de",
".lmu.de",
".uni-muenchen.de",
".uni-paderborn.de",
".upb.de",
private String[] unimailDomainsSuffixes; };
@Override @Override
public void close() { public void close() {
...@@ -65,12 +106,6 @@ public class SignupFormAction implements FormAction, FormActionFactory { ...@@ -65,12 +106,6 @@ public class SignupFormAction implements FormAction, FormActionFactory {
@Override @Override
public void init(Scope arg0) { public void init(Scope arg0) {
unimailDomainsSuffixes = Stream.concat(
// suffixes for subdomains
Arrays.stream(unimailDomains).distinct().map(d -> "." + d),
// suffixes for exact domains
Arrays.stream(unimailDomains).distinct().map(d -> "@" + d)
).toArray(String[]::new);
} }
@Override @Override
...@@ -143,9 +178,9 @@ public class SignupFormAction implements FormAction, FormActionFactory { ...@@ -143,9 +178,9 @@ public class SignupFormAction implements FormAction, FormActionFactory {
String email = formData.getFirst(Validation.FIELD_EMAIL); String email = formData.getFirst(Validation.FIELD_EMAIL);
Stream<String> unimailDomainsSuffixesStream = Arrays.stream(unimailDomainsSuffixes); Stream<String> unimailDomainsStream = Arrays.stream(unimailDomains);
if (!unimailDomainsSuffixesStream.anyMatch( f -> email.endsWith(f) )) { if (!unimailDomainsStream.anyMatch( f -> email.endsWith(f) )) {
errors.add(new FormMessage(Validation.FIELD_EMAIL, "notInUnimailDomainsMessage")); errors.add(new FormMessage(Validation.FIELD_EMAIL, "notInUnimailDomainsMessage"));
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment