Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ramory-l/Matcha
Browse files Browse the repository at this point in the history
  • Loading branch information
ramory-l committed Jan 6, 2021
2 parents 9599402 + aba61cb commit 283ae56
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ public class UserController {
Integer ageTo = nonNull(request.queryParams("ageto")) ? parseInt(request.queryParams("ageto")) : null;
Integer rateTo = nonNull(request.queryParams("rateto")) ? parseInt(request.queryParams("rateto")) : null;
Integer rateFrom = nonNull(request.queryParams("ratefrom")) ? parseInt(request.queryParams("ratefrom")) : null;
if (ageFrom < 0 || ageTo < 0) {
throw new NumberFormatException();
}
FormDto formDto = new FormDto(
null,
Boolean.parseBoolean(request.queryParams("man")),
Expand Down Expand Up @@ -134,7 +137,7 @@ public class UserController {
String hash = request.params("hash");
userService.updatePassword(hash);
response.status(Response.GET.getStatus());
return "";
return "Password edited";
};

public static Route getMatcha = (request, response) -> {
Expand Down Expand Up @@ -194,7 +197,7 @@ public class UserController {
String hash = request.params("hash");
userService.verified(hash);
response.status(Response.GET.getStatus());
return "";
return "Profile verified";
};

public static Route addToBlackList = (request, response) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,15 @@ public List<User> getMatcha(Long id) {
public Long createUser(User user) {
checkAllDataForNewUser(user);
String username = user.getUsername();
String email = user.getEmail();
try {
getUserByUsername(username);
throw new MatchaException("User with username already exist");
} catch (NotFoundException ignored) {}
try {
getUserByEmail(email);
throw new MatchaException("User with email already exist");
} catch (NotFoundException ignored) {}
try {
try {
user.setPassword(PasswordCipher.generateStrongPasswordHash(user.getPassword()));
Expand Down

0 comments on commit 283ae56

Please sign in to comment.