"user": {
"firstName": "Musa",
"lastName": "Aliyev",
"email": "[email protected]",
"passwordIn": "98989898", (or encoded version in front if we not using https)
"country": "Azeribaijan",
"phone": "+994707702747"
}
@CrossOrigin(methods = RequestMethod.POST)
@RequestMapping("/public/register")
public @ResponseBody MsgKit registerNewUsert(@RequestBody User u) {
root.registerUser(u);
return new MsgKit("registered");
}
@Service
@Transactional
public class RootBsn {
@Autowired UserRepository userRepo;
public void registerUser(User u) throws Exception {
u.setPassword(u.getPasswordIn());
// Generate some salt and setPassword (encoded - salt + password)
User u = userRepo.save(u);
System.out.println("Registration information saved");
}
}
@Entity
@JsonIgnoreProperties({"recordDate", "modificationDate", "status", "createdBy", "modifiedBy", "salt", "password"})
public class User implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Long id;
private String country;
@Column(name = "CREATED_BY")
private String createdBy;
private String email;
@Column(name = "FIRST_NAME")
private String firstName;
@Column(name = "LAST_LOGIN_DATE")
private Timestamp lastLoginDate;
@Column(name = "LAST_NAME")
private String lastName;
@Column(name = "MODIFICATION_DATE")
private Timestamp modificationDate;
@Column(name = "MODIFIED_BY")
private String modifiedBy;
private String password;
@Transient
private String passwordIn;
private String phone;
@Column(name = "RECORD_DATE")
private Timestamp recordDate;
private String salt;
private String status;
@Column(name = "USER_STATUS")
private String userStatus;
public User() {
}
// getters and setters
}