Merge branch '16-no-validation-on-login-route-causes-nullpointer' into 'dev'

Resolve "No validation on login route causes NullPointer"

Closes #16

See merge request sa4-2020/the-sanmarinoes/backend!21
This commit is contained in:
Claudio Maggioni 2020-03-04 13:35:38 +01:00
commit b6add2aaf6

View file

@ -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 =