mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-25 19:55:39 +01:00
Fix #1079
This commit is contained in:
parent
12566f03ef
commit
f46dd9445c
@ -80,7 +80,7 @@ public class ValidationService implements Reloadable {
|
|||||||
* @return true if the email is valid, false otherwise
|
* @return true if the email is valid, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean validateEmail(String email) {
|
public boolean validateEmail(String email) {
|
||||||
if (!email.contains("@") || "your@email.com".equalsIgnoreCase(email)) {
|
if (!email.contains("@") || email.endsWith("@") || "your@email.com".equalsIgnoreCase(email)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final String emailDomain = email.split("@")[1];
|
final String emailDomain = email.split("@")[1];
|
||||||
|
@ -187,6 +187,12 @@ public class ValidationServiceTest {
|
|||||||
assertThat(validationService.validateEmail("invalidinput"), equalTo(false));
|
assertThat(validationService.validateEmail("invalidinput"), equalTo(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void shouldRejectInvalidEmailWithoutDomain() {
|
||||||
|
// given/when/then
|
||||||
|
assertThat(validationService.validateEmail("invalidinput@"), equalTo(false));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldRejectDefaultEmail() {
|
public void shouldRejectDefaultEmail() {
|
||||||
// given/when/then
|
// given/when/then
|
||||||
|
Loading…
Reference in New Issue
Block a user