@Override public void registerUser(User user, String unencryptedPassword) { user.setPassword(createHash(unencryptedPassword)); try { user.setId(userManager.addUser(user)); } catch (Exception e) { throw new ManagerDataAccessException("Error while registering user", e); } }
@Override public void changePassword(User user, String password, String newUnencryptedPassword) { if (authenticate(user, password)) { user.setPassword(createHash(newUnencryptedPassword)); try { userManager.updateUser(user); } catch (Exception e) { throw new ManagerDataAccessException("Error while rtrieving users", e); } } }