source: phonelux-backend/src/main/java/finki/it/phoneluxbackend/security/email/EmailValidator.java

Last change on this file was dfd5d87, checked in by Marko <Marko@…>, 2 years ago

Registration logic with confirmation token implemented

  • Property mode set to 100644
File size: 436 bytes
Line 
1package finki.it.phoneluxbackend.security.email;
2
3import org.springframework.stereotype.Service;
4
5import java.util.function.Predicate;
6import java.util.regex.Pattern;
7
8@Service
9public class EmailValidator implements Predicate<String> {
10
11 @Override
12 public boolean test(String s) {
13 // regex to validate email
14 return Pattern.compile("^[a-zA-Z0-9_!#$%&'*+/=?`{|}~^.-]+@[a-zA-Z0-9.-]+$").matcher(s).matches();
15 }
16}
Note: See TracBrowser for help on using the repository browser.