From d209586933422adff206fec1e688b61129b54a45 Mon Sep 17 00:00:00 2001 From: Claudio Maggioni Date: Wed, 4 Mar 2020 13:28:51 +0100 Subject: [PATCH] Fixed login request validation --- .../smarthut/controller/AuthenticationController.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/controller/AuthenticationController.java b/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/controller/AuthenticationController.java index 19e4f6f..dd23fba 100644 --- a/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/controller/AuthenticationController.java +++ b/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/controller/AuthenticationController.java @@ -43,7 +43,8 @@ public class AuthenticationController { } @PostMapping("/login") - public JWTResponse login(@RequestBody JWTRequest authenticationRequest) throws Exception { + public JWTResponse login(@Valid @RequestBody JWTRequest authenticationRequest) + throws Exception { if (authenticationRequest.getUsernameOrEmail().contains("@")) { // usernameOrEmail contains an email, so fetch the corresponding username final User user =