public ResultSet CheckLogin(String username, String password) throws Exception{
        cx = connection();
        ResultSet rs = null;
        // get the list of emails that match the email and password entered.  Should only be one, or zero if the wrong combo is entered
        String query = "SELECT id as personid, email FROM person where email=? and password=sha2(CONCAT(?,firstname,lastname),256)";
        PreparedStatement st = cx.prepareStatement(query);
        st.setString(1, username);
        st.setString(2, password);
        rs = st.executeQuery();
        
        if (!rs.next()) {
            // no records with this user and password combo
            throw new Exception("invalid login");
        }
        else if (username.equalsIgnoreCase(rs.getString("email"))) {
            // good login
            rs.beforeFirst();// reset resultset
            return rs;
        }
        else {
            // probably shouldn't get here
            throw new Exception("invalid login");
        }
              
    }