diff options
Diffstat (limited to 'client/trunk/src')
5 files changed, 98 insertions, 121 deletions
| diff --git a/client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.form b/client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.form index 666f518..ce8ae5c 100644 --- a/client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.form +++ b/client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.form | |||
| @@ -33,26 +33,25 @@ | |||
| 33 | <Group type="103" groupAlignment="0" attributes="0"> | 33 | <Group type="103" groupAlignment="0" attributes="0"> |
| 34 | <Component id="jLabel2" min="-2" max="-2" attributes="0"/> | 34 | <Component id="jLabel2" min="-2" max="-2" attributes="0"/> |
| 35 | <Component id="jLabel3" min="-2" max="-2" attributes="0"/> | 35 | <Component id="jLabel3" min="-2" max="-2" attributes="0"/> |
| 36 | <Component id="jLabel4" min="-2" max="-2" attributes="0"/> | ||
| 37 | </Group> | 36 | </Group> |
| 38 | <EmptySpace max="-2" attributes="0"/> | 37 | <EmptySpace min="-2" pref="66" max="-2" attributes="0"/> |
| 39 | <Group type="103" groupAlignment="0" attributes="0"> | 38 | <Group type="103" groupAlignment="0" attributes="0"> |
| 40 | <Component id="jTextField1" alignment="0" pref="222" max="32767" attributes="0"/> | 39 | <Component id="jTextField1" alignment="0" pref="222" max="32767" attributes="0"/> |
| 41 | <Component id="jTextField3" alignment="0" pref="222" max="32767" attributes="0"/> | ||
| 42 | <Component id="jPasswordField1" alignment="0" pref="222" max="32767" attributes="0"/> | 40 | <Component id="jPasswordField1" alignment="0" pref="222" max="32767" attributes="0"/> |
| 43 | </Group> | 41 | </Group> |
| 44 | </Group> | 42 | </Group> |
| 45 | <Group type="102" alignment="1" attributes="0"> | ||
| 46 | <Component id="jLabel5" pref="317" max="32767" attributes="0"/> | ||
| 47 | <EmptySpace max="-2" attributes="0"/> | ||
| 48 | <Component id="jButton1" min="-2" max="-2" attributes="0"/> | ||
| 49 | </Group> | ||
| 50 | </Group> | 43 | </Group> |
| 51 | </Group> | 44 | </Group> |
| 52 | <Group type="102" alignment="0" attributes="0"> | 45 | <Group type="102" alignment="0" attributes="0"> |
| 53 | <EmptySpace min="-2" pref="24" max="-2" attributes="0"/> | 46 | <EmptySpace min="-2" pref="24" max="-2" attributes="0"/> |
| 54 | <Component id="jLabel6" min="-2" pref="359" max="-2" attributes="0"/> | 47 | <Component id="jLabel6" min="-2" pref="359" max="-2" attributes="0"/> |
| 55 | </Group> | 48 | </Group> |
| 49 | <Group type="102" alignment="1" attributes="0"> | ||
| 50 | <EmptySpace max="-2" attributes="0"/> | ||
| 51 | <Component id="jLabel5" pref="317" max="32767" attributes="0"/> | ||
| 52 | <EmptySpace max="-2" attributes="0"/> | ||
| 53 | <Component id="jButton1" min="-2" max="-2" attributes="0"/> | ||
| 54 | </Group> | ||
| 56 | </Group> | 55 | </Group> |
| 57 | <EmptySpace max="-2" attributes="0"/> | 56 | <EmptySpace max="-2" attributes="0"/> |
| 58 | </Group> | 57 | </Group> |
| @@ -75,16 +74,12 @@ | |||
| 75 | <Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/> | 74 | <Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/> |
| 76 | <Component id="jPasswordField1" alignment="3" min="-2" max="-2" attributes="0"/> | 75 | <Component id="jPasswordField1" alignment="3" min="-2" max="-2" attributes="0"/> |
| 77 | </Group> | 76 | </Group> |
| 78 | <EmptySpace min="-2" max="-2" attributes="0"/> | 77 | <EmptySpace max="-2" attributes="0"/> |
| 79 | <Group type="103" groupAlignment="3" attributes="0"> | ||
| 80 | <Component id="jTextField3" alignment="3" min="-2" max="-2" attributes="0"/> | ||
| 81 | <Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/> | ||
| 82 | </Group> | ||
| 83 | <EmptySpace min="-2" max="-2" attributes="0"/> | ||
| 84 | <Group type="103" groupAlignment="0" attributes="0"> | 78 | <Group type="103" groupAlignment="0" attributes="0"> |
| 85 | <Component id="jLabel5" min="-2" pref="40" max="-2" attributes="0"/> | ||
| 86 | <Component id="jButton1" min="-2" max="-2" attributes="0"/> | 79 | <Component id="jButton1" min="-2" max="-2" attributes="0"/> |
| 80 | <Component id="jLabel5" min="-2" pref="40" max="-2" attributes="0"/> | ||
| 87 | </Group> | 81 | </Group> |
| 82 | <EmptySpace min="-2" max="-2" attributes="0"/> | ||
| 88 | </Group> | 83 | </Group> |
| 89 | </Group> | 84 | </Group> |
| 90 | </DimensionLayout> | 85 | </DimensionLayout> |
| @@ -109,24 +104,12 @@ | |||
| 109 | <Property name="name" type="java.lang.String" value="jTextField1" noResource="true"/> | 104 | <Property name="name" type="java.lang.String" value="jTextField1" noResource="true"/> |
| 110 | </Properties> | 105 | </Properties> |
| 111 | </Component> | 106 | </Component> |
| 112 | <Component class="javax.swing.JTextField" name="jTextField3"> | ||
| 113 | <Properties> | ||
| 114 | <Property name="text" type="java.lang.String" resourceKey="jTextField3.text"/> | ||
| 115 | <Property name="name" type="java.lang.String" value="jTextField3" noResource="true"/> | ||
| 116 | </Properties> | ||
| 117 | </Component> | ||
| 118 | <Component class="javax.swing.JLabel" name="jLabel3"> | 107 | <Component class="javax.swing.JLabel" name="jLabel3"> |
| 119 | <Properties> | 108 | <Properties> |
| 120 | <Property name="text" type="java.lang.String" resourceKey="jLabel3.text"/> | 109 | <Property name="text" type="java.lang.String" resourceKey="jLabel3.text"/> |
| 121 | <Property name="name" type="java.lang.String" value="jLabel3" noResource="true"/> | 110 | <Property name="name" type="java.lang.String" value="jLabel3" noResource="true"/> |
| 122 | </Properties> | 111 | </Properties> |
| 123 | </Component> | 112 | </Component> |
| 124 | <Component class="javax.swing.JLabel" name="jLabel4"> | ||
| 125 | <Properties> | ||
| 126 | <Property name="text" type="java.lang.String" resourceKey="jLabel4.text"/> | ||
| 127 | <Property name="name" type="java.lang.String" value="jLabel4" noResource="true"/> | ||
| 128 | </Properties> | ||
| 129 | </Component> | ||
| 130 | <Component class="javax.swing.JLabel" name="jLabel5"> | 113 | <Component class="javax.swing.JLabel" name="jLabel5"> |
| 131 | <Properties> | 114 | <Properties> |
| 132 | <Property name="text" type="java.lang.String" resourceKey="jLabel5.text"/> | 115 | <Property name="text" type="java.lang.String" resourceKey="jLabel5.text"/> |
| diff --git a/client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.java b/client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.java index e327271..292dbb1 100644 --- a/client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.java +++ b/client/trunk/src/com/fourisland/instadisc/FirstRun/Step2.java | |||
| @@ -34,9 +34,7 @@ public class Step2 extends javax.swing.JDialog { | |||
| 34 | jLabel1 = new javax.swing.JLabel(); | 34 | jLabel1 = new javax.swing.JLabel(); |
| 35 | jLabel2 = new javax.swing.JLabel(); | 35 | jLabel2 = new javax.swing.JLabel(); |
| 36 | jTextField1 = new javax.swing.JTextField(); | 36 | jTextField1 = new javax.swing.JTextField(); |
| 37 | jTextField3 = new javax.swing.JTextField(); | ||
| 38 | jLabel3 = new javax.swing.JLabel(); | 37 | jLabel3 = new javax.swing.JLabel(); |
| 39 | jLabel4 = new javax.swing.JLabel(); | ||
| 40 | jLabel5 = new javax.swing.JLabel(); | 38 | jLabel5 = new javax.swing.JLabel(); |
| 41 | jButton1 = new javax.swing.JButton(); | 39 | jButton1 = new javax.swing.JButton(); |
| 42 | jLabel6 = new javax.swing.JLabel(); | 40 | jLabel6 = new javax.swing.JLabel(); |
| @@ -56,15 +54,9 @@ public class Step2 extends javax.swing.JDialog { | |||
| 56 | jTextField1.setText(resourceMap.getString("jTextField1.text")); // NOI18N | 54 | jTextField1.setText(resourceMap.getString("jTextField1.text")); // NOI18N |
| 57 | jTextField1.setName("jTextField1"); // NOI18N | 55 | jTextField1.setName("jTextField1"); // NOI18N |
| 58 | 56 | ||
| 59 | jTextField3.setText(resourceMap.getString("jTextField3.text")); // NOI18N | ||
| 60 | jTextField3.setName("jTextField3"); // NOI18N | ||
| 61 | |||
| 62 | jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N | 57 | jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N |
| 63 | jLabel3.setName("jLabel3"); // NOI18N | 58 | jLabel3.setName("jLabel3"); // NOI18N |
| 64 | 59 | ||
| 65 | jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N | ||
| 66 | jLabel4.setName("jLabel4"); // NOI18N | ||
| 67 | |||
| 68 | jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N | 60 | jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N |
| 69 | jLabel5.setName("jLabel5"); // NOI18N | 61 | jLabel5.setName("jLabel5"); // NOI18N |
| 70 | 62 | ||
| @@ -96,20 +88,19 @@ public class Step2 extends javax.swing.JDialog { | |||
| 96 | .addGap(12, 12, 12) | 88 | .addGap(12, 12, 12) |
| 97 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | 89 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
| 98 | .addComponent(jLabel2) | 90 | .addComponent(jLabel2) |
| 99 | .addComponent(jLabel3) | 91 | .addComponent(jLabel3)) |
| 100 | .addComponent(jLabel4)) | 92 | .addGap(66, 66, 66) |
| 101 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | ||
| 102 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | 93 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
| 103 | .addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 222, Short.MAX_VALUE) | 94 | .addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 222, Short.MAX_VALUE) |
| 104 | .addComponent(jTextField3, javax.swing.GroupLayout.DEFAULT_SIZE, 222, Short.MAX_VALUE) | 95 | .addComponent(jPasswordField1, javax.swing.GroupLayout.DEFAULT_SIZE, 222, Short.MAX_VALUE))))) |
| 105 | .addComponent(jPasswordField1, javax.swing.GroupLayout.DEFAULT_SIZE, 222, Short.MAX_VALUE))) | ||
| 106 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() | ||
| 107 | .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, 317, Short.MAX_VALUE) | ||
| 108 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | ||
| 109 | .addComponent(jButton1)))) | ||
| 110 | .addGroup(layout.createSequentialGroup() | 96 | .addGroup(layout.createSequentialGroup() |
| 111 | .addGap(24, 24, 24) | 97 | .addGap(24, 24, 24) |
| 112 | .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 359, javax.swing.GroupLayout.PREFERRED_SIZE))) | 98 | .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 359, javax.swing.GroupLayout.PREFERRED_SIZE)) |
| 99 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() | ||
| 100 | .addContainerGap() | ||
| 101 | .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, 317, Short.MAX_VALUE) | ||
| 102 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | ||
| 103 | .addComponent(jButton1))) | ||
| 113 | .addContainerGap()) | 104 | .addContainerGap()) |
| 114 | ); | 105 | ); |
| 115 | layout.setVerticalGroup( | 106 | layout.setVerticalGroup( |
| @@ -128,13 +119,10 @@ public class Step2 extends javax.swing.JDialog { | |||
| 128 | .addComponent(jLabel3) | 119 | .addComponent(jLabel3) |
| 129 | .addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) | 120 | .addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) |
| 130 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | 121 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
| 131 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | ||
| 132 | .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | ||
| 133 | .addComponent(jLabel4)) | ||
| 134 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | ||
| 135 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | 122 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
| 136 | .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) | 123 | .addComponent(jButton1) |
| 137 | .addComponent(jButton1))) | 124 | .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)) |
| 125 | .addContainerGap()) | ||
| 138 | ); | 126 | ); |
| 139 | 127 | ||
| 140 | pack(); | 128 | pack(); |
| @@ -146,41 +134,28 @@ public class Step2 extends javax.swing.JDialog { | |||
| 146 | if (jPasswordField1.getPassword().length == 0) { | 134 | if (jPasswordField1.getPassword().length == 0) { |
| 147 | jLabel5.setText("Error: You forgot to enter a password"); | 135 | jLabel5.setText("Error: You forgot to enter a password"); |
| 148 | } else { | 136 | } else { |
| 149 | if (jTextField3.getText().equals("")) { | 137 | MD5 md5 = new MD5(jPasswordField1.getPassword()); |
| 150 | jLabel5.setText("Error: You forgot to enter a Central Server URL"); | 138 | String password = md5.hash(); |
| 151 | } else { | 139 | |
| 152 | try { | 140 | XmlRpc xmlrpc = new XmlRpc("checkRegistration", jTextField1.getText(), password); |
| 153 | new URL(jTextField3.getText()); | 141 | Integer r = (Integer) xmlrpc.execute(); |
| 154 | 142 | ||
| 155 | MD5 md5 = new MD5(jPasswordField1.getPassword()); | 143 | if (r == 1) |
| 156 | String password = md5.hash(); | 144 | { |
| 157 | 145 | jLabel5.setText("Error: No registration exists on the specified Central Server with the specified UN/PW combination"); | |
| 158 | XmlRpc xmlrpc = new XmlRpc("checkRegistration", jTextField3.getText(), jTextField1.getText(), password); | 146 | } else { |
| 159 | Integer r = (Integer) xmlrpc.execute(); | 147 | Wrapper.setConfig("username", jTextField1.getText()); |
| 160 | 148 | Wrapper.setConfig("password", password); | |
| 161 | if (r == 1) | 149 | Wrapper.setConfig("itemBufferSize", "10"); |
| 162 | { | 150 | Wrapper.setConfig("verIDBufferSize", "10000"); |
| 163 | jLabel5.setText("Error: No registration exists on the specified Central Server with the specified UN/PW combination"); | 151 | Wrapper.setConfig("nextFilterID", "0"); |
| 164 | } else { | 152 | Wrapper.setConfig("ipCheckValue", "1"); |
| 165 | Wrapper.setConfig("username", jTextField1.getText()); | 153 | Wrapper.setConfig("ipCheckUnit", "day"); |
| 166 | Wrapper.setConfig("password", password); | 154 | Wrapper.setConfig("useUnreadFlag", "true"); |
| 167 | Wrapper.setConfig("centralServerURL", jTextField3.getText()); | 155 | Wrapper.setConfig("initCheck", "done"); |
| 168 | Wrapper.setConfig("itemBufferSize", "10"); | 156 | |
| 169 | Wrapper.setConfig("verIDBufferSize", "10000"); | 157 | StepEndResults.ok = true; |
| 170 | Wrapper.setConfig("nextFilterID", "0"); | 158 | this.setVisible(false); |
| 171 | Wrapper.setConfig("ipCheckValue", "1"); | ||
| 172 | Wrapper.setConfig("ipCheckUnit", "day"); | ||
| 173 | Wrapper.setConfig("useUnreadFlag", "true"); | ||
| 174 | Wrapper.setConfig("initCheck", "done"); | ||
| 175 | |||
| 176 | StepEndResults.ok = true; | ||
| 177 | this.setVisible(false); | ||
| 178 | } | ||
| 179 | } catch (MalformedURLException ex) { | ||
| 180 | jLabel5.setText("Error: The Central Server URL is malformed"); | ||
| 181 | } catch (NullPointerException ex) { | ||
| 182 | jLabel5.setText("Error: The Central Server URL specified does not exist"); | ||
| 183 | } | ||
| 184 | } | 159 | } |
| 185 | } | 160 | } |
| 186 | } | 161 | } |
| @@ -209,11 +184,9 @@ public class Step2 extends javax.swing.JDialog { | |||
| 209 | private javax.swing.JLabel jLabel1; | 184 | private javax.swing.JLabel jLabel1; |
| 210 | private javax.swing.JLabel jLabel2; | 185 | private javax.swing.JLabel jLabel2; |
| 211 | private javax.swing.JLabel jLabel3; | 186 | private javax.swing.JLabel jLabel3; |
| 212 | private javax.swing.JLabel jLabel4; | ||
| 213 | private javax.swing.JLabel jLabel5; | 187 | private javax.swing.JLabel jLabel5; |
| 214 | private javax.swing.JLabel jLabel6; | 188 | private javax.swing.JLabel jLabel6; |
| 215 | private javax.swing.JPasswordField jPasswordField1; | 189 | private javax.swing.JPasswordField jPasswordField1; |
| 216 | private javax.swing.JTextField jTextField1; | 190 | private javax.swing.JTextField jTextField1; |
| 217 | private javax.swing.JTextField jTextField3; | ||
| 218 | // End of variables declaration//GEN-END:variables | 191 | // End of variables declaration//GEN-END:variables |
| 219 | } | 192 | } |
| diff --git a/client/trunk/src/com/fourisland/instadisc/FirstRun/resources/Step2.properties b/client/trunk/src/com/fourisland/instadisc/FirstRun/resources/Step2.properties index eb8e058..9adb0b8 100644 --- a/client/trunk/src/com/fourisland/instadisc/FirstRun/resources/Step2.properties +++ b/client/trunk/src/com/fourisland/instadisc/FirstRun/resources/Step2.properties | |||
| @@ -3,10 +3,8 @@ jLabel1.text=Central Server Details | |||
| 3 | jLabel1.font=DejaVu Sans-Plain-18 | 3 | jLabel1.font=DejaVu Sans-Plain-18 |
| 4 | jLabel2.text=Username: | 4 | jLabel2.text=Username: |
| 5 | jTextField1.text= | 5 | jTextField1.text= |
| 6 | jTextField3.text= | ||
| 7 | jLabel3.text=Password: | 6 | jLabel3.text=Password: |
| 8 | jLabel4.text=Central Server URL: | ||
| 9 | jLabel5.text= | 7 | jLabel5.text= |
| 10 | jButton1.text=Next | 8 | jButton1.text=Next |
| 11 | jLabel6.text=<HTML>To use InstaDisc, you must have chosen and signed up for a Central Server. Please input below the details it gave you after registration. | 9 | jLabel6.text=<HTML>To use InstaDisc, you must have signed up for the Four Island InstaDisc Central Server. Please input your member details here. |
| 12 | jPasswordField1.text= | 10 | jPasswordField1.text= |
| diff --git a/client/trunk/src/com/fourisland/instadisc/Item/SubscriptionFile.java b/client/trunk/src/com/fourisland/instadisc/Item/SubscriptionFile.java index 0236c11..4d8976d 100644 --- a/client/trunk/src/com/fourisland/instadisc/Item/SubscriptionFile.java +++ b/client/trunk/src/com/fourisland/instadisc/Item/SubscriptionFile.java | |||
| @@ -14,6 +14,8 @@ import java.io.FileNotFoundException; | |||
| 14 | import java.io.IOException; | 14 | import java.io.IOException; |
| 15 | import java.io.InputStream; | 15 | import java.io.InputStream; |
| 16 | import java.net.HttpURLConnection; | 16 | import java.net.HttpURLConnection; |
| 17 | import java.net.URI; | ||
| 18 | import java.net.URISyntaxException; | ||
| 17 | import java.net.URL; | 19 | import java.net.URL; |
| 18 | import java.util.HashMap; | 20 | import java.util.HashMap; |
| 19 | import java.util.logging.Level; | 21 | import java.util.logging.Level; |
| @@ -139,42 +141,56 @@ class SubscriptionFileThread implements Runnable { | |||
| 139 | s.setTitle(headerMap.get("Title")); | 141 | s.setTitle(headerMap.get("Title")); |
| 140 | s.setCategory(headerMap.get("Category")); | 142 | s.setCategory(headerMap.get("Category")); |
| 141 | 143 | ||
| 142 | if (Functions.xor(headerMap.containsKey("Verification"),headerMap.containsKey("Verification-ID"))) | 144 | if (headerMap.containsKey("Series-Control-URL") && headerMap.containsKey("Password") && headerMap.containsKey("Subscription-ID")) |
| 143 | { | 145 | { |
| 144 | if (headerMap.containsKey("Verification")) | 146 | if (headerMap.get("Password").endsWith("On")) |
| 145 | { | 147 | { |
| 146 | AskForPasswordForm afpf = new AskForPasswordForm(new JFrame(),true); | 148 | try |
| 147 | afpf.setVisible(true); | ||
| 148 | |||
| 149 | if (afpf.getEntered() || afpf.getPassword().equals("")) | ||
| 150 | { | 149 | { |
| 151 | MD5 md5 = new MD5(afpf.getPassword()); | 150 | URI url = new URI(headerMap.get("Series-Control-URL")); |
| 152 | MD5 hash = new MD5(s.getTitle() + ":" + md5.hash() + ":" + headerMap.get("Verification-ID")); | 151 | XmlRpc xmlrpc = new XmlRpc(url.toString(), "getPasswordInfo"); |
| 152 | xmlrpc.addParam(headerMap.get("Subscription-ID")); | ||
| 153 | String resp = (String) xmlrpc.execute(); | ||
| 154 | String[] val = resp.split(":"); | ||
| 153 | 155 | ||
| 154 | if (hash.hash().equals(headerMap.get("Verification"))) | 156 | AskForPasswordForm afpf = new AskForPasswordForm(new JFrame(),true); |
| 157 | afpf.setVisible(true); | ||
| 158 | |||
| 159 | if (afpf.getEntered() || afpf.getPassword().equals("")) | ||
| 155 | { | 160 | { |
| 156 | s.setPassword(afpf.getPassword()); | 161 | MD5 md5 = new MD5(afpf.getPassword()); |
| 162 | MD5 hash = new MD5(s.getTitle() + ":" + md5.hash() + ":" + val[1]); | ||
| 163 | |||
| 164 | if (hash.hash().equals(val[0])) | ||
| 165 | { | ||
| 166 | s.setPassword(afpf.getPassword()); | ||
| 167 | } else { | ||
| 168 | status.setText("Error: Incorrect password entered"); | ||
| 169 | return; | ||
| 170 | } | ||
| 157 | } else { | 171 | } else { |
| 158 | status.setText("Error: Incorrect password entered"); | 172 | status.setText("Error: No password entered"); |
| 159 | return; | 173 | return; |
| 160 | } | 174 | } |
| 161 | } else { | 175 | } catch (URISyntaxException ex) |
| 162 | status.setText("Error: No password entered"); | 176 | { |
| 163 | return; | 177 | Logger.getLogger(SubscriptionFileThread.class.getName()).log(Level.SEVERE, null, ex); |
| 164 | } | 178 | } |
| 165 | } else { | 179 | } else { |
| 166 | s.setPassword(""); | 180 | s.setPassword(""); |
| 167 | } | 181 | } |
| 168 | 182 | } else { | |
| 169 | Wrapper.addSubscription(s); | 183 | s.setPassword(""); |
| 184 | } | ||
| 170 | 185 | ||
| 171 | XmlRpc xmlrpc = new XmlRpc("addSubscription"); | 186 | Wrapper.addSubscription(s); |
| 172 | xmlrpc.addParam(headerMap.get("Subscription")); | ||
| 173 | xmlrpc.addParam(headerMap.get("Category")); | ||
| 174 | xmlrpc.execute(); | ||
| 175 | 187 | ||
| 176 | status.setText("You've sucessfully subscribed to that website"); | 188 | XmlRpc xmlrpc = new XmlRpc("addSubscription"); |
| 177 | } | 189 | xmlrpc.addParam(headerMap.get("Subscription")); |
| 190 | xmlrpc.addParam(headerMap.get("Category")); | ||
| 191 | xmlrpc.execute(); | ||
| 192 | |||
| 193 | status.setText("You've sucessfully subscribed to that website"); | ||
| 178 | } else { | 194 | } else { |
| 179 | status.setText("Error: Subscription file is not well-formed"); | 195 | status.setText("Error: Subscription file is not well-formed"); |
| 180 | } | 196 | } |
| diff --git a/client/trunk/src/com/fourisland/instadisc/XmlRpc.java b/client/trunk/src/com/fourisland/instadisc/XmlRpc.java index 8c22155..4fe5b4b 100644 --- a/client/trunk/src/com/fourisland/instadisc/XmlRpc.java +++ b/client/trunk/src/com/fourisland/instadisc/XmlRpc.java | |||
| @@ -23,14 +23,11 @@ public class XmlRpc { | |||
| 23 | private String function; | 23 | private String function; |
| 24 | private Object[] params; | 24 | private Object[] params; |
| 25 | private int step = 3; | 25 | private int step = 3; |
| 26 | private String url = ""; | 26 | private String url; |
| 27 | 27 | ||
| 28 | public XmlRpc(String function) { | 28 | public XmlRpc(String function) { |
| 29 | this.function = function; | 29 | this.function = function; |
| 30 | if (url.equals("")) | 30 | this.url = "http://central.fourisland.com/xmlrpc.php"; |
| 31 | { | ||
| 32 | url = Wrapper.getConfig("centralServerURL"); | ||
| 33 | } | ||
| 34 | 31 | ||
| 35 | Verification ver = new Verification(); | 32 | Verification ver = new Verification(); |
| 36 | params = new Object[3]; | 33 | params = new Object[3]; |
| @@ -39,11 +36,21 @@ public class XmlRpc { | |||
| 39 | params[2] = ver.getID(); | 36 | params[2] = ver.getID(); |
| 40 | } | 37 | } |
| 41 | 38 | ||
| 42 | public XmlRpc(String function, String url, String username, String password) | 39 | public XmlRpc(String url, String function) { |
| 43 | { | ||
| 44 | this.function = function; | 40 | this.function = function; |
| 45 | this.url = url; | 41 | this.url = url; |
| 46 | 42 | ||
| 43 | Verification ver = new Verification(); | ||
| 44 | params = new Object[3]; | ||
| 45 | params[0] = ver.getUsername(); | ||
| 46 | params[1] = ver.getHash(); | ||
| 47 | params[2] = ver.getID(); | ||
| 48 | } | ||
| 49 | |||
| 50 | public XmlRpc(String function, String username, String password) | ||
| 51 | { | ||
| 52 | this.function = function; | ||
| 53 | |||
| 47 | Verification ver = new Verification(username, password); | 54 | Verification ver = new Verification(username, password); |
| 48 | params = new Object[3]; | 55 | params = new Object[3]; |
| 49 | params[0] = ver.getUsername(); | 56 | params[0] = ver.getUsername(); |
| @@ -69,7 +76,7 @@ public class XmlRpc { | |||
| 69 | Object result = null; | 76 | Object result = null; |
| 70 | try { | 77 | try { |
| 71 | XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); | 78 | XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); |
| 72 | config.setServerURL(new URL(url)); | 79 | config.setServerURL(new URL("http://central.fourisland.com/xmlrpc.php")); |
| 73 | XmlRpcClient client = new XmlRpcClient(); | 80 | XmlRpcClient client = new XmlRpcClient(); |
| 74 | client.setConfig(config); | 81 | client.setConfig(config); |
| 75 | 82 | ||
