Skip to content

Commit

Permalink
1532 Do not allow words that are digits
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaszsmy committed Jul 21, 2022
1 parent e744533 commit fcd512d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public String handleSubmit(
Model model) {
logger.info("handleSubmit");

validWord(word, result);
validateWord(word, result);

if (result.hasErrors()) {
model.addAttribute("word", word);
Expand Down Expand Up @@ -266,7 +266,7 @@ private void autoSelectLetterSoundCorrespondences(Word word) {
word.setLetterSoundCorrespondences(letterSoundCorrespondences);
}

private void validWord(Word word, BindingResult result) {
private void validateWord(Word word, BindingResult result) {
Word existingWord = wordDao.readByText(word.getText());

if (existingWord != null) {
Expand All @@ -278,7 +278,7 @@ private void validWord(Word word, BindingResult result) {
}

if (word.getText().matches(".*[0-9].*")) {
result.rejectValue("text", "WordContainsNumber");
result.rejectValue("text", "WordNumbers");
}
}
}
2 changes: 1 addition & 1 deletion src/main/webapp/WEB-INF/i18n/errors_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ formatHint.Integer=Number (e.g. "5000")
image.too.small=The image width must be at least 640px
emoji.unicode.version=Only emojis up to Unicode version 9
WordSpace=Spaces are not allowed
WordContainsNumber=Word contain number
WordNumbers=A word cannot consist of numbers

0 comments on commit fcd512d

Please sign in to comment.