/** * Calls either {@link #preparePassword(String)} or * {@link #prepareSaltedPassword(Long, String)} and passes the resulting * value to {@link SqlAction#setUserPassword(Long, String)}. * An {@link InternalException} is thrown if the modification is not * successful, which should only occur if the user has been deleted. * @param id the user ID * @param password the password * @param meth how to encode the password */ public void changeUserPasswordById(Long id, String password, METHOD meth) { String prepared = password; if (meth.hash){ prepared = preparePassword(id, password, meth.salt); } if (! sql.setUserPassword(id, prepared)) { throw new InternalException("0 results for password insert."); } sql.clearPermissionsBit("experimenter", id, 16); }