@Override public User changeUsername_save(User user) { User user0 = userDAO.getUserById(user.getId()); user0.setUsername(user.getUsername()); userDAO.editUser(user0); return user0; }
public Employee changeUserPassword_save(int id, String userPassword) { User user = userDAO.getUserById(id); Employee employee = userDAO.getEmployeeById(user.getEmployee().getId()); Encrypt te = new Encrypt(); user.setPassword(te.StringEncrypt(userPassword, "MD5")); userDAO.editUser(user); return userDAO.getEmployeeById(employee.getId()); }
public User CheckLogin(User user) { User u = userDAO.validateUser(user.getUsername(), user.getPassword()); if (u != null) { Timestamp t = new Timestamp(new GregorianCalendar(TimeZone.getTimeZone("GMT")).getTimeInMillis()); u.setLastLoginTime(t); userDAO.editUser(u); } return u; }