Updatecheck activator, update authenticate window, exported window no more used.

cusax-fix
Damian Minkov 15 years ago
parent 665318ecb9
commit f9f572270d

@ -170,7 +170,7 @@
<Control Id="DesktopShortcutCheckBox" Type="CheckBox" X="25" Y="90" Width="320" Height="15" Property="CREATE_DESKTOP_SHORTCUT" CheckBoxValue="1" Text="&amp;Desktop" />
<Control Id="StartupShortcutCheckBox" Type="CheckBox" X="25" Y="105" Width="320" Height="15" Property="CREATE_STARTUP_SHORTCUT" CheckBoxValue="1" Text="&amp;Auto-start when computer restarts or reboots" />
<Control Id="RegistryGroup" Type="GroupBox" X="20" Y="130" Width="330" Height="65" Text="&amp;Associate Protocols" />
<Control Id="RegistryGroup" Type="GroupBox" X="20" Y="130" Width="330" Height="40" Text="&amp;Associate Protocols" />
<Control Id="SipRegistryEntriesCheckBox" Type="CheckBox" X="25" Y="145" Width="320" Height="15" Property="CREATE_SIP_REGISTRY_ENTRIES" CheckBoxValue="1" Text="&amp;SIP" />
<!--Control Id="FeedRegistryEntriesCheckBox" Type="CheckBox" X="25" Y="160" Width="320" Height="15" Property="CREATE_FEED_REGISTRY_ENTRIES" CheckBoxValue="1" Text="&amp;FEED" /-->
<Control Id="XmppRegistryEntriesCheckBox" Type="CheckBox" X="25" Y="160" Width="320" Height="15" Property="CREATE_XMPP_REGISTRY_ENTRIES" CheckBoxValue="1" Text="&amp;XMPP" />

@ -614,46 +614,6 @@ else if(u.getProtocol().equals("https"))
vs.getSSLContext(
u.getHost(), port).getSocketFactory());
}
int responseCode = ((HttpURLConnection) uc).getResponseCode();
if(responseCode == HttpURLConnection.HTTP_UNAUTHORIZED)
{
new Thread(new Runnable()
{
public void run()
{
ExportedWindow authWindow =
getUIService().getExportedWindow(
ExportedWindow.AUTHENTICATION_WINDOW);
UserCredentials cred = new UserCredentials();
authWindow.setParams(new Object[]{cred});
authWindow.setVisible(true);
userCredentials = cred;
if(cred.getUserName() == null)
{
userCredentials = null;
}
else
windowsUpdate();
}
}).start();
}
else if(responseCode == HttpURLConnection.HTTP_OK
&& userCredentials != null
&& userCredentials.getUserName() != null
&& userCredentials.isPasswordPersistent())
{
// if save password is checked save the pass
getConfigurationService().setProperty(
UPDATE_USERNAME_CONFIG, userCredentials.getUserName());
getConfigurationService().setProperty(
UPDATE_PASSWORD_CONFIG, new String(Base64.encode(
userCredentials.getPasswordAsString().getBytes())));
}
}
InputStream in = uc.getInputStream();
@ -785,18 +745,25 @@ public boolean verify(String urlHostName, SSLSession session)
{
protected PasswordAuthentication getPasswordAuthentication()
{
// if there is something save return it
ConfigurationService config = getConfigurationService();
String uName
= (String) config.getProperty(UPDATE_USERNAME_CONFIG);
if(uName != null)
if(userCredentials == null)
{
String pass
= (String) config.getProperty(UPDATE_PASSWORD_CONFIG);
// if there is something save return it
ConfigurationService config = getConfigurationService();
String uName
= (String) config.getProperty(UPDATE_USERNAME_CONFIG);
if(uName != null)
{
String pass
= (String) config.getProperty(UPDATE_PASSWORD_CONFIG);
if(pass != null)
return new PasswordAuthentication(uName,
new String(Base64.decode(pass)).toCharArray());
if(pass != null)
{
userCredentials = new UserCredentials();
userCredentials.setUserName(uName);
userCredentials.setPassword(pass.toCharArray());
userCredentials.setPasswordPersistent(true);
}
}
}
if(userCredentials != null)
@ -807,6 +774,43 @@ protected PasswordAuthentication getPasswordAuthentication()
}
else
{
AuthenticationWindow authWindow =
new AuthenticationWindow("host", true, null);
userCredentials = new UserCredentials();
authWindow.setVisible(true);
if (!authWindow.isCanceled())
{
userCredentials.setUserName(authWindow.getUserName());
userCredentials.setPassword(authWindow.getPassword());
userCredentials.setPasswordPersistent(
authWindow.isRememberPassword());
if(authWindow.isRememberPassword())
{
// if save password is checked save the pass
getConfigurationService().setProperty(
UPDATE_USERNAME_CONFIG,
userCredentials.getUserName());
getConfigurationService().setProperty(
UPDATE_PASSWORD_CONFIG,
new String(Base64.encode(
userCredentials.getPasswordAsString()
.getBytes())));
}
return new PasswordAuthentication(
userCredentials.getUserName(),
userCredentials.getPassword());
}
else
{
userCredentials.setUserName(null);
userCredentials = null;
}
return null;
}
}

@ -33,12 +33,6 @@ public interface ExportedWindow
public static final WindowID CHAT_WINDOW
= new WindowID("ChatWindow");
/**
* The authentication window identifier.
*/
public static final WindowID AUTHENTICATION_WINDOW
= new WindowID("AuthenticationWindow");
/**
* The main (contact list) window identifier.
*/

Loading…
Cancel
Save