String username = req.getParameter("username");
String password = req.getParameter("password");
//logger
System.out.println("adding " + username + ":" + password);
AppUser newUser = new AppUser();
UserContact userContact = new UserContact();
if(username != null && password != null && !username.equals("") &&
!password.equals(""))
{
if(userManagment.isUserExist(username))
{
req.setAttribute("message", "That user exist already in out db");
} else
{
userContact.setFirstName(req.getParameter("firstname"));
userContact.setEmail(req.getParameter("email"));
userContact.setPhoneNumber(req.getParameter("phonenumber"));
userContact.setSecondName(req.getParameter("secondname"));
newUser.setLogin(username);
newUser.setPassword(password);
newUser.setStatus(req.getParameter("status"));
newUser.setContact(userContact);
userManagment.addUser(newUser);
req.setAttribute("message", "User was added, thank you for cooperation!");
}
}
else