public static int Change_SecondPassword(final int accid, final String password, final String newpassword) {
        Connection con = DatabaseConnection.getConnection();
        try {
            PreparedStatement ps = con.prepareStatement("SELECT * from accounts where id = ?");
            ps.setInt(1, accid);
            try (ResultSet rs = ps.executeQuery()) {
                if (!rs.next()) {
                    rs.close();
                    ps.close();
                    return -1;
                }
                String secondPassword = rs.getString("2ndpassword");
                final String salt2 = rs.getString("salt2");
                if (secondPassword != null && salt2 != null) {
                    secondPassword = LoginCrypto.rand_r(secondPassword);
                } else if (secondPassword == null && salt2 == null) {
                    rs.close();
                    ps.close();
                    return 0;
                }
                if (!check_ifPasswordEquals(secondPassword, password, salt2)) {
                    rs.close();
                    ps.close();
                    return 1;
                }
            }
            ps.close();

            String SHA1hashedsecond;
            try {
                SHA1hashedsecond = LoginCryptoLegacy.encodeSHA1(newpassword);
            } catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
                return -2;
            }
            ps = con.prepareStatement("UPDATE accounts set 2ndpassword = ?, salt2 = ? where id = ?");
            ps.setString(1, SHA1hashedsecond);
            ps.setString(2, null);
            ps.setInt(3, accid);

            if (!ps.execute()) {
                ps.close();
                return 2;
            }
            ps.close();
            return -2;
        } catch (SQLException e) {
            System.err.println("error 'getIdByName' " + e);
            return -2;
        }
    }