szerhusenBC/jwt-spring-security-demo

Save new user

ricardogusi opened this issue · 0 comments

Hi, first of all thank you so much for this application.
Sorry about the "silly" question but how do I register a new user?
I've created this:
@PostMapping("/register")
public ResponseEntity saveUser(@RequestBody User user) {
return ResponseEntity.ok(repository.save(user));

}

and on postaman for example tried this:

{
"username": "ricardo",
"password": "123456",
"firstname": "Ricardo",
"lastname": "Gusi",
"email": "ricardo@email",
"activated" : "1"
}

but I get this:

"message": "Validation failed for classes [org.zerhusen.security.model.User] during persist time for groups [javax.validation.groups.Default, ]\nList of constraint violations:[\n\tConstraintViolationImpl{interpolatedMessage='não pode ser nulo', propertyPath=password, rootBeanClass=class org.zerhusen.security.model.User, messageTemplate='{javax.validation.constraints.NotNull.message}'}\n]",